Lets talk about fibers

via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 5 10:45:16 PDT 2015


On Friday, 5 June 2015 at 15:06:04 UTC, Dmitry Olshansky wrote:
> You choose to ignore the point about duplicating the same 
> memory in each core's cache. To me it seems like throwing

Not sure what you mean by this. 3rd level cache is shared. 
Die-level cache is shared. Primary caches are small and are 
shared between pairs of hyper-threaded cores. If a task has been 
suspended for 100ms you can just assume that primary cache is 
cold.

> Adaptive load-balancing is quite possible with fibers sticking 
> to a thread and is a question of application design.

Then you should not have fibers at all since an event based 
solution is even faster (but more work). Coroutines is a 
convenience feature, not a performance feature. You need control 
over workload scheduling to optimize to prevent 3rd level cache 
pollution. Random  fine grained scheduling is not good for memory 
intensive workloads because you push out data from the caches 
prematurely.

> I bet it still helps some workloads and hurts others without 
> "me" scheduling anything.

Hyperthreading requires two cores to run specific workloads at 
the same time. If not you are better off just halting that extra 
core. The idea with hyperthreading is that one thread fills in 
holes in the pipeline when the other thread is stalled.

> Not sure if this is English,

When people pick on typos the debate is essentially over...

EOD


More information about the Digitalmars-d mailing list