Date: Wed, 28 Jan 2009 09:00:31 +0000 (GMT) From: Robert Watson <rwatson@FreeBSD.org> To: Julian Elischer <julian@elischer.org> Cc: arch@freebsd.org, Alfred Perlstein <alfred@freebsd.org>, Kip Macy <kmacy@freebsd.org>, freebsd-arch@freebsd.org Subject: Re: need for another mutex type/flag? Message-ID: <alpine.BSF.2.00.0901280858380.59876@fledge.watson.org> In-Reply-To: <497DFB61.1010602@elischer.org> References: <497BA91D.805@elischer.org> <497D5DF8.8000706@elischer.org> <20090126105140.GL5889@elvis.mu.org> <200901260936.18232.jhb@freebsd.org> <497DFB61.1010602@elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 26 Jan 2009, Julian Elischer wrote: > maybe what I want is to be able to label a lock as "fleeting" By which I > mean that the work that would be done while holding this lock would be > fleeting (momentary) in nature. > > An example f a fleeting lock would be something that gains the lock in order > to safely switch two pointers. no malloc is required and nothing is going to > take a long time. > > locks that are NOT momentary include holding the process list lock while > allocating a large buffer (series of them) and dumping the contents of all > processes and things like that. > > one might almost say that a fleeting lock might be gotten while holding > another fleeting lock, but that is pushing it for me.. It was probably clear from my previous e-mail, but just in case it wasn't: we already do this. Mutexes and rwlocks (and rmlocks for that matter) fall into the category you call "fleeting", which are allowed to be held over one another (subject to lock order), but never over "non-fleeting" locks such as sx and lockmgr locks. This is comparable to the upper/lower half kernel concept that existed previously: one is allowed to wait for the other, but not vice versa; we allow ithreads to acquire mutexes and rwlocks, but not sx locks because that might involve waiting for themselves. Robert N M Watson Computer Laboratory University of Cambridge
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.0901280858380.59876>