On Nov 21, 2008, at 10:59 AM, Andrew Francis wrote:
JAS> Anyway... remember that Stackless (if you are using
JAS> soft-switching (i.e. not involving stacks in
JAS> C extensions) has (relatively speaking) *very* fast context
JAS> switching.
Yes context switching is fast.
Some observations.....
From the tests I ran (10, 100, 10000 tasklets), all other things
being equal, the context switches start to add up in the single
producer and many consumers example (on my ASUS EEE, the cross-over
was at 1000 tasklets). With 1000 consumers and 1 producer, sender
preference results in 2002 context switches (2 producer context
switches). With receiver preference, 3002 context switches. The
execution time was also slightly quicker (i don't know about the
precision of of time.time() so I have to look into that).
Compared to a typical OS scheduler, stackless scheduling is extremely
lightweight, as there's no timer interrupt, no CPU context switch, no
changes to the address map, etc. The major issue is probably going to
be cache misses, and toy examples aren't really going to exercise
those effects.
In my (somewhat limited) experience with Stackless, workflow issues
dominate here. There are some workflow patterns where it's very
important that a sender be able to queue as many outgoing messages as
possible before it relinquishes the CPU, others where it's more
important that the receiver begin processing as quickly as possible.
The "receiver preference" and "sender preference" knobs seem to
provide a pretty good way to model those requirements.
Tim
_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless