Asynchronicity in D
Sean Kelly
sean at invisibleduck.org
Thu Mar 31 15:03:13 PDT 2011
On Mar 31, 2011, at 11:48 AM, dsimcha wrote:
> == Quote from Andrej Mitrovic (andrej.mitrovich at gmail.com)'s article
>> Are fibers really better/faster than threads? I've heard rumors that
>> they perform exactly the same, and that there's no benefit of using
>> fibers over threads. Is that true?
>
> Here are some key differences between fibers (as currently implemented in
> core.thread; I have no idea how this applies to the general case in other
> languages) and threads:
>
> 1. Fibers can't be used to implement parallelism. If you have N > 1 fibers
> running on one hardware thread, your code will only use a single core.
It bears mentioning that this has interesting implications for the default thread-local storage of statics. All fibers running on a thread will currently share the thread's static data. This could be worked around by doing TLS manually at the fiber level, but it's a non-trivial change.
More information about the Digitalmars-d
mailing list