Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Sep 2000 21:02:49 -0600
From:      Chuck Paterson <cp@bsdi.com>
To:        Archie Cobbs <archie@whistle.com>
Cc:        Brian Somers <brian@awfulhak.org>, Joerg Micheel <joerg@cs.waikato.ac.nz>, 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
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:  <200009240302.VAA20719@berserker.bsdi.com>
In-Reply-To: Your message of "Sat, 23 Sep 2000 12:42:47 PDT." <200009231942.MAA06755@bubba.whistle.com> 

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

}Once you have the spin lock primitive, you can easily build
}semaphores, sleep queues, etc. A semaphore is just a counter plus
}a sleep queue -- all protected by the spin lock.
}
}A MUTEX is just a sepaphore whose initial count is 1.
}
}??

In general this might be true, but in specific it isn't. The
sleep version of mutexs have no spin lock. Spin locks are 
more expensive than the mutices currently in FreeBSD and BSD/OS.
In order to acquire a spin locks interrupts must be blocked,
which isn't the case for mutices which are not contested.

Chuck


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?200009240302.VAA20719>