https://github.com/stepbrobd/srd
srd: (go) static race detector
https://github.com/stepbrobd/srd
Last synced: 12 months ago
JSON representation
srd: (go) static race detector
- Host: GitHub
- URL: https://github.com/stepbrobd/srd
- Owner: stepbrobd
- License: mit
- Created: 2023-01-30T20:44:15.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-10-20T22:41:44.000Z (over 2 years ago)
- Last Synced: 2025-06-18T03:37:27.594Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 279 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# SRD: (Go) Static Race Detector
A proof of concept work of extracting Structural Operational Semantics rules and applying it to do static race detection.
## Structural Operational Semantics Rules
$\textbf{Goroutine Creation}\ \frac{}{(G, M, C) \xrightarrow{\texttt{go f()}} (G \cup \{\texttt{f()}\}, M, C)}$
$\textbf{Memory Modification}\ \frac{\texttt{f()}\ \text{is}\ \texttt{data++}}{(G, M, C) \xrightarrow{\texttt{go f()}} (G - \{\texttt{f()}\}, M[\texttt{data} \rightarrow M(\texttt{data}) + 1], C)}$
$\textbf{Channel Send}\ \frac{\texttt{f()}\ \text{is}\ \texttt{done <- true}}{(G, M, C) \xrightarrow{\texttt{go f()}} (G - \{\texttt{f()}\}, M, C[\texttt{done} \rightarrow C(\texttt{done}) \cup \{\texttt{true}\}])}$
$\textbf{Channel Receive}\ \frac{\texttt{f()}\ \text{is}\ \texttt{<-done}}{(G, M, C) \xrightarrow{\texttt{go f()}} (G - \{\texttt{f()}\}, M, C[\texttt{done} \rightarrow C(\texttt{done}) - \{\texttt{true}\}])}$
$\textbf{Print}\ \frac{\texttt{f()}\ \text{is}\ \texttt{fmt.Println(data)}}{(G, M, C) \xrightarrow{\texttt{go f()}} (G \cup \{\texttt{f()}\}, M, C)}$
## Run
Using Nix:
```shell
nix run nixpkgs#go -- run -race cmd/srd/main.go -- examples/example_*.go
```
## Report
```shell
nix shell nixpkgs#texlive.combined.scheme-full -c pdflatex docs/main.tex
nix shell nixpkgs#texlive.combined.scheme-full -c bibtex main.aux
nix shell nixpkgs#texlive.combined.scheme-full -c pdflatex docs/main.tex
```
## License
This repository content excluding all submodules is licensed under the [MIT License](license.md), third-party code are subject to their original license.