From owner-freebsd-arch Mon Sep 25 9:59:47 2000 Delivered-To: freebsd-arch@freebsd.org Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (Postfix) with ESMTP id 4966C37B42C for ; Mon, 25 Sep 2000 09:59:45 -0700 (PDT) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.3/8.9.3) with ESMTP id JAA15818; Mon, 25 Sep 2000 09:59:38 -0700 (PDT) (envelope-from jdp@polstra.com) From: John Polstra Received: (from jdp@localhost) by vashon.polstra.com (8.9.3/8.9.1) id JAA02227; Mon, 25 Sep 2000 09:59:37 -0700 (PDT) (envelope-from jdp@polstra.com) Date: Mon, 25 Sep 2000 09:59:37 -0700 (PDT) Message-Id: <200009251659.JAA02227@vashon.polstra.com> To: arch@freebsd.org Reply-To: arch@freebsd.org Cc: tlambert@primenet.com Subject: Re: Mutexes and semaphores (was: cvs commit: src/sys/conf files In-Reply-To: <200009250827.BAA12659@usr02.primenet.com> References: <200009250827.BAA12659@usr02.primenet.com> Organization: Polstra & Co., Seattle, WA Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In article <200009250827.BAA12659@usr02.primenet.com>, Terry Lambert wrote: > 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 John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Disappointment is a good sign of basic intelligence." -- Chögyam Trungpa To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message