From owner-freebsd-hackers Fri Aug 11 15:50:36 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from oden.exmandato.se (oden.exmandato.se [192.71.33.1]) by hub.freebsd.org (Postfix) with ESMTP id 1F8AE37BC72 for ; Fri, 11 Aug 2000 15:50:32 -0700 (PDT) (envelope-from jonas.bulow@servicefactory.se) Received: from servicefactory.se (root@oden.exmandato.se [192.71.33.1]) by oden.exmandato.se (8.8.8/8.8.5) with ESMTP id AAA27091 for ; Sat, 12 Aug 2000 00:50:29 +0200 (MET DST) Message-ID: <39948331.5E83DE1B@servicefactory.se> Date: Sat, 12 Aug 2000 00:50:26 +0200 From: Jonas Bulow X-Mailer: Mozilla 4.72 [en] (X11; U; FreeBSD 4.1-STABLE i386) X-Accept-Language: en MIME-Version: 1.0 To: hackers@FreeBSD.ORG Subject: Re: IPC, shared memory, syncronization References: <39943C37.76D2DBCC@servicefactory.se> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Jonas Bulow wrote: > > What is the "BSD-way" of access to shared memory (mmap:ed) secure (avoid > race conditions, etc)? Right now I'm using posix semaphores but I would > like to know if there is a substitute like the way kqueue is for > select/poll. Hmm, I think I lost some word and deeper thought in my previous mail. :-) The problem is as follows: I have a couple of processes using a mmap:ed file as common data area. What I want to do is to make it safe for all processes to update data in this common memory area. I was thinking about using some part of the common data area for semaphores in some way. I just want a simple "test-and-set" operation I can use to make sure there is only one process writing to the common data area. To take the "test-and-set" further, I would like to make the process wait for the lock to be released. Can anyone give me hint how this is best implemented with FreeBSD as OS? I apology if this is not a pure FreeBSD related question but I could not find a better forum for this question. I could only find out solutions based on posix semaphores. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message