-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Add rt-aware blocking semaphores in sys.rs, for use in exclusive ARCs #2795
Copy link
Copy link
Closed
Labels
A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.Call for participation: Hard difficulty. Experience needed to fix: A lot.
Metadata
Metadata
Assignees
Labels
A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.Call for participation: Hard difficulty. Experience needed to fix: A lot.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Exclusive ARCs currently use pthread mutexes directly (through lock_and_signal). Blocking on one of these will take the entire sched_loop offline until the mutex can be grabbed.
However, the runtime scheduler knows when a thread blocks on a lock_and_signal's associated condition variable, and can schedule other useful work.
If we built a semaphore on top of lock_and_signal + condition, then the semaphore could be used for mutual exclusion in a way that would let the scheduler do other useful work while a thread is blocked on one. Then it would be less bad to do an O(n) operation inside of an exclusive.
The downside is that no longer would the exclusive be able to pass through a condition variable, such as is needed in newcomm.rs. newcomm.rs is going away, but might something else need it?