Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Aug 2000 14:29:14 +0200
From:      Jonas Bulow <jonas.bulow@servicefactory.se>
To:        hackers@freebsd.org
Subject:   Re: IPC, shared memory, syncronization
Message-ID:  <3995431A.324F8C89@servicefactory.se>
References:  <39943C37.76D2DBCC@servicefactory.se> <39948331.5E83DE1B@servicefactory.se> <200008120230.TAA60410@vashon.polstra.com>

next in thread | previous in thread | raw e-mail | index | archive | help
John Polstra wrote:
> If you want the "BSD way" you should probably create a 0-length
> temporary file somewhere and use the flock(2) system call on it.  The
> file itself isn't important; it's just something to lock.

I don't see any reason to do system calls just because I want to do an
atomic operation (i.e aquire/release a lock).

I found some really good code (:-)) in
/usr/src/libexec/rtld-elf/i386/lockdflt.c that seems to do what I want.
It's more the "i386"-way than the BSD-way. Maybe I havn't been thinking
enough but wouldn't this lock mechanism be a good choice to use for
mmaped:memory accessed by multiple processes? 

In lock_create the lock is aligned to CACHE_LINE_SIZE. Why is that
important?


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3995431A.324F8C89>