| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
An experimental interpreter and model checker for exploring concurrent programs with Git-inspired memory semantics. Gitmem allows you to write multi-threaded programs and automatically explore all possible interleavings to detect data races, deadlocks, and assertion failures.
Gitmem is a research tool that models concurrent memory operations using version control semantics. It provides:
The gitmem language supports:
x = 0;
$t1 = spawn {
lock l;
x = x + 1;
unlock l;
};
$t2 = spawn {
lock l;
x = x + 1;
unlock l;
};
join $t1;
join $t2;
assert(x == 2);
mkdir build
cd build
cmake -G Ninja .. -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug
ninjaOptional CMake flags:
Test your build with:
./gitmem -e ../examples/race_condition.gmRun a single execution trace:
./gitmem examples/race_condition.gmThis generates a GraphViz .dot file showing the execution trace.
Explore all possible execution paths:
./gitmem -e examples/race_condition.gmModel checking will:
Step through executions manually:
./gitmem -i examples/race_condition.gmCommands in interactive mode:
Gitmem supports different memory models:
./gitmem --sync linear program.gmMulti-version concurrency control like consistency model. Threads operate in isolation and synchronisation pulls from and pushes to a global shared version history. Each variable is versioned throughout its history.
./gitmem --sync branching --branching-mode eager program.gmGit-like branching semantics where threads create branches that merge at synchronization points. Conflicts are detected eagerly.
./gitmem --sync branching --branching-mode lazy program.gmLazy conflict detection variant that defers checking until variables are read.
Additional flags:
Run the test suite:
# From build directory
ninja run_gitmem_tests
# Or using CTest
ctestThe test suite includes:
src/
├── gitmem.cc - Main entry point and CLI
├── lang.hh - Language/token definitions (+ entry_block helper)
├── parser.cc - Parser implementation
├── interpreter.cc - Interpreter core
├── model_checker.cc - Model checking engine
├── debugger.cc - Interactive debugger
├── execution_state.hh - Runtime state (threads, locks, model state)
├── memory_model.hh - Memory model interface
├── linear/
│ ├── memory_model.hh/.cc - Linear memory model
│ └── version_store.hh/.cc
└── branching/
├── base_memory_model.hh/.cc
├── base_version_store.hh/.cc
├── eager/memory_model.hh - Eager branching model
└── lazy/memory_model.hh - Lazy branching model
examples/
├── accept/ - Passing test inputs
└── reject/ - Failing test inputs
The build produces two binaries:
The main interpreter and model checker. Executes programs and generates execution diagrams.
Parser diagnostic tool built on Trieste. Use it to inspect the AST:
./gitmem_trieste build program.gm
# Creates program.trieste with S-expression ASTA syntax highlighting extension is available in gitmem-extension/.
Install via:
This provides syntax highlighting for .gm files.
Gitmem generates GraphViz .dot files visualizing:
View .dot files with GraphViz:
dot -Tpng output.dot -o output.png| Back | FazBrowse Home | New Git URL |