Re: real-time process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>>> "Jan" == Jan Hudec <bulb@ucw.cz> writes:

Jan> 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. 

Jan> Neither does the basic upcall to kernel. So these can be implemented,
Jan> protected by semaphore ... I didn't say it will be efficient, I said
Jan> that it's possible.

Hmm, ok, agreed. Prolly one can implement everything with binary
semaphores :)

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 ?

Jan> You said, that read could possibly avoid copying by replacing PTEs. But
Jan> it counldn't unless the data is appropriately aligned. That is if you
Jan> read a whole page, starting at page-aligned offset and the buffer is
Jan> page-aligned, then it will work, but in most other cases it won't.
Jan> (Exact condition is: if buffer % PAGE_SIZE == offset % PAGE_SIZE, it
Jan> could be done, otherwise not.)

Every buffer larger than or equal to two page sizes contains at least
one page aligned on page size boundary, i.e. at least one page frame.
That page can be remapped. That's why I said "whole overwriten pages".

The first and the last partial pages have to be copied, of course.

~velco
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux