On Fri, Oct 18, 2002 at 03:48:36PM +0300, Momchil Velikov wrote: > >>>>> "Jan" == Jan Hudec <bulb@ucw.cz> writes: > >> Having said that, a POSIX binary semaphore (a concrete specification) > >> is not equivalent to a POSIX mutex (another concrete specification). > > Jan> Yes, they are, in the sense that you can use posix binary semaphore (as > Jan> only synchronization function) to implement posix mutex iterface and > Jan> vice versa. It will probably be less efficient. > > No they aren't, as POSIX semaphores do not attempt to prevent priority > inversion, while POSIX mutexes implement basic priority inheritance > and priority ceiling protocols. Neither does the basic upcall to kernel. So these can be implemented, protected by semaphore ... I didn't say it will be efficient, I said that it's possible. > Jan> Yes, it should. But then message queue is most appropriate since it can > Jan> also pass the actual data along. That's what a file descriptor with > Jan> appropriately implemented poll is. > >> > >> It involves copying. Theoretically it is possible to have the read > >> system call avoid copying for whole overwriten pages (by exchanging > >> page table entries (and flushing TLBs :-( )), but this may work well > >> on some systems, work not so well on others and not work AT ALL when > >> the source buffer is actually device memory. > > Jan> No, it won't work, because the read buffer would have to have same > Jan> alignment as the data in cache. > > I do not understand this ? What do you mean ? What won't work ? You said, that read could possibly avoid copying by replacing PTEs. But it counldn't unless the data is appropriately aligned. That is if you read a whole page, starting at page-aligned offset and the buffer is page-aligned, then it will work, but in most other cases it won't. (Exact condition is: if buffer % PAGE_SIZE == offset % PAGE_SIZE, it could be done, otherwise not.) ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz> -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/