Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Dec 2000 10:47:51 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Julian Elischer <julian@elischer.org>
Cc:        archie@FreeBSD.ORG, smp@FreeBSD.ORG
Subject:   RE: looking for locking advice..
Message-ID:  <XFMail.001221104751.jhb@FreeBSD.org>
In-Reply-To: <3A424D2F.6524EC06@elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Julian,

Just use reader/writer locks for now.  They can use a lockmgr backend until a
more efficient reader/writer lock is implemented.  As a side note, we should
probably work up a rw lock API and define some macros that just map to lockmgr
operations for now but can be optimized later.  As for mutexes: you should be
using sleep mutexes, not spin mutexes, in which case interrupts aren't disabled
while the lock is held.  Very, very, very, very few things should be using spin
mutexes.  Note that when a mutex is released, if any threads are blocked on it,
then the thread with the highest priority is woken up so it can run.  Also note
that interrupt threads have a higher priority than all other threads, so yes,
you can block in an interrupt thread.  However, blocking an interrupt thread
is something that should still be somewhat minimized due to shared interrupts
since you will be blocking all interrupt handlers associated with a particular
interrupt source, thus don't go using tsleep() in an interrupt handler, for
example. :)

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.001221104751.jhb>