From owner-freebsd-current Tue Apr 7 15:10:53 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA02989 for freebsd-current-outgoing; Tue, 7 Apr 1998 15:10:53 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from dyson.iquest.net (dyson.iquest.net [198.70.144.127]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA02888 for ; Tue, 7 Apr 1998 15:09:59 -0700 (PDT) (envelope-from toor@dyson.iquest.net) Received: (from root@localhost) by dyson.iquest.net (8.8.8/8.8.8) id RAA00588; Tue, 7 Apr 1998 17:07:34 -0500 (EST) (envelope-from toor) From: "John S. Dyson" Message-Id: <199804072207.RAA00588@dyson.iquest.net> 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: Tue, 7 Apr 1998 17:07:34 -0500 (EST) Cc: gurney_j@resnet.uoregon.edu, freebsd-current@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL38 (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 > > >so, how do we go about locking on a shared memory areas? > > > >after discussing this with a friend, ther HAS to be a lock based on a > >shared memory location... the problem with storing the SYSV semaphore > >semid is that there isn't an atomic way of obtaining the new semid > >and putting it in a shared location after a machine reboot... > > 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. > Yield is in the kernel. John To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message