Git Product home page Git Product logo

yashuv / distributed-system Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.31 MB

some insights and program code for Election Algorithm(Bully and Ring), RPC and RMI, Clock Synchronization(Logical and Vector) and Banker's Deadlock Avoidance Algorithm

Java 6.38% Python 40.61% C++ 53.01%
bankers-algorithm bully-algorithm clock-synchronization deadlock-avoidance distributed-systems lamport-clock leader-election-algorithm ring-algorithm vector-clock

distributed-system's Introduction

Distributed-System

I tried to give some insights and provide the simulated code for the Election Algorithm (Bully and Ring), RPC and RMI, Clock Synchronization using Lamport logical timestamp and Vector timestamp, and Banker's Deadlock Avoidance Algorithm.

------------------------------------- Clock Synchronization In Distributed System ----------------------------------------------
🔶 Using Lamport’s Algorithm

image

Program Output:
image

🔶 Using Vector Timestamp

image

Program Output:
image
More here
---------------------------------------- Leader Election in Distributed System --------------------------------------------------
The main purpose of the leader election is to choose a node as a coordinator. It will act as a leader and coordinate activities of the whole system.The election algorithm assumes that every active process in the system has a unique priority number. A leader in any leader election algorithm is usually chosen based on the node which has the largest identifier. Hence, when a coordinator fails, this algorithm elects the active process that has the highest priority number. Then this number is sent to every active process in the distributed system.

🔶 Bully Algorithm

In a distributed system, when the leader is crashed, other nodes must elect another leader. The election algorithm we consider here is called the bully algorithm because the node with the highest ID forces the nodes with smaller ID into accepting it as a coordinator.
Simulated Program Output
image

Analysis:
Initially, among the five processes, process with ID:5 is the one with the highest ID, so it is selected as a leader. After that, the process with ID:5 crashes and since process with ID:4 is dead, process with ID:3 is selected as leader. After some time, the process with ID:4 activates and calls for election. Since, process with ID:5 is dead, the process with ID:4 is selected as leader.

🔶 Ring Algorithm

This algorithm applies to systems organized as a ring (logically or physically). In this algorithm, we assume that the links between the processes are unidirectional and that every process can message the process on its right only.

Simulated Program Output
444

More here
------------------------------------------------------------------------------------------------------------------------------
🔶 Bankers Algorithm

A new deadlock avoidance algorithm, derived from Dijkstra’s Bankers Algorithm, is introduced for avoiding deadlock and allocate resources safely to each process in a distributed SOA. The algorithm works by observing the current state of the resources in the system along with a worst case estimate of future resource requirements and permitting the execution of only those call trees that will keep the system in a safe state.

More here
------------------------------------------------------------------------------------------------------------------------------
Thank You.. HappY Learning!

distributed-system's People

Contributors

yashuv avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.