chandy-lamport-algorithm-in-go

command module
v0.0.0-...-fb95114 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 4 Imported by: 0

README

Chandy-Lamport Algorithm in Go

This repository contains an implementation of the Chandy-Lamport distributed snapshot algorithm in Go. The Chandy-Lamport algorithm is used to capture a consistent global snapshot of a distributed system, even when processes are concurrently sending messages.

Usage

To run the program, simply compile the Go code and execute the resulting binary:

go build -o chandy-lamport
./chandy-lamport

The program will prompt you to enter the number of processes in the system. It will then simulate transactions between processes and take snapshots periodically. Finally, it will output the initial and final total amounts in the system, along with the snapshots taken by each process.

Implementation Details

1)The program creates a number of Process structs, each representing a process in the distributed system.
2)Each process maintains a set of accounts and a communication channel for receiving messages.
3)Processes randomly send messages to each other, simulating transactions.
4)The takeSnapshot function is called periodically to capture a snapshot of the system's state.
5)The snapshots are used to calculate the total amount of money in the system and ensure consistency.

Requirements

Go 1.13 or higher

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL