Skip to content

Add C# lock-free shared-memory store profile (v2.0.0) - #6

Merged
rantri merged 27 commits into
mainfrom
codex/lock-free-csharp
Jul 16, 2026
Merged

Add C# lock-free shared-memory store profile (v2.0.0)#6
rantri merged 27 commits into
mainfrom
codex/lock-free-csharp

Conversation

@rantri

@rantri rantri commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • add an explicitly selected C# lock-free shared-memory key-value profile using mapped 64-bit atomics
  • add layout 2.0/resource protocol 2 with generation-fenced directory, slot, lease, participant, recovery, removal, and reuse state
  • support zero-copy publication through reserve/write/advance/commit and shared zero-copy read leases
  • preserve the existing MemoryStore facade, Legacy default profile, layout 1.2 behavior, status numbers, and bounded cold-lifecycle OS coordination
  • add the broker-key sample, protocol documentation, diagnostics, linearizability coverage, crash/recovery testing, benchmarks, and qualification tooling
  • advance the managed NuGet package to 2.0.0; native CMake and Python remain independently versioned 0.1.0 and deliberately reject layout 2.0

Why

The Legacy profile acquires a named cross-process semaphore on each store operation. Under multi-process load this serializes otherwise independent operations and makes one delayed process affect all peers. The new profile removes OS synchronization from steady-state publish, acquire, release, remove, and maintenance paths while keeping SharedMemoryStore a bounded general-purpose key-value store. Broker scheduling and load balancing remain outside the library.

Compatibility and rollout

  • Lock-free mode is opt-in through SharedMemoryStoreOptions.CreateLockFree(...).
  • Legacy remains the default.
  • Layout 1.2 and 2.0 mappings are distinct; upgrade or rollback requires drain, close, recreate, and application-owned republish.
  • C++ and Python remain layout-1.2-only in this release.

Validation

  • post-merge Release suite: 1,028/1,028 passed, zero skipped
    • Contract 117
    • Linearizability 83
    • Interop 75
    • Unit 451
    • Integration 302
  • PR qualification: 24/24 gates passed
  • nightly qualification: 24/24 gates passed, including 8,000,000 production races, 10,000,000 churn cycles, and 10,000 crash/recovery cases
  • Linux x64 validation: all 28 required gates passed
  • independent code/spec/evidence reviews: H0/M0/L0
  • documentation validation passed
  • packed SharedMemoryStore.2.0.0.nupkg and symbol package successfully

Linux x64 eight-process results on the frozen source tree:

  • acquire/release: 22.33M lock-free calls/s versus 0.252M Legacy (88.6x)
  • publish/remove: 6.67M versus 0.954M (6.99x)
  • lock-free p99: 1.4 us acquire/release and 4.5 us publish/remove

Qualification caveat

The deliberately exhaustive terminal release tier was stopped because its repeated multi-hour matrix was not suitable as a blocking developer gate. It did not produce a final release summary, so this PR does not claim formal exhaustive-release qualification. The completed PR, nightly, Linux, full-suite, package, and review evidence supports implementation review and a controlled C# x64 rollout; repository CI should still run on this PR.

@rantri
rantri marked this pull request as ready for review July 16, 2026 11:46
@rantri
rantri merged commit cbd7ad4 into main Jul 16, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant