Date: Tue, 07 Apr 1998 18:44:35 +0200 From: Poul-Henning Kamp <phk@critter.freebsd.dk> To: John-Mark Gurney <gurney_j@resnet.uoregon.edu> Cc: FreeBSD Current <freebsd-current@FreeBSD.ORG> Subject: Re: kernel support for memory semaphores/locks... Message-ID: <2165.891967475@critter.freebsd.dk> In-Reply-To: Your message of "Tue, 07 Apr 1998 07:26:23 PDT." <19980407072623.51939@hydrogen.nike.efn.org>
next in thread | previous in thread | raw e-mail | index | archive | help
>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. -- Poul-Henning Kamp FreeBSD coreteam member phk@FreeBSD.ORG "Real hackers run -current on their laptop." "Drink MONO-tonic, it goes down but it will NEVER come back up!" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2165.891967475>