Re: Diff between Semaphore and Completion Variable

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

 



I would appreciate if some one could explain the difference between
"completion" variables and the semaphores in Linux.
1) In semaphore, there is a variable, P() first test the variable and make the
process sleep when it equals 0. In condition variable, there is no variable,
instead, condition is external variable defined by process. The variable
is tested by the process itself. In another word, sleeping is explicit in
contion variable while implicit in sempaphore.

2) Whether there are waiting processes, V() alway increases the variable,
however,signal() of contition variable will do nothing when there is no waiting
process.

Hope this helpful !
Good Luck!

Regards,
Cheng

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