Date: Tue, 7 Jan 1997 17:06:47 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: scrappy@hub.org (The Hermit Hacker) Cc: hackers@FreeBSD.ORG Subject: Re: mmap() updates...how often? Message-ID: <199701080006.RAA15234@phaeton.artisoft.com> In-Reply-To: <Pine.BSF.3.95.970107060738.3629A-100000@thelab.hub.org> from "The Hermit Hacker" at Jan 7, 97 06:18:20 am
next in thread | previous in thread | raw e-mail | index | archive | help
> 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? If it's MAP_SHARED, then it is updated instantaneously... that is, it's the same physical memory mapped into both processes. > 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... You need to notify the client when the data is available, and not reuse the region until the client has used it. The context switch rate for a compute intensive task is 100HZ or once every 10ms. Most likely, the client isn't getting a chance to run, and the server is monopolizing the CPU. > 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() How are you making sure that the server does not reuse the memory region before the client displays it? If the client is an X client, are you using "XSync( Xdisplay);" to make sure the X servr is not "optimizing" away your screen updates? Other than those, no guesses... Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701080006.RAA15234>