Skip to content

Semaphore as one state object: capacity and slot set behind a single CAS #20

Description

@flyingrobots

From the 0.2.1 review. Alternative to meta + gen + slots/: refs/locks/sem/<name>/state pointing at one immutable record holding the capacity and the complete slot set. Read one object, compute the next state, CAS one ref. The state used to count capacity is then exactly the state whose replacement is conditional, with no coherence to establish between separately observed refs. Cost: a larger object rewritten per operation and full serialisation within one semaphore. Benchmark against the current design before choosing; the smallest authority domain that makes the invariant straightforward wins, not the fewest refs.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ideaCool idea: worth discussing before building

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions