Stackless python and microthreads

Matt Leslie matthewleslie at hotmail.com
Fri May 21 17:50:08 EDT 2004


>> Now instead of a tedious kind of state machine, you're writing an plain,
>> ordinary function that sends messages to its peer and looks at the 
>> response,
>> as though that were all synchronous, and it's so much simpler.  Yet the
>> execution underneath that isn't synchronous at all, because your 
>> computation
>> is suspended in between your send and the response.  It really does 
>> return
>> every time it sends a message, it just starts up next time where it left
>> off.
> 
> 

Infact this is also similar to what I'm trying to do, except I'm doing 
it back to front. I want to write a package to help simulate distributed 
systems, making what would be simple synchronous method calls 
asynchronous. I do this by intercepting method calls between threads, 
and passing them on only after a simulated network delay - they are held 
in an event queue and basically only executed when there is nothing 
scheduled to happen 'before' it. It boils down to a similar structure, I 
think.

Anyway, stackless would be good for this because I need lots of threads 
so simulate large scale P2P systems. The thing is although there was a 
fair amount of documentation on microthreads I can find nothing usefull 
on tasklets! Can anyone point me at some? Please? The stackless mailing 
list has turned up nothing so far...

Matt




More information about the Python-list mailing list