On Mon, 19 Mar 2007, Daniel Rodrick wrote: > On 3/18/07, Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote: > > On Sat, 2007-03-17 at 09:21 -0400, Robert P. J. Day wrote: > > > does linux support recursive locking with any of its synchronization > > > primitives? love's book on kernel development is adamant that linux > > > has no recursive locks, but i've seen other documentation that seems > > > to suggest that it exists, although i'm not sure where. > > > > the big kernel lock (BKL) allows recursion. > > in theory rw spinlocks can allow recursion in linux. > > > > it's really bad coding practice though... > > > > (all other primitives are not recursive) > > Hi, > > 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? > > 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 doc file Documentation/mutex-design.txt suggests that there are architectural advantages to mutexes over semaphores. however, i am confused about one passage in that file: "The stricter mutex API means you cannot use mutexes the same way you can use semaphores: e.g. they cannot be used from an interrupt context, ..." i thought you couldn't use semaphores from interrupt context, anyway. can someone clarify this? thanks. rday -- ======================================================================== Robert P. J. Day Linux Consulting, Training and Annoying Kernel Pedantry Waterloo, Ontario, CANADA http://fsdev.net/wiki/index.php?title=Main_Page ======================================================================== -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ