Date: Mon, 25 Sep 2000 19:31:09 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: arch@freebsd.org Cc: tlambert@primenet.com Subject: Re: Mutexes and semaphores (was: cvs commit: src/sys/conf files Message-ID: <200009251931.MAA29117@usr02.primenet.com> In-Reply-To: <200009251659.JAA02227@vashon.polstra.com> from "John Polstra" at Sep 25, 2000 09:59:37 AM
next in thread | previous in thread | raw e-mail | index | archive | help
> > With the suggested mutex recursion (please -- use a counting > > semaphore, not a mutex, if you are going to permit recursion!), > > Please explain why you think a counting semaphore has anything to do > with recursion. To support recursion a mutual exclusion primitive > has to support the concept of ownership. I.e., if you already own > it you can acquire it recursively, but if somebody else owns it then > you cannot. A counting semaphore does not support that concept. The > count is not a recursion count at all. Search google for "counting > semaphore" and you'll find any number of introductory class notes on > semaphores. Or cut right to the chase and go to a typical one at > > http://www.erc.msstate.edu/~ioana/POWERPOINT/CS4163/slides/Threads/tsld022.htm Recursion should be such an exceptional condition that it should be implemented with a seperate struct and a counting semaphore. Counting semaphores have owners,; mutexes do not. Therefore they are a more appropriate primitive. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009251931.MAA29117>