Skip to content

Add rt-aware blocking semaphores in sys.rs, for use in exclusive ARCs #2795

Closed
@bblum

Description

@bblum

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions