From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113dfb,21c6174a3c733dc0,start X-Google-Attributes: gid113dfb,public X-Google-Thread: f678f,562d37d12a49893d X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1993-09-18 12:00:27 PST Xref: gmd.de comp.unix.osf.misc:500 comp.os.ms-windows.programmer.win32:9087 Path: gmd.de!newsserver.jvnc.net!howland.reston.ans.net!agate!library.ucla.edu!news.mic.ucla.edu!ucla-cs!ucivax!paris.ics.uci.edu!net1.ics.uci.edu!not-for-mail From: schmidt@net1.ics.uci.edu (Douglas C. Schmidt) Newsgroups: comp.unix.osf.misc,comp.os.ms-windows.programmer.win32 Subject: Re: Threads and shared memory Date: 18 Sep 1993 11:21:33 -0700 Organization: University of California at Irvine: ICS Dept. Message-ID: <27fjjd$s41@net1.ics.uci.edu> References: <301@vercors.frec.bull.fr> <27co6m$qsg@liege.ics.uci.edu> Reply-To: schmidt@ics.uci.edu (Douglas C. Schmidt) NNTP-Posting-Host: net1.ics.uci.edu Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit In article , Nathaniel Mishkin wrote: ++ : Unfortunately, WaitForMultipleObjects isn't quite as useful as ++ : select() or poll() since it only reports 1 object of the set of n ++ : objects when it returns ++ ++ As long as WaitForMultipleObjects() is reasonably fast when one of the ++ objects is signalled, I guess I wouldn't worry about this difference ++ from select(). Out of curiosity, under circumstances where many potential descriptors/handles may become "signaled" during a "waitfor..." isn't the WIN 32 approach more likely to end up with more starvation (unless extra steps are taken to avoid it)? For example, consider the following canonical use of select() for a network server with many potential clients, one per descriptor (the poll() approach isn't much different): loop set relevant fd's in descriptor mask select () foreach enabled descriptor loop handle descriptor end loop end loop In this approach, when select() returns, the application can handle all the enabled descriptors in basically any order without (1) additional intervention with the kernel to determine whether the descriptor was enabled (hence, probably more efficient) and (2) without giving preference to any particular descriptor. Now consider the typical WaitForMultipleObjects approach for a similar scenario (please tell me if this is an inaccurate portrayal): loop set up vector of handles WaitForMultipleObjects() perform operation on the *one* signaled handle end loop Now it strikes me that there are several limitations with this approach: (1) if there are k handles/descriptors with I/O enabled it's going to require k calls into the NT kernel to *detect* this (rather than the 1 required for select()) and (2) if there is always I/O available on an earlier descriptor (i.e., one that appears towards the "beginning" of the handle-vector) then won't this handle get served a great deal more than the other ones? I can think of ways to get around this, but it seems like a lot more work! Am I missing something wrt the WIN32 NT "multiple wait" paradigm? Doug -- His life was gentle, and the elements so | Douglas C. Schmidt Mixed in him that nature might stand up | schmidt@ics.uci.edu And say to all the world: "This was a man." | ucivax!schmidt -- In loving memory of Terry Williams (1971-1991)| (714) 856-4101