From owner-freebsd-current Wed Apr 8 05:05:14 1998 Return-Path: <owner-freebsd-current@FreeBSD.ORG> Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA22225 for freebsd-current-outgoing; Wed, 8 Apr 1998 05:05:14 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from hda.hda.com (hda-bicnet.bicnet.net [208.220.66.37]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA22219 for <freebsd-current@freebsd.org>; Wed, 8 Apr 1998 05:05:11 -0700 (PDT) (envelope-from dufault@hda.hda.com) Received: (from dufault@localhost) by hda.hda.com (8.8.5/8.8.5) id HAA02471; Wed, 8 Apr 1998 07:59:56 -0400 (EDT) From: Peter Dufault <dufault@hda.com> Message-Id: <199804081159.HAA02471@hda.hda.com> Subject: Re: kernel support for memory semaphores/locks... In-Reply-To: <2165.891967475@critter.freebsd.dk> from Poul-Henning Kamp at "Apr 7, 98 06:44:35 pm" To: phk@critter.freebsd.dk (Poul-Henning Kamp) Date: Wed, 8 Apr 1998 07:59:55 -0400 (EDT) Cc: gurney_j@resnet.uoregon.edu, freebsd-current@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL25 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Make your own lock with the cmp8xchg instruction, just like the kernel > does. Check the "lock" instruction on the i386. Also check out the > "mplock.[schwhatever]" somewhere in the kernel. > > >using assembly to do atomic locking isn't an option as you would have > >to spin on the lock... > > No, you'd go to sleep for a jiffy and check again... I belive a yield() > syscall is in the pipeline or maybe already in. Someone has done this - who remembers? I think at Sarnoff. Search the archives. I think it trys first and then sleeps if busy. You could also use a try first then enqueu a request to a server if you want FIFO behavior, etc. There are many ways to skin this cat. P1003.1B semaphore semantics are in progress. Peter -- Peter Dufault (dufault@hda.com) Realtime development, Machine control, HD Associates, Inc. Safety critical systems, Agency approval To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message