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.


-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

[Index of Archives]     [Audio]     [Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux