Fiber is better than go's goroutine?

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


On Monday, 27 October 2014 at 22:59:50 UTC, Brad Anderson wrote:
>
> Again, just out of curiosity, have you ever looked at Windows 
> user-mode scheduling or Google's user-level threads[1][2] 
> (under 200ns context-switch times)? I first heard of them from 
> a post on the Rust forum[3] which suggested M:N may be a dead 
> end. I believe Rust decided to try to make sure either 1:1 or 
> M:N could be used but I don't actively follow Rust's 
> development so I may be mistaken.

No, but I will.  The round robin scheduling is turning out to be 
considerably better than using all kernel threads in some cases 
and far far worse in others.  Really, any case where you have a 
large percentage of "threads" waiting to be notified, round robin 
wastes a lot of time.  Fixing this means treating "just yield" 
threads, "wait forever until notified" threads, and "wait N 
seconds unless notified" threads all differently in terms of the 
CPU time devoted to checking their state.  Something like 
libevent would help here, but I'll see what I can do.  I suspect 
WaitForMultipleObjects or the like will be needed on Windows, 
etc.  Thanks for the references.


More information about the Digitalmars-d mailing list