Re: recursive locking in linux?

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

 



Daniel Rodrick wrote:
> I may be wrong, but from what I understand, the count passed in the
> semaphore initialization
> 
> sema_init(sem, count);
> 
> is the number of threads that are allowed to hold the semaphore
> simultaneously (no of threads that are allowed to enter their critical
> sections simultaneously). So can't a semaphore be actually held
> recursively?

Semaphores are not "held". See below.

> Also, the only difference I could find between a semaphore and mutes
> is that a mutex is a specail and most common form of semaphore where
> only one thread can get it at a time. Are there any other differences?

The difference is that a semaphore has no owner.  Neither semaphores nor
mutexes are a "special form" of the other - they are fundamentally
distinct mechanisms.

~chill

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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