Skip to content

Implementation of HS Algorithm in the field of Distributed Algorithms

License

Notifications You must be signed in to change notification settings

lsmgeb89/hs_leader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HS Leader

Summary

Project Information

Full Requirements

Part One: Simulator

  • You will develop a simple simulator that simulates a synchronous distributed system using multithreading.
  • There are n + 1 processes in this synchronous distributed system: one master process and n slave processes. Each process will be simulated by one thread.
  • The master thread will "inform" all slave threads when one round starts.
  • Each slave threads must wait for the master thread for a "go ahead" signal before it can begin round r.
  • The master thread can give the signal to start round r only if it is sure that all the n slave threads have completed their previous round r - 1.

Part Two: HS Algorithm

  • Your simulation will simulate HS algorithm for leader election in synchronous ring networks.
  • The code to implement HS algorithm executed by all slave threads must be the same.
  • The input for this algorithm consists of two parts:
    1. n: the number of processes in this synchronous ring network
    2. array id of length n: id[i] is the unique id of the ith process
  • The master thread reads these two inputs and then spawns n threads.
  • All links in the ring network are bidirectional:
    1. There is one undirected link between processes j - 1 (mod n) and j.
    2. There is one undirected link between processes j and j + 1 (mod n).
  • No process knows the value of n.
  • All processes must terminate after finding the leader's id.