[Stackless] Select() on
andrewfr_ice at yahoo.com
Sat Sep 15 22:02:40 CEST 2007
Hi Richard and Colleagues:
On 9/14/07, Christian Tismer <tismer at stackless.com>
CT> An inefficient but probably working solution is
CT>this silly idea:
CT> - For each of the n channels to be waited on,
CT>create a tasklet
CT> that blocks reading on this channel.
CT> - it runs code like this after the receive:
CT> - kill the other extra tasklets
CT> - send the result on the multi-channel
I don't think this approach is all that silly.... Much
depends at how high (or low) a level one is working...
I am building a WS-BPEL processor. WS-BPEL has an
activity called Pick. In workflow, activities such as
Pick are known as "discriminators."
Pick waits on several events/action pairs (read
tasklets). The first event to occur, executes the
associated actions. In turn, the WS-BPEL processor
terminates the remaining events/actions.
Note, I use Twisted. In my architecture, the following
1) Actvity tasklets associated with the Pick, suspend
on a channel. I use a notion of a process group to
associated related tasklets to a particular Pick.
2) A special tasklet, the processor, communicates with
both with the reactor and the activity tasklets. In a
while, the processor is a scheduler built over the
3) When an event occurs, the processor resumes the
first tasklet. The remaining tasklets are resumed, but
a flag is set, throwing an exception (I could use
send_exception()) that cancels the tasklet.
RW>Stackless is a minimal set of functionality. I
RW>like that it just provides a set of primitives. To
RW>me this functionality and many of the things
RW>discussed recently are better placed in a library
RW>framework which can be chosen for use over
I have grown to like this minimalist approach. For
example, my jury is still out whether Stackless should
have a built-in queue. I feel empirical analysis will
solve this problem. Since I don't use select()
directly, a baked-in discriminator wouldn't help.
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
More information about the Stackless