From owner-freebsd-stable Sat Jun 27 09:11:45 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA27100 for freebsd-stable-outgoing; Sat, 27 Jun 1998 09:11:45 -0700 (PDT) (envelope-from owner-freebsd-stable@FreeBSD.ORG) Received: from iglou.com (sendmail@iglou2.iglou.com [192.107.41.17]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA27069; Sat, 27 Jun 1998 09:11:32 -0700 (PDT) (envelope-from dbj@iglou.com) Received: from lou-ts3-11.iglou.com ([204.255.239.126] helo=localhost) by iglou.com with smtp (8.7.3/8.6.12) id 0ypxZa-0004Uh-00; Sat, 27 Jun 1998 12:11:30 -0400 Date: Sat, 27 Jun 1998 12:12:25 -0400 (EDT) From: "David E. Brooks Jr" X-Sender: dbj@localhost To: freebsd-questions@FreeBSD.ORG, freebsd-stable@FreeBSD.ORG Subject: mmap() and process synchronization Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I'm looking into using mmap() for sharing memory (read/write) between multiple process, which of course means I'll need a means of synchronization. Not being overly fond of the System V semaphore routines, I looked for alternatives. Particularly intriguing was the reference to a MAP_HASSEMAPHORE flag in the mmap(2) man page. The 'newvm' paper (in /usr/share/doc/papers) was informative, so I eagerly went looking for the mset()/mclear() code to see how it was implemented. Sadly they're not implemented in 2.2.6-STABLE. This is too bad since mset()/mclear() look far faster in concept than the System V alternative. Is there any plan to implement mset(), mclear(), msleep() and mwakeup()? It doesn't seem they would be overly difficult to implement correctly (but I've never done any kernel-level work, either). This leads me to my second question: Foregoing the availability of mset() and company, what is considered the "canonical' method of process synchronization when using mmap()? System V semaphores? flock(2)? (Neither of those approaches are particularly appealing). -- Dave -- David E. Brooks Jr dbj@iglou.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message