[Stackless] Modelling simulated time and Granularity

Andrew Francis andrewfr_ice at yahoo.com
Tue Jul 4 18:58:47 CEST 2006


Hi Kai:

>I have Actors. They perform actions which take a
>specific amount of time. The trouble is, Actors can
be >interrupted while performing an action and could
>cancel that action.

Stackless is a cooperative threading system. Unless
you explicitly use run(i), i being a given number of
instructions, I don't know what will interrupt an
actor/tasklet, unless it blocks on a channel or
explicitly yields by calling schedule(). Perhaps you
should be looking at this, since this is the closest
thing Stackless gives you to time-slicing without
rolling your own stuff.

[lines deleted]
>The integrity of the simulated time is important. I
do >not want an actor from the future interacting with
>another still living in the past simply because of
the >way the scheduling worked out. Some ideas have
>introduced that possibility. :p

Off-hand, I don't know an elegant way to solve giving
a tasklet/actor a fixed amount of time. However
concerning logical ordering. I work on WS-BPEL a
language that has constructs for peserving the logical
ordering activities. I have implemented WS-BPEL
scheduler prototypes in Stackless Python.

Conceptually the scheduler is a synchronizer, somewhat
akin the simple local synchronizer in chapter 16 of
Nancy Lynch's "Distributed Algorithms." 

Essentially in my scheduler, tasklets (activities) do
not interact with each other. They interact with a
scheduler. The scheduler knows about dependencies. For
instance, activity C can only start after activity A
and B are finished. Internally C blocks on two queues
(a variation of a channel - if you use a channel, the
system will deadlock), AtoC and BtoC (i do this
because it is straightforward). When A is finished,
the scheduler will write a message to the AtoC queue.
Likewise with B. Now C is unblocked and can run. 

On a slightly different topic, I have started
experimenting with the task loop feature of Twisted.
However I am trying to solve a different problem.

Cheers,
Andrew


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list