May 31, 2007

David B. Held wrote:
> ...
> Fibers are nice when you don't need pre-emption, but having to think
> about pre-emption makes the parallelism intrude on your problem-solving,
> which is what we would like to avoid.
> 
> Dave

Have you seen Stackless Python?  That uses cooperative multithreading, but I've never had to write an explicit yield.

The way that works is that you do all communication, and all blocking actions via channels.  The channels transfer control of the CPU as well as data, meaning that you don't really need to think about what's going on behind the scenes.  It all just kinda works.

One of these days, I'll get around to doing stackless in D...

	-- Daniel

-- 
int getRandomNumber()
{
    return 4; // chosen by fair dice roll.
              // guaranteed to be random.
}

http://xkcd.com/

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/
May 31, 2007
Daniel Keep wrote:
> 
> David B. Held wrote:
>> ...
>> Fibers are nice when you don't need pre-emption, but having to think
>> about pre-emption makes the parallelism intrude on your problem-solving,
>> which is what we would like to avoid.
> 
> Have you seen Stackless Python?  That uses cooperative multithreading,
> but I've never had to write an explicit yield.
> [...]

Well, cooperative multithreading is different from fibers, because fibers are actually coroutines, so yield is almost always explicit.  And yes, I think we need all the parallel libraries we can get, so knock yourself out. ;)

Dave
Next ›   Last »
1 2 3 4 5
Top | Discussion index | About this forum | D home