Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 07 Apr 1998 18:47:19 -0700 (PDT)
From:      Simon Shapiro <shimon@simon-shapiro.org>
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:  <XFMail.980407184719.shimon@simon-shapiro.org>
In-Reply-To: <19980407072623.51939@hydrogen.nike.efn.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 07-Apr-98 John-Mark Gurney wrote:
> I have writen a memory block based dynamic allocation system (mmalloc)..
> I was planning on using a lock to prevent multiple processes from
> accessing the allocation strutures...  but the only real way is using
> SYSV semaphores...

Not true.  Try the DLM driver.  Faster, cleaner, and distributed (well,
remote host is almost done).  You can lock anything you want in
ways more sophisticated than semaphores can.

> 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...
> 
> so, there are a couple ways we can do this...
> a)    create a new type of file descriptor that is opened on a memory
>       range...  there are a couple of features with this... you could
>       use the poll mechanism to obtain a lock on that region, or you
>       could use read/write to this memory location...  this could be
>       useful for allowing another process to read/write into your data
>       area...
> b)    create two new sysctl's that do locking/unlocking on a region
>       of memory...  this is a simpler method but less powerful...
> 
> using assembly to do atomic locking isn't an option as you would have
> to spin on the lock...
> 
> or is there already a way to do locks using the kernel already?
> 
> -- 
>   John-Mark Gurney                      Modem Rev/FAX: +1 541 346 9237
>   Cu Networking                                         P.O. Box 5693,
97405
> 
>   Live in Peace, destroy Micro$oft, support free software, run FreeBSD
>           Don't trust anyone you don't have the source for
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-current" in the body of the message

----------


Sincerely Yours, 

Simon Shapiro
Shimon@Simon-Shapiro.ORG                      Voice:   503.799.2313

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?XFMail.980407184719.shimon>