Re: semaphore query.

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

 



On 12/27/06, hemen.kapadia@xxxxxxx <hemen.kapadia@xxxxxxx> wrote:
>> Will the up() method of the semaphore execute a waiting process in the
>> semaphore queue each time it is executed (assuming that there are
waiting
>> processes in the queue) or only when the new value of the semaphore is
>> greater than or equal to 0 ?

>>think about how semaphores are designed ... every up() should wake up a
process

Precisely, as I thought it shoudl work. However i got confused when I read
the following in "Understanding the Linux Kernel Book"

"The up( ) method increments the value of the semaphore and, ***if its new
value is greater than or equal to 0***, reactivates one or more processes
in the semaphore list."

That If seems to indicate that the job is picked from the queve only if the
condition is TRUE, which is immaterial in reality.

Thanks Mike.

if you look at the implementation you see:
up() calls __up_wakeup()
__up_wakeup() calls __up()
__up() calls wake_up()
-mike
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



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