Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
NotificationsYou must be signed in to change notification settings

sidthekidder/distributed-algorithms

Repository files navigation

Various algorithms involved in leader election.

Floodmax (leader_election.cpp)

Compile the program by executingg++ -std=c++11 -o output leader_election.cpp. Run the program and input the number of processes and adjacency matrix.

Input format is in the form of adjacency matrix -

  • First enter number of processes
  • Then enter n^2 numbers eg-
30 1 01 0 10 1 0

In case the program shuts down before completing or loops infinitely, the message queues must be manually deleted before re-running.

  1. executeipcs
  2. executeipcrm -q <queue_id> for each queue_id returned in the above command

Asynchronous GHS (async_ghs.cpp)

Compile the program by executingg++ async_ghs.cpp -pthread -std=c++11 && ./a.out. On running, the program will useasync_ghs_input.txt as input.

Input format is in the form of adjacency matrix -

  • First enter number of processes
  • Enter id for each process
  • Then enter n^2 numbers in the adjacency matrix, signifying the weight of each edge. eg-
710 20 30 40 50 60 70-1 5 4 -1 -1 -1 -1 5 -1 3 7 -1 -1 -14 3 -1 -1 5 2 10-1 7 -1 -1 8 -1 -1-1 -1 5 8 -1 -1 -1-1 -1 2 -1 -1 -1 3-1 -1 10 -1 -1 3 -1

LCR (index.html)

Open index.html in any webserver (likepython -m SimpleHTTPServer) to see the LCR visualization running. (Edit line 230 in index.html to set the number of nodes)

License

MIT

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp