[Stackless] Algorithm for Stackless Scheduler

Andrew Francis andrewfr_ice at yahoo.com
Wed Nov 12 01:02:38 CET 2008

Hi Jeff:

--- On Tue, 11/11/08, Jeff Senn <senn at maya.com> wrote:

Thanks for the explanation. There are parts of the scheduler algorithm where I am not entirely clear. I am particularly interested in knowing all the conditions when context switches occur.

(I started writing tests to examine behaviour)

>   OR (depending on the channel preference) continue in the
> caller (inserting the sender/receiver at the "other
> end" onto runnables) or rotate the head of runnables to the >sender/receiver and pick up there.

Jeff, I am not clear on all the conditions under which a rotate happens.

Take the following: There are blocked tasklets on a channel (CH). The channel preference is -1 (receiver preference)

Runnable: P  
Blocked: C[0],C[1] on CH

  for i in range(0,MAX):

after the first iteration, do we have the following:

Blocked: C[1]
Runnable: C[0], P  (a context switch)


Blocked: C[1]
Runnable: P, C[0] 

A test suggests the former (which would make sense)

In the case of sender preference -1, after P terminates, would I have

Runnables: C[0],C[1]

I am assuming in the case of sender preference (and a single producer many receivers), things are faster because fewer context switches occur.

Another question, at what stage is information transferred from the sender to the receiver?



More information about the Stackless mailing list