From owner-freebsd-hackers Tue Jan 7 16:47:31 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id QAA29113 for hackers-outgoing; Tue, 7 Jan 1997 16:47:31 -0800 (PST) Received: from thelab.hub.org (hal-ns3-21.netcom.ca [207.181.94.149]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id QAA29107 for ; Tue, 7 Jan 1997 16:47:27 -0800 (PST) Received: from localhost (scrappy@localhost) by thelab.hub.org (8.8.4/8.8.2) with SMTP id UAA06262; Tue, 7 Jan 1997 20:45:50 -0400 (AST) X-Authentication-Warning: thelab.hub.org: scrappy owned process doing -bs Date: Tue, 7 Jan 1997 20:45:50 -0400 (AST) From: The Hermit Hacker To: Terry Lambert cc: hackers@FreeBSD.ORG Subject: Re: mmap() updates...how often? In-Reply-To: <199701080006.RAA15234@phaeton.artisoft.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Tue, 7 Jan 1997, Terry Lambert wrote: > If it's MAP_SHARED, then it is updated instantaneously... that is, > it's the same physical memory mapped into both processes. > Okay, that is how its MAP'd...so that isn't my problem... > 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. > This sounds reasonable... > > 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? > This is currently the problem I'm looking at fixing... I'm going through the various "solutions" addressed in "Advanced Programming in the Unix Environment" by Stevens, but so far haven't found something that "sounds" reasonable. Its a one->many setup, with many being anywhere from 1 to 1000, at any one time. Semaphores, from what little I understand of them, won't cut it, because I'll have to go through hoops to make sure that each of the clients gets registered with the server, and then de-registered once they go away. Unfortunately, my understanding of them is *very* weak until I've actually programmed them (chicken before egg dilemna *sigh*)... The one thing I was thinking of was to create a socket-based ctl channel. So, when the server has written the frame to memory, it loops through the client sockets, sending it a control message. Then, once that is done, it can go to the next frame. The problem with that is that the server is currently able to write 20+frames/sec to the MMAP'd region...what sort of slowdown can I expect if I have 1000 open sockets that each have to have that control data written to, sequentially? Oh well... I'm still looking for solutions, so if anyone has a path that they think I should research further (ie. am I mistake about semaphores?), please let me know...am all ears... > 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? > No, not using X at all...