[Stackless] multiple channel waits

Aaron Watters aaron at reportlab.com
Thu Aug 15 20:59:45 CEST 2002


>
>
> All operations in Stackless are O(1) now, and I want
> to keep it.
> Select is O(number of channels), KQueue is O(number of activities). 


I think you can implement multiple channel waits with worst case 
O(number of channels in list)
performance (since when the wait completes you have to modify some 
datastructure
associated with each of the channels). I'm really not sure this is 
anything other than a
theoretical concern -- if a program doesn't want the overhead, don't use it.

If you have "kill tasklet" then I think you can emulate multichannel 
waits without
polling:

receiver = channel()
for each waitchannel to waiton:
create a tasklet that receives to waitchannel and passes the data into 
receiver
start all the tasklets and wait for the first tasklet to feed waitchannel
kill all the tasklets that are still waiting after you get the first answer

It seems like a lot of work still though (so many tasklets). I still think
wait on channel list should be a primative, but you're the boss ;).
-- Aaron Watters




More information about the Stackless mailing list