Processes and Channels, cf. goroutines.

Sean Kelly sean at invisibleduck.org
Thu Feb 13 07:40:04 PST 2014


On Thursday, 13 February 2014 at 15:30:58 UTC, Bienlein wrote:
> On Thursday, 6 February 2014 at 19:24:39 UTC, Sean Kelly wrote:
>> On Wednesday, 5 February 2014 at 20:37:44 UTC, Sean Kelly 
>> wrote:
>>>
>> https://github.com/D-Programming-Language/phobos/pull/1910
>
> Hello,
>
> I have a little question about how pre-emption works with the 
> FiberScheduler. Let's say I create 100.000 fibers that all run 
> long-runners (such as calculating fibonacci(100)). Now I start 
> another fiber that just prints "hello world" to the console. So 
> it's a short runner. When can I expect "hello world" to appear 
> on the console?

The API is able to context switch inside send and receive. So if 
you aren't sending messages with some frequency then the level of 
parallel execution will be fairly low.  For apps like this, it's 
possible that a more complex scheduler that is backed by a thread 
pool would be more appropriate.  Since D isn't built from the 
ground up around fibers, choosing the right scheduler for your 
application is an important decision.


More information about the Digitalmars-d mailing list