Date: Wed, 13 Sep 2000 01:27:53 +0100 From: Brian Somers <brian@Awfulhak.org> To: Joerg Micheel <joerg@cs.waikato.ac.nz> Cc: Greg Lehey <grog@lemis.com>, Matthew Jacob <mjacob@feral.com>, Frank Mayhar <frank@exit.com>, John Baldwin <jhb@pike.osd.bsdi.com>, Mark Murray <markm@FreeBSD.org>, FreeBSD-arch@FreeBSD.org, brian@Awfulhak.org Subject: Re: Mutexes and semaphores (was: cvs commit: src/sys/conf files src/sys/sys random.h src/sys/dev/randomdev hash.c hash.h harvest.c randomdev.c yarrow.c yarro) Message-ID: <200009130027.e8D0RrH91664@hak.lan.Awfulhak.org> In-Reply-To: Message from Joerg Micheel <joerg@cs.waikato.ac.nz> of "Tue, 12 Sep 2000 16:25:06 %2B1200." <20000912162506.C41113@cs.waikato.ac.nz>
next in thread | previous in thread | raw e-mail | index | archive | help
> > What's the difference between a mutex and a semaphore? > > None, if it comes to the actual usage and implementation. Usually, > people will use semaphores for locking blocks of code, mutexes for > data structures. Not much of a difference in the end result, but > locking data structures seems more natural to me. I would tend to disagree. A mutex is a way of guaranteeing that a resource isn't used more than once. A semaphore is a mechanism for queuing a notification to a (potentially) waiting process. A mutex is just a binary semaphore, but I don't think that's relevant. -- Brian <brian@Awfulhak.org> <brian@[uk.]FreeBSD.org> <http://www.Awfulhak.org> <brian@[uk.]OpenBSD.org> Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009130027.e8D0RrH91664>