From owner-freebsd-smp Tue Oct 31 19:50:51 2000 Delivered-To: freebsd-smp@freebsd.org Received: from sydney.worldwide.lemis.com (sydney.worldwide.lemis.com [192.109.197.167]) by hub.freebsd.org (Postfix) with ESMTP id 2427037B4C5; Tue, 31 Oct 2000 19:50:44 -0800 (PST) Received: (from grog@localhost) by wantadilla.lemis.com (8.11.0/8.9.3) id e973vqA28717; Sat, 7 Oct 2000 13:27:52 +0930 (CST) (envelope-from grog) Date: Sat, 7 Oct 2000 13:27:52 +0930 From: Greg Lehey To: Terry Lambert Cc: John Baldwin , Daniel Eischen , arch@FreeBSD.ORG, Alfred Perlstein , Mark Murray , Jake Burkholder , Boris Popov , freebsd-smp@FreeBSD.ORG Subject: Re: Mutexes and semaphores Message-ID: <20001007132752.A28665@wantadilla.lemis.com> References: <20001005113139.C27736@fw.wintelcom.net> <200010052142.OAA15421@usr05.primenet.com> <200009251938.MAA29311@usr02.primenet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <200009251938.MAA29311@usr02.primenet.com>; from tlambert@primenet.com on Mon, Sep 25, 2000 at 07:38:22PM +0000 Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.lemis.com/~grog X-PGP-Fingerprint: 6B 7B C3 8C 61 CD 54 AF 13 24 52 F8 6D A4 95 EF Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Monday, 25 September 2000 at 19:38:22 +0000, Terry Lambert wrote: >>> If we are going to support recursive mutex, I think it would be >>> better to add separate calls/macros/data types to support them, >>> so the the mtx mutexes can be simplified. Calls to mtx_enter >>> with the recursive mutex type wouldn't even compile. >> >> Err, the recursive nature of the mutexes is very trivial. It >> doesn't affect the complexity of the mutexes at all. > > Yes, it does. Ownership precludes hand-off. Recusrion support > implies permission and tacit approval. > > A mutex is not recursive. There are things you simply can not > implement when recursion is permitted for all of your primitives. > > The most obvious argument is still that a mutex is intended to > protect data, not code. Recursion is only required if the mutex > is actually protecting reentrancy of code, not access to data. On Thursday, 5 October 2000 at 21:42:28 +0000, Terry Lambert wrote: >>> There is another problem; printf's inside a kthread corrupt like >>> crazy. They look very unthreadsafe. >> >> do NOT use printf without Giant. > > This strikes me as being rather inane. > > If printf won't work without holging the lock, then it damn well > should acquire the lock if it isn't already held, and release it > if it acquired it, before returning. Make up your mind. Greg -- Finger grog@lemis.com for PGP public key See complete headers for address and phone numbers To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message