Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dist101 – Distributed Process Migration Simulator

Dist101 is a lightweight Go-based simulator that demonstrates how process migration works in a distributed system — i.e., moving a running process from one node to another without restarting it.

The simulator is built to help understand the internal logic of process migration, particularly focusing on the Pre-Copy migration algorithm, which is commonly used in real systems like VMware vMotion, CRIU and Xen.

Sample Output

sampleoutput

Features

  1. Simulates multiple nodes in a distributed system

  2. Models processes with CPU registers and memory

  3. Implements Pre-Copy Process Migration step-by-step

  4. Logs all migration stages clearly (initiation, copying, suspension, resumption)

  5. Easy to extend with load balancing, network delay, and metrics

Algorithm Used: Pre-Copy Migration

Dsit101 uses the Pre-Copy Migration Algorithm, a pre-emptive migration method where process memory is transferred in iterations while the process is still running.

Algorithm Steps

  1. Initiation A migration request is made (for example, Node A is overloaded and Node B is free).

  2. Pre-Copy Phase (Memory Copy) The process continues running while its memory pages are copied from the source node (Node A) to the destination node (Node B). Only pages that change during copying (called dirty pages) are recopied.

  3. Stop-and-Copy Phase When few dirty pages remain, the process on Node A is paused. CPU registers and the final memory state are then transferred.

  4. Resumption Phase The process is reconstructed on Node B using the transferred state and resumes execution from the exact point it stopped.

Advantages of Pre-Copy

  1. Minimal downtime (the process continues running while memory transfers)

  2. Maintains consistent state across nodes

  3. Commonly used in real-world hypervisors and distributed systems

Project Structure

    ├── main.go         # Entry point, runs the simulation
    Dist101/
    ├── node.go         # Node structure (represents a host in the system)
    ├── process.go      # Simulated process (CPU, memory, registers)
    ├── migration.go    # Pre-copy migration logic
    ├── utils.go        # Helper functions (optional extensions)
    └── go.mod          # Go module definition

How to Run

  1. Clone or Create the Project
    git clone https://github.com/jomboi8/dist101.git
    cd Dist101
  1. Initialize and Tidy Dependencies
    go mod init dist101
    go mod tidy

3.Run the simulator

    go run .

Author

Leonard Jombo

Topic

Distributed Systems - Process Migration in Distributed systems

License

This project is open-source under the MIT License.

About

Process Migration Simulation in Distributed systems

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages