Make work stealing from other schedulers optional#41
Make work stealing from other schedulers optional#41D4ryus wants to merge 1 commit intowingo:masterfrom
Conversation
When working with multiple fibers and ports, disabling work-stealing makes it easier to ensure only one thread is accessing a given port. E.g. this allows a fiber to spawn additional fibers to access a port without running into issues.
|
What issues would these be? Is this for performance only (cache locality etc.), or any bugs? |
|
Ran into bugs when multiple threads accessed the same port, but i don't remember the details, sorry. |
How about implementing CPU pinning (https://en.wikipedia.org/wiki/Processor_affinity) instead (the strict version, not the ‘can also move to other CPU/core/whatever)? It avoids the implementation detail that is work-stealing, is more general (you could assign multiple fibers to the same (or different) CPU/core/..., whereas with this implementation you need to be lucky that multiple fibers have the same/different CPU/core/...) and is known (outside Fibers) to occasionally be useful ... Basically the same thing as the current implementation, except that ‘work-stealing?’ becomes a per-fibers flag, ‘spawn-fiber’ gains an extra option indicating it should be strict about the scheduler choice and run-fibers gains an option to bind the schedulers to specific CPUs/cores/whatever. |
When working with multiple fibers and ports, disabling work-stealing
makes it easier to ensure only one thread is accessing a given port.
E.g. this allows a fiber to spawn additional fibers to access a port
without running into issues.