Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Sep 2000 18:06:16 +0900
From:      "Daniel C. Sobral" <dcs@newsguy.com>
To:        Joerg Micheel <joerg@cs.waikato.ac.nz>
Cc:        John Baldwin <jhb@pike.osd.bsdi.com>, Greg Lehey <grog@lemis.com>, Chuck Paterson <cp@bsdi.com>, Jason Evans <jasone@canonware.com>, arch@FreeBSD.ORG
Subject:   Re: Long-term mutex ownership (was Re: Interruptable mutex aquires.)
Message-ID:  <39BDF208.2A9F65D0@newsguy.com>
References:  <20000912143855.O88615@wantadilla.lemis.com> <200009120515.WAA78736@pike.osd.bsdi.com> <20000912175725.A70000@cs.waikato.ac.nz>

next in thread | previous in thread | raw e-mail | index | archive | help
Joerg Micheel wrote:
> 
> > Go grab Andrew S. Tannebaum's (sp?) _Modern_Operating_Systems_.  One of
> > the first chapters gives execellent treatment to comparing/contrasting
> > mutexes, semaphores, condition variables, and sleep/wakeup.
> 
> ... and once you are done with it find out that it is all the same
> just offering different views onto something that can be implemented
> and used in exactly the same way. I've just gone through this - trying
> to explain it to 239 second years students - I can't see any difference.

Really, the difference between a mutex and a semaphore is simple. Mutex
is mutual exclusion. It serves solely to garantee exclusive access to
something for some time. Semaphore, which was originally described like
we describe mutex today, has become a rendez-vous mechanism. It controls
resource availability. It can be used either to "consume" resources, of
which the mutex is the trivial case, or used to signal resource
availability, which is more akin to a cv. In the first case, you expect
to enter, and freeze if someone is in (it's an n-exclusion, not mutual
exclusion, problem, though). The the latter case, you expect to freeze,
and enter when something has been produced. <shrugs>

OTOH, I'm not going to defend the difference between cv and
sleep/wakeup. :)

-- 
Daniel C. Sobral			(8-DCS)
dcs@newsguy.com
dcs@freebsd.org
capo@white.bunnies.bsdconspiracy.net

	OK, so the solar flares are my fault.. I am sorry, ok?!?!


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?39BDF208.2A9F65D0>