Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Conversation

@D4ryus
Copy link
Contributor

@D4ryus D4ryus commented Jul 11, 2020

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.

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.
@emixa-d
Copy link
Collaborator

emixa-d commented Sep 4, 2023

What issues would these be? Is this for performance only (cache locality etc.), or any bugs?

@emixa-d emixa-d added enhancement question needs-changes This PR isn't quite right yet. labels Sep 4, 2023
@D4ryus
Copy link
Contributor Author

D4ryus commented Sep 4, 2023

Ran into bugs when multiple threads accessed the same port, but i don't remember the details, sorry.
Guile ports changed a lot since this PR was opened, it might be obsolete by now.
Feel free to close it if there is no interest in making work stealing optional.

@emixa-d
Copy link
Collaborator

emixa-d commented Sep 18, 2023

When working with multiple fibers and ports, disabling work-stealing makes it easier to ensure only one thread is accessing a given port.
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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement needs-changes This PR isn't quite right yet. question

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants