Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: schmidt@net1.ics.uci.edu (Douglas C. Schmidt)
Subject: Re: Threads and shared memory
Date: 18 Sep 1993 11:21:33 -0700	[thread overview]
Message-ID: <27fjjd$s41@net1.ics.uci.edu> (raw)
In-Reply-To: CDIL0p.C8E@atria.com

In article <CDIL0p.C8E@atria.com>, Nathaniel Mishkin <mishkin@atria.com> 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


  reply	other threads:[~1993-09-18 18:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-16  9:36 Threads and shared memory Bruno.Richoux        
1993-09-17 13:58 ` Nathaniel Mishkin
1993-09-17 13:44   ` David Wright
1993-09-17 16:05   ` Andrew Hastings
1993-09-17 16:21   ` Douglas C. Schmidt
1993-09-17 20:02     ` Nathaniel Mishkin
1993-09-18 18:21       ` Douglas C. Schmidt [this message]
1993-09-19 23:12         ` Dave Weisman
1993-09-22 20:07           ` Brian Sturgill
1993-09-23  1:20             ` Douglas C. Schmidt
1993-09-23 13:09               ` Nathaniel Mishkin
1993-09-27 13:54               ` George J. Carrette
1993-09-17 14:48 ` Dave McCracken
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox