Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Apr 1998 17:07:34 -0500 (EST)
From:      "John S. Dyson" <toor@dyson.iquest.net>
To:        phk@critter.freebsd.dk (Poul-Henning Kamp)
Cc:        gurney_j@resnet.uoregon.edu, freebsd-current@FreeBSD.ORG
Subject:   Re: kernel support for memory semaphores/locks...
Message-ID:  <199804072207.RAA00588@dyson.iquest.net>
In-Reply-To: <2165.891967475@critter.freebsd.dk> from Poul-Henning Kamp at "Apr 7, 98 06:44:35 pm"

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.
> 
Yield is in the kernel.

John

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?199804072207.RAA00588>