0% found this document useful (0 votes)
6 views2 pages

MiniProject DS

Uploaded by

kisilusherry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

MiniProject DS

Uploaded by

kisilusherry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Title: Simulating Consensus in Faulty Networks – The Byzantine Generals Problem

Registration Number: P15/1915/2022

1. Introduction

This project demonstrates how distributed systems can handle faults and still reach an agreement,
inspired by the Byzantine Generals Problem. Using Python sockets, it simulates a network of
four processes—P, Q, R, and S—that must agree on a decision, even if one process behaves
unpredictably.

2. What It Uses

● Python Sockets: Enables communication between processes over TCP connections.


● JSON Message Format: Structures data for easy processing and interpretation.
● Majority Voting Algorithm: Ensures consensus by selecting the decision with the most
votes.
● Fault Simulation: Introduces a faulty process (P) to test the system’s ability to handle
errors.

3. How It Works

System Setup

● Processes: Four processes—P, Q, R, and S—communicate over unique ports.


● Faulty Process: Process P is designed to behave maliciously, sending mixed signals to
confuse the others.
● Communication: Messages are sent using TCP sockets, ensuring delivery and reliability.

Message Format

Messages are sent as JSON objects and include:

● Sender: Identifies who sent the message.


● Value: Suggests an action—either 'Attack' or 'Retreat'.

Simulating Faults

● Process P sends inconsistent messages (e.g., 'Attack' to one process and 'Retreat' to
another).
● Other processes stick to the rules and act correctly.

4. Steps in the Simulation

1. Each process creates a server socket to listen for incoming messages.


2. Messages are exchanged based on predefined rules.
3. Each process collects and analyzes the messages it receives.
4. The processes then vote based on the majority decision.
5. Each process displays the messages it received and the decision it made.

5. Observations

Even though Process P sends conflicting messages, the majority voting algorithm filters out the
noise. All other processes successfully agree on a decision—'Retreat'—demonstrating that the
system can handle faults and still maintain consensus.

You might also like