How multithreading works in hardware using D ==AND== difference b/w goroutine and threads in D

Sean Kelly sean at invisibleduck.org
Tue Nov 27 13:37:27 PST 2012


On Nov 25, 2012, at 11:54 AM, Sparsh Mittal <sparsh0mittal at gmail.com> wrote:

>> 
>> In D's case, it depends. If you are making use of threading APIs directly then you have 1:1 mapping to OS threads, but if you use actors
>> or std.parallelism module, then you have a N:1 mapping between tasks and OS threads.
> Thanks a lot for your prompt reply.
> 
> I am using: std.concurrency and core.thread. Then, I spawn threads as:
> spawn(&singleWorker, thisTid);
> 
> So, would you tell which category (from what you told) my code falls into.

Today, std.concurrency is backed exclusively by kernel threads.  At some point in the future it's possible that will change.  The trick there is properly handling global statics, as those are thread-local, not fiber-local.


More information about the Digitalmars-d mailing list