Skip to content

About

Bounded MPMC queue with a Lean 4 SC kernel-event core and generated C.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

mpmc-lean

A bounded MPMC queue and a named shared-memory channel for C11, C++17, Rust, and C# 15 / .NET 11.

Queue Bounded FIFO of 64-bit values. Any thread may push or pop; calls never block.
Channel Same-machine, multi-process FIFO of fixed-size byte slots. Zero-copy receive; optional zero-copy send.
Build Bazel. Cargo and the .NET SDK only package the published artifacts.
Proof Lean checks the sequentially-consistent kernel core; CBMC checks selected C functions. This is not an end-to-end proof.

Quick start

#include "mpmc.h"

int main(void) {
  mpmc_queue *q = mpmc_create(1024);
  if (q == NULL) return 1;

  mpmc_push(q, 42);
  uint64_t value;
  if (mpmc_pop(q, &value) && value == 42) {
    mpmc_destroy(q);
    return 0;
  }

  mpmc_destroy(q);
  return 1;
}

Build the snippet with the flags in Getting started. Verify the repository:

bazel test -c opt //...

For the channel, the other bindings, and install steps, start with Getting started.

Platforms

Linux x86-64, Linux arm64 (Clang), and macOS arm64. Windows and 32-bit targets are not supported. See Portability for compiler, atomic, and package details.

Documentation

Verification

The Lean development proves FIFO and linearizability for the sequentially-consistent kernel-event core. CBMC checks selected production C functions over their full input domains, plus bounded initializer and kernel checks. The printer, compiler and 16-byte atomic lowering, POSIX lifecycle, weak-memory refinement, the Rust FFI layer, the C# state machine, and progress are trusted or tested, not proved.

See the verification boundary for the exact claims.

License

CPAL-1.0. See LICENSE and NOTICE.

About

Bounded MPMC queue with a Lean 4 SC kernel-event core and generated C.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages