I'm porting some go code to D

Rory McGuire rjmcguire at gmail.com
Sat Aug 24 13:03:45 PDT 2013


On Sat, Aug 24, 2013 at 3:26 PM, bearophile <bearophileHUGS at lycos.com>wrote:

> David Nadlinger:
>
>
>  It's a cute idea, but not really practical, I'm afraid – Goroutines are
>> managed by a scheduler in the Go runtime library, whereas D threads
>> directly map to OS threads.
>>
>
> Can't Rory McGuire add a scheduler to his code? How much code does it take?
>
> Bye,
> bearophile
>

I imagine that it will be fine on Linux because threads truly are
lightweight on Linux, but its not going to be great on windows.

Go's scheduler is basically the same as the way vibe.d works. Fibers. I
haven't tried it but I could use fibers to do the same sort of thing,
though it would be easiest to use in Vibe.d because even in go you have to
do something that will wait/sleep in order to have your program advance
unless you set GOPROCS to  a value greater than 1. Go's scheduler is not
preemptive so there are the equivalent of Fiber.yield() spread throughout
the standard library, I think.

I'm not sure how threads + fibers would have to interact in such a system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20130824/5c16eca5/attachment.html>


More information about the Digitalmars-d-announce mailing list