From owner-freebsd-hackers Tue Jan 7 06:04:13 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id GAA23217 for hackers-outgoing; Tue, 7 Jan 1997 06:04:13 -0800 (PST) Received: from dyson.iquest.net (dyson.iquest.net [198.70.144.127]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id GAA23205 for ; Tue, 7 Jan 1997 06:04:03 -0800 (PST) Received: (from root@localhost) by dyson.iquest.net (8.8.4/8.6.9) id JAA05460; Tue, 7 Jan 1997 09:03:32 -0500 (EST) From: "John S. Dyson" Message-Id: <199701071403.JAA05460@dyson.iquest.net> Subject: Re: mmap() updates...how often? To: dufault@hda.com (Peter Dufault) Date: Tue, 7 Jan 1997 09:03:32 -0500 (EST) Cc: scrappy@hub.org, hackers@FreeBSD.ORG In-Reply-To: <199701071241.HAA02180@hda.hda.com> from "Peter Dufault" at Jan 7, 97 07:41:06 am X-Mailer: ELM [version 2.4 PL24 ME8] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > > Not quite sure how to word this one, but how often does > > an mmap() region get updated, in so far as client processes seeing > > the data that the server process writes to it? > > > > The reason I'm asking is that I have a program that is using > > mmap() to pass frames from a central server to client processes. The > > central server is writing, on average, 20frames/sec to the mmap()'d > > region, and after each write, it sets a counter, also mmap()'d, that > > the client uses as, more or less, a position indicator. > > I do something similar, running a simulation that puts a simulation > frame in a shared region and then writes a token to a simulation > pipeline to synchronize the stages of the pipeline. I don't use > msync() and haven't had any funny problems. One difference may be > that my entire pipeline is synchronized (each stage passes the > token along until it comes back to the originator) since there is > ordering in the stages. > > I'm sure you're using MAP_SHARED. > I would think that the problem is that you have a process dumping data into the mmapped region? And another looking at it? I think that you need to wake-up the consumer process for every frame (somehow -- perhaps with sending a message through a pipe or SYSVSEM???) If you don't do that, then you'll simply be dependent on the process scheduler -- and that can do almost ANYTHING to you. John