From owner-freebsd-hackers Tue Jan 7 02:18:35 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id CAA12324 for hackers-outgoing; Tue, 7 Jan 1997 02:18:35 -0800 (PST) Received: from thelab.hub.org (hal-ns1-02.netcom.ca [207.181.94.66]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id CAA12317 for ; Tue, 7 Jan 1997 02:18:30 -0800 (PST) Received: from localhost (scrappy@localhost) by thelab.hub.org (8.8.4/8.8.2) with SMTP id GAA03896 for ; Tue, 7 Jan 1997 06:18:20 -0400 (AST) X-Authentication-Warning: thelab.hub.org: scrappy owned process doing -bs Date: Tue, 7 Jan 1997 06:18:20 -0400 (AST) From: The Hermit Hacker To: hackers@freebsd.org Subject: mmap() updates...how often? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi... 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. The problem is that the client seems only to see every 20th frame, as far as the indicator is concerned. I would expect some "skippage" between client reads (ie. server wrote 2 frames before the client got a chance to check the indicator again), but it seems to be *very* consistent at 20... Does this make sense? I thought about making use of msync() right after writing each frame, but looking at the man page (if I'm reading it right) seems to indicate that this would just write the data from memory to the disk file...and since I'm closing the disk file after memory mapping it, don't believe this is appropriate... Not being quite sure of what other data I can provide, does anyone have any suggestions on what I'm seeing? Since its memory mapped, I would have made the assumption that changes to the data would be seen instantaneously by the client, but either I'm missing something in my code (staring at it too long does that) or I'm once more missing something with mmap() Thanks...