Re: Diff between Semaphore and Completion Variable

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

 



On Tue, 2006-06-06 at 17:27 +0530, Rajat Jain wrote:
> Hi,
> 
> I would appreciate if some one could explain the difference between
> "completion" variables and the semaphores in Linux.
> 
> As far as I can understand, both are used to provide synchronization
> among kernel threads. Both have similar mechanism i.e. one or more
> tasks wait on the completion variable (or semaphore) while another
> task holds it and does some work (in critical section). When the task
> holding the completion variable (or semaphore) is done, it signals the
> other task using "complete" (or "up"). This would cause the waiting
> tasks to wait up.
> 
> So why have two different things to do the same thing?

they don't do the same thing just like a hammer and a couch are two
different things.

a completion is for doing "wait until this event is finished", while a
semaphore (well don't use semaphores, use a mutex nowadays) is for
providing mutual exclusion for a piece of data.
Totally different things.



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