Fiber is better than go's goroutine?

Sean Kelly via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 28 07:24:28 PDT 2014


On Tuesday, 28 October 2014 at 08:02:23 UTC, Martin Nowak wrote:
> On Monday, 27 October 2014 at 21:43:47 UTC, Sean Kelly wrote:
>> Yep.  Every logical thread is a Fiber executed in a 
>> round-robin manner by a pool of kernel threads.  Pooled 
>> threads are spun up on demand (to a set upper limit) and 
>> terminate when there are no fibers waiting to execute.  It 
>> should make for a good "millions of threads" baseline 
>> scheduler.
>
> Will you reuse std.parallel's task scheduler for that?
> I always thought that the std.parallel and Fibers should work 
> together but it wasn't easily possible to adapt Fibers to Tasks.

This wasn't really a natural fit for std.parallelism.  There are 
very few lines of code dedicated to thread management though 
anyway.  The code as-is isn't much bigger than FiberScheduler.  
The complicated bit will be making scheduling efficient, which 
I've decided has to happen for MultiScheduler to be actually 
worth using.  It isn't as much of a proof of concept like 
FiberScheduler.


More information about the Digitalmars-d mailing list