From owner-freebsd-smp Thu Dec 21 13:11:18 2000 From owner-freebsd-smp@FreeBSD.ORG Thu Dec 21 13:11:16 2000 Return-Path: Delivered-To: freebsd-smp@freebsd.org Received: from mail.interware.hu (mail.interware.hu [195.70.32.130]) by hub.freebsd.org (Postfix) with ESMTP id E114737B400; Thu, 21 Dec 2000 13:11:14 -0800 (PST) Received: from pretoria-57.budapest.interware.hu ([195.70.53.121] helo=elischer.org) by mail.interware.hu with esmtp (Exim 3.16 #1 (Debian)) id 149CzU-0003Oy-00; Thu, 21 Dec 2000 22:11:09 +0100 Sender: julian@FreeBSD.ORG Message-ID: <3A4271B9.223CD683@elischer.org> Date: Thu, 21 Dec 2000 13:10:17 -0800 From: Julian Elischer X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 5.0-CURRENT i386) X-Accept-Language: en, hu MIME-Version: 1.0 To: John Baldwin Cc: archie@FreeBSD.ORG, smp@FreeBSD.ORG Subject: Re: looking for locking advice.. References: Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org John Baldwin wrote: > > 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. :) well if I block, and I can't use sleep, what CAN I use? I need the previously running process/thread to continue running because it is holding the lock I want to obtain.. when it finishes and releases the lock I want to be called to continue.. > > -- > > John Baldwin -- 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 -- __--_|\ Julian Elischer / \ julian@elischer.org ( OZ ) World tour 2000 ---> X_.---._/ presently in: Budapest v To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message