[Stackless] Re: [Python-Dev] Stackless Design Q.

Samuel Smith smithsm at samuelsmith.org
Tue Feb 26 01:04:35 CET 2002

>For sending values from one tasklet to another, I think
>I'd use an intermediate object to mediate the transfer,
>something like a channel in Occam:
>    c = channel()

I agree as long as the channel can be arbitrarily complex ie a large 
data structure or shared memory database.

>    # tasklet 1 does:
>    c.send(value)
>    # tasklet 2 does:
>    value = c.receive()
>Tasklet 1 blocks at the send() until tasklet 2 reaches
>the receive(), or vice versa if tasklet 2 reaches the
>receive() first. When they're both ready, the value is
>transferred and both tasklets are unblocked.

There should be a non blocking way for tasklets to communicate.
That is one writer but many readers
With potentially thousands of tasklets to communicate with each other 
a publish subscribe paradigm is more appropriate than a message 
passing paradigm.
Blocking should be the exception rather than the rule.

Component based architectures for multiple autonomous agents are based on a
framework where data is shared transparently and one agent (tasklet) doesn't
need to know about any other agent(tasklet) only about the structure 
of the data
shared and what portions of the data share a given agent can write too.

>The advantage of this is that it's more symmetrical.
>Instead of one tasklet having to know about the
>other, they don't know about each other but they
>both know about the intermediate object.

Yes, but your channel example still looks like a message passing 
paradigm in function since it is blocking but at least avoids the 
constraint of having to know about the other end.

>  > I want to provide an exception to kill tasklets.
>>  Also it will be prossible to just pick it off and drop it,
>>  but I'm a little concerned about the C stack inside.
>As I said before, if there are no references left to a
>tasklet, there's no way it can ever be switched to again,
>so its C stack is no longer relevant. Unless you can have
>return addresses from one C stack pointing into another,
>or something... can you?
>Greg Ewing, Computer Science Dept, +--------------------------------------+
>University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
>Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
>greg at cosc.canterbury.ac.nz	   +--------------------------------------+
>Stackless mailing list
>Stackless at www.tismer.com


Samuel M. Smith Ph.D.

360 W. 920 N.
Orem, Utah 84057

801-226-7607 x112 (voice)
801-226-7608 (fax)
http://www.samuelsmith.org (web)

Stackless mailing list
Stackless at www.tismer.com

More information about the Stackless mailing list