[Stackless] Stackless / Networking
Andrew Francis
andrewfr_ice at yahoo.com
Wed Feb 21 01:24:12 CET 2007
Hello Greg:
--- ghazel at gmail.com wrote:
This discussion is great!
> It's true, but having a scheduled task will prevent
> it from blocking longer than would overlap it.
The problem I see is that the Twisted scheduled task
(a callback) ought to call schedule() to give other
tasklets a chance to run. I don't had a good mental
model of what is happening between between Twisted
callbacks and Stackless tasklets in this scenario.
> The problem with two threads in my opinion is the
> multitude of race conditions and such that arise. If
>you have a good separation between the
> tasklets task and the network tasks, this could be
> ok. But, if you had a tasklet for every connection
>it could get quite difficult to coordinate.
Greg you have a valid argument. In my proposed
solution, Twisted and Stackless communicate through
deques. A single dispatcher (or IOScheduler) stackless
tasklet polls the deque. If the deque is empty it
schedules, giving other tasklets that can run, a
chance to execute. If there is a message, it farms it
out to the appropriate tasklet. I believe this to be a
loosely coupled and rather safe approach.
Again, if I can find coiterator examples, I may try
out this approach to see if it works. I try to strike
a balance research with development :-)
If I can put a dent in my work, I will try to post my
approach on the Wiki by the weekend. Right now, I want
to do some more implementation and testing to see if
my approach actually works.
Cheers,
Andrew
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list