Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Jan 1997 06:18:20 -0400 (AST)
From:      The Hermit Hacker <scrappy@hub.org>
To:        hackers@freebsd.org
Subject:   mmap() updates...how often?
Message-ID:  <Pine.BSF.3.95.970107060738.3629A-100000@thelab.hub.org>

next in thread | raw e-mail | index | archive | help

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...





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.970107060738.3629A-100000>