From owner-freebsd-arch Tue Sep 12 17:31:31 2000 Delivered-To: freebsd-arch@freebsd.org Received: from Awfulhak.org (tun.AwfulHak.org [194.242.139.173]) by hub.freebsd.org (Postfix) with ESMTP id E11C737B424; Tue, 12 Sep 2000 17:31:13 -0700 (PDT) Received: from hak.lan.Awfulhak.org (root@hak.lan.awfulhak.org [172.16.0.12]) by Awfulhak.org (8.11.0/8.11.0) with ESMTP id e8D0ROv08469; Wed, 13 Sep 2000 01:27:24 +0100 (BST) (envelope-from brian@hak.lan.Awfulhak.org) Received: from hak.lan.Awfulhak.org (brian@localhost [127.0.0.1]) by hak.lan.Awfulhak.org (8.11.0/8.11.0) with ESMTP id e8D0RrH91664; Wed, 13 Sep 2000 01:27:53 +0100 (BST) (envelope-from brian@hak.lan.Awfulhak.org) Message-Id: <200009130027.e8D0RrH91664@hak.lan.Awfulhak.org> X-Mailer: exmh version 2.1.1 10/15/1999 To: Joerg Micheel Cc: Greg Lehey , Matthew Jacob , Frank Mayhar , John Baldwin , Mark Murray , 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) In-Reply-To: Message from Joerg Micheel of "Tue, 12 Sep 2000 16:25:06 +1200." <20000912162506.C41113@cs.waikato.ac.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 13 Sep 2000 01:27:53 +0100 From: Brian Somers Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > 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 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