Skip to content

ganeshsankaran/nose-goes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

by Ganesh Sankaran


Nose Goes is a (dumb) leader election algorithm.

Algorithm

The n process in the distributed system must be known a priori.

The process that initiates leader election does the following:

timestamp = time()
msgs = {PID: timestamp}
broadcast(PID, timestamp)
broadcasted = True

All processes do the following:

while True:
    sender, timestamp = recv()
    msgs.update({sender: timestamp})
    
    if not broadcasted:
        timestamp = time()
        msgs.update({PID: timestamp})
        broadcast(PID, timestamp)
        broadcasted = True
        
    if len(msgs) == n:
        leader = max(msgs, key = msgs.get) # process corresponding to maximum timestamp
        break

Execution

Start the processes P1 through P5

python3 process.py [PID]

About

A (dumb) leader election algorithm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages