This project introduces an distributed algorithm for reaching approximate agreement between two processes using an optimal size of shared memory on each communication round.
This implementation is based on the optimal bounded IIS two-process approximate agreement algorithm described in the paper by G. Toyos-Marfurt and P. Kuznetsov, “On the Bit Complexity of Iterated Memory”, available here.
We use uint8 as it is the smalles primitive atomic type in go.
We use single-writer multiple-reader (SWMR) shared variables, assuming that uint8 operations are atomic. Specifically, when a uint8 variable is written by one process and read simultaneously, the behavior is deterministic: the reader observes either the previous value or the newly written value.
Note that uint8 is atomic in any CPU that handles words bigger than 8 bits (current CPUs typically work with 64 bit words).
For demonstration purposes, we provide parallel implementations of the algorithm:
- Go: Using native multithreading with goroutines and channels.
- Rust: Leveraging the Tokio asynchronous runtime library.
Code implementations are available in the /go and /rust directories respectively.
For calculating the agreement, we map the possible values on the protocol complex as follows:
A point
For generic inputs
Therefore, the difference between consecutive points is:
To achieve a target agreement precision