Fibers

Don nospam at nospam.com.au
Wed Oct 22 02:47:14 PDT 2008


Bill Baxter wrote:
> On Wed, Oct 22, 2008 at 11:51 AM, dsimcha <dsimcha at yahoo.com> wrote:
>> I noticed that, in D 2.20, we now have an implementation of fibers for D2.  I
>> understand the basic differences between a fiber and a thread (preemptive vs.
>> cooperative multitasking, threads can take advantage of multicore, fibers
>> can't).  However, from a more practical point of view, I've become curious,
>> what are fibers actually good for?  What can be done with fibers that either
>> can't be done at all or can't be done as efficiently/elegantly/safely with
>> threads?

> One thing I think they enable is a less hacky opApply.

What we need now is for someone to do a fiber-based tree implementation.


OT: When I first read about fibers (in Microsoft docs) I found the 
terminology terribly confusing. Until I realized that "fiber" was the US 
spelling of "fibre", at which point the connection with threads became 
understandable. I still don't like the name, since OS threads aren't 
really made of "fibers". You're just switching stacks. One aspect of 
implementing threads is switching stacks. And that's the extent of the 
relationship, as far as I can tell.



More information about the Digitalmars-d mailing list