[Stackless] Select() on channels?
tismer at stackless.com
Fri Sep 14 20:41:14 CEST 2007
Tim Kientzle wrote:
> Christian Tismer wrote:
>>> Is there any way to wait on a set of channels
>>> for the first one to become available?
>> No. *)
>> The other side of the coin is how to generalize waiting for data
>> on multiple I/O channels simultaneously to a very high scale ...
> Yes, Dan Kegel's paper has certainly inspired a lot of
> my own thinking along these lines. (Although supporting c10k
> in any interpreted language still seems quite ambitious.)
Half-way true, hopefully even not. :-)
I think it is possible to build efficient data structures
to pick the first readable channel from some heapq like thing.
The problem is to get the notification and the receiving
of data efficient, where we are very dependent from the OS, less
the language used.
> In my case, I can probably work around it with a simple
> "aggregator" channel. There's a tasklet for each
> channel that does the equivalent of:
> def feed_tasklet(ch, aggregator):
> while True:
> v = ch.receive()
> aggregator.send((ch, v))
> Then the main tasklet can just receive from the
> aggregator channel to get a list of events in whatever
> order they occur.
If that's what you are after, geat. No need for more
cheers - chris
Christian Tismer :^) <mailto:tismer at stackless.com>
tismerysoft GmbH : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56 mobile +49 173 24 18 776 fax +49 30 80 90 57 05
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
More information about the Stackless