0% found this document useful (0 votes)
7 views

DC Lab - Group 13

The document contains multiple experiments demonstrating inter-process communication, group communication, clock synchronization, and the Bully election algorithm using Java. Each experiment includes the aim, theory, code for both server and client, and sample outputs. The programs illustrate concepts such as client-server communication, group chat functionality, time synchronization, and process election in distributed systems.

Uploaded by

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

DC Lab - Group 13

The document contains multiple experiments demonstrating inter-process communication, group communication, clock synchronization, and the Bully election algorithm using Java. Each experiment includes the aim, theory, code for both server and client, and sample outputs. The programs illustrate concepts such as client-server communication, group chat functionality, time synchronization, and process election in distributed systems.

Uploaded by

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

Experiment - 01

Aim: Write a program to implement inter process communication.


Theory:
Code:
Server:
import java.io.*;
import java.net.*;

public class Server {


public static void main(String[] args) {
try {
// Create a server socket listening on port 12345
ServerSocket serverSocket = new ServerSocket(12345);
System.out.println("Server is running...");

// Wait for client connection


Socket clientSocket = serverSocket.accept();
System.out.println("Client connected.");

// Create input and output streams for communication


BufferedReader in = new BufferedReader(new
InputStreamReader(clientSocket.getInputStream()));
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(),
true);

// Input stream reader for reading server terminal input


BufferedReader serverInput = new BufferedReader(new
InputStreamReader(System.in));

// Start a separate thread for reading server terminal input and


sending to client
new Thread(() -> {
try {
String serverMessage;
while ((serverMessage = serverInput.readLine()) != null) {
out.println("Server: " + serverMessage);
}
} catch (IOException e) {
e.printStackTrace();
}
}).start();

// Continuously read messages from client and echo them back


String message;
while ((message = in.readLine()) != null) {
System.out.println("process 2: " + message);
}

// Close streams and sockets


in.close();
out.close();
clientSocket.close();
serverSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

Client:
import java.io.*;
import java.net.*;
public class Client {
public static void main(String[] args) {
try {
// Connect to the server running on localhost, port 12345
Socket socket = new Socket("localhost", 12345);
System.out.println("Connected to server.");

// Create input and output streams for communication


BufferedReader in = new BufferedReader(new
InputStreamReader(socket.getInputStream()));
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);

// Send messages to server and receive echoes


BufferedReader userInput = new BufferedReader(new
InputStreamReader(System.in));
String message;
while (true) {
System.out.print("Enter message to send to server (or type
'exit' to quit): ");
message = userInput.readLine();
if ("exit".equalsIgnoreCase(message)) {
break;
}
out.println(message);
System.out.println("process 1: " + in.readLine());
}

// Close streams and socket


in.close();
out.close();
userInput.close();
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

Output:
Server
"C:\Program Files\Java\jdk-19\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ
IDEA Community Edition 2022.3.3\lib\idea_rt.jar=52854:C:\Program Files\JetBrains\IntelliJ
IDEA Community Edition 2022.3.3\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8
-Dsun.stderr.encoding=UTF-8 -classpath C:\Users\rohra\IdeaProjects\DC\out\production\DC
Expt1Server
Server is running...
Client connected.
process 2: hi
hello
process 2: how are you
im fine

Process finished with exit code 130

Client
"C:\Program Files\Java\jdk-19\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ
IDEA Community Edition 2022.3.3\lib\idea_rt.jar=52857:C:\Program Files\JetBrains\IntelliJ
IDEA Community Edition 2022.3.3\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8
-Dsun.stderr.encoding=UTF-8 -classpath C:\Users\rohra\IdeaProjects\DC\out\production\DC
Expt1Cleint
Connected to server.
Enter message to send to server (or type 'exit' to quit): hi
process 1: Server: hello
Enter message to send to server (or type 'exit' to quit): how are you
process 1: Server: im fine
Enter message to send to server (or type 'exit' to quit):

Process finished with exit code 130


Experiment - 02

Aim: Write a program to implement Group communication.


Theory:
Code:
Server:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;

public class GroupChatServer {


private static Set<PrintWriter> writers = new CopyOnWriteArraySet<>();
private static Set<String> connectedClients = new HashSet<>();

public static void main(String[] args) throws IOException {


ServerSocket serverSocket = new ServerSocket(5000);
System.out.println("Group Chat Server is running...");

// Start a thread to accept messages from the server console


Thread serverMessageThread = new Thread(new ServerMessageHandler());
serverMessageThread.start();

try {
while (true) {
Socket clientSocket = serverSocket.accept();
System.out.println("New client connected: " + clientSocket);
Scanner clientScanner = new
Scanner(clientSocket.getInputStream());
String clientName = clientScanner.nextLine();
synchronized (writers) {
writers.add(new
PrintWriter(clientSocket.getOutputStream(), true));
connectedClients.add(clientName);
}
broadcastFromServer(clientName + " has joined the chat.");
broadcastFromServer("new member has joined !!");
Thread clientHandler = new Thread(new
ClientHandler(clientSocket, clientName));
clientHandler.start();
}
} finally {
serverSocket.close();
}
}

private static class ClientHandler implements Runnable {


private Socket clientSocket;
private String clientName;

public ClientHandler(Socket clientSocket, String clientName) {


this.clientSocket = clientSocket;
this.clientName = clientName;
}

@Override
public void run() {
try {
Scanner scanner = new Scanner(clientSocket.getInputStream());
while (scanner.hasNextLine()) {
String message = scanner.nextLine();
if (message.equals("exit")) {
break;
} else if (message.startsWith("/whisper")) {
handleWhisper(message);
} else {
broadcast(clientName + ": " + message);
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
clientSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
synchronized (writers) {
writers.removeIf(writer -> writer.equals(clientSocket));
connectedClients.remove(clientName);
}
broadcastFromServer(clientName + " has left the chat.");
}
}

private void broadcast(String message) {


synchronized (writers) {
for (PrintWriter writer : writers) {
writer.println(message);
}
}
}

private void handleWhisper(String message) {


String[] parts = message.split(" ", 3);
if (parts.length == 3) {
String recipient = parts[1].trim();
String whisperMessage = parts[2].trim();
synchronized (writers) {
if (connectedClients.contains(recipient)) {
for (PrintWriter writer : writers) {
if (writer.toString().equals(recipient)) {
writer.println("(whisper from " + clientName +
"): " + whisperMessage);
break;
}
}
} else {
writers.stream()
.filter(writer ->
writer.toString().equals(clientName))
.findFirst()
.ifPresent(writer -> writer.println("Recipient
'" + recipient + "' is not connected."));
}
}
} else {
writers.stream()
.filter(writer ->
writer.toString().equals(clientName))
.findFirst()
.ifPresent(writer -> writer.println("Invalid whisper
command. Usage: /whisper recipient message"));
}
}
}

private static class ServerMessageHandler implements Runnable {


@Override
public void run() {
try {
BufferedReader consoleReader = new BufferedReader(new
InputStreamReader(System.in));
while (true) {
String serverMessage = consoleReader.readLine();
broadcastFromServer("[host]: " + serverMessage);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

public static void broadcastFromServer(String message) {


synchronized (writers) {
for (PrintWriter writer : writers) {
writer.println(message);
}
}
}
}

Client:
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;
public class GroupChatClient {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter your name: ");
String clientName = scanner.nextLine();
Socket socket = new Socket("localhost", 5000);
try {
PrintWriter writer = new PrintWriter(socket.getOutputStream(),
true);
writer.println(clientName);
Thread readerThread = new Thread(new ClientReader(socket));
readerThread.start();
while (true) {
String message = scanner.nextLine();
writer.println(message);
if (message.equals("exit")) {
break;
}
}
} finally {
socket.close();
}
}
private static class ClientReader implements Runnable {
private Socket socket;
public ClientReader(Socket socket) {
this.socket = socket;
}
@Override
public void run() {
try {
Scanner scanner = new Scanner(socket.getInputStream());
while (scanner.hasNextLine()) {
String message = scanner.nextLine();
System.out.println(message);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
System.out.println("Disconnected from the server.");
}
}
}
}

Client:
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;
public class GroupChatClient {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter your name: ");
String clientName = scanner.nextLine();
Socket socket = new Socket("localhost", 5000);
try {
PrintWriter writer = new PrintWriter(socket.getOutputStream(),
true);
writer.println(clientName);
Thread readerThread = new Thread(new ClientReader(socket));
readerThread.start();
while (true) {
String message = scanner.nextLine();
writer.println(message);
if (message.equals("exit")) {
break;
}
}
} finally {
socket.close();
}
}
private static class ClientReader implements Runnable {
private Socket socket;
public ClientReader(Socket socket) {
this.socket = socket;
}
@Override
public void run() {
try {
Scanner scanner = new Scanner(socket.getInputStream());
while (scanner.hasNextLine()) {
String message = scanner.nextLine();
System.out.println(message);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
System.out.println("Disconnected from the server.");
}
}
}
}

Output:

Server
"C:\Program Files\Java\jdk-19\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ
IDEA Community Edition 2022.3.3\lib\idea_rt.jar=52943:C:\Program Files\JetBrains\IntelliJ
IDEA Community Edition 2022.3.3\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8
-Dsun.stderr.encoding=UTF-8 -classpath C:\Users\rohra\IdeaProjects\DC\out\production\DC
expt2server
Group Chat Server is running...
New client connected: Socket[addr=/127.0.0.1,port=52951,localport=5000]
New client connected: Socket[addr=/127.0.0.1,port=49758,localport=5000]

Client
"C:\Program Files\Java\jdk-19\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ
IDEA Community Edition 2022.3.3\lib\idea_rt.jar=52946:C:\Program Files\JetBrains\IntelliJ
IDEA Community Edition 2022.3.3\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8
-Dsun.stderr.encoding=UTF-8 -classpath C:\Users\rohra\IdeaProjects\DC\out\production\DC
expt2client
Enter your name: group 13
group 13 has joined the chat.
new member has joined !!
hello
group 13: hello
new group has joined the chat.
new member has joined !!
new group: hello from here

Experiment - 03

Aim: Write a program to simulate clock synchronization


Theory:
Code:
package soc.revision.berkeley_algo;
import java.util.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class berkeley {
public static void berkeleyAlgo(String servertime, String
time1, String time2) {
System.out.println("Server Clock = " + servertime);
System.out.println("Client Clock 1 = " + time1);
System.out.println("Client Clock 2 = " + time2);
SimpleDateFormat sdf = new SimpleDateFormat("mm:ss");
try {
/* Converting time to Milliseconds */
long s = sdf.parse(servertime).getTime();
long t1 = sdf.parse(time1).getTime();
long t2 = sdf.parse(time2).getTime();
/* Calcuating time differences w.r.t server */
long st1 = t1 - s;
System.out.println("t1 - s = "+st1/1000);
long st2 = t2 - s;
System.out.println("t2 - s = "+st2/1000);
/* Fault tolerant Average */
long aveg = (st1 + st2 + 0) / 3;
System.out.println("(st1 + st2 + 0)/3 = "+aveg/1000);
/* Adjustment */
long adjserver = aveg+s;
long adj_t1 = aveg-st1;
long adj_t2 = aveg-st2;
System.out.println("t1 adjustment = "+adj_t1/1000);
System.out.println("t2 adjustment = "+adj_t2/1000);
/* sync clock */
System.out.println("Synchronized Server Clock =
"+sdf.format(new Date(adjserver)));
System.out.println("Synchronized Client1 Clock =
"+sdf.format(new Date(t1+adj_t1)));
System.out.println("Synchronized Client2 Clock =
"+sdf.format(new Date(t2+adj_t2)));
} catch (ParseException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
berkeleyAlgo("03:00", "03:25", "02:50");
}
}

Output:
Server Clock = 03:00
Client Clock 1 = 03:25
Client Clock 2 = 02:50
t1 - s = 25
t2 - s = -10
(st1 + st2 + 0)/3 = 5
t1 adjustment = -20
t2 adjustment = 15
Synchronized Server Clock = 03:05
Synchronized Client1 Clock = 03:05
Synchronized Client2 Clock = 03:05

=== Code Execution Successful ===

Experiment - 04

Aim: Write a program to simulate Election algorithm (Bully Algorithm)


Theory:
Code:
import java.util.Scanner;
class Process {
public int id;
public boolean active;
public Process(int id) {
this.id = id;
active = true;
}
}
public class App {
int noOfProcesses;
Process[] processes;
Scanner sc;
public App() {
sc = new Scanner(System.in);
}
public void initialiseApp() {
System.out.println("Enter no of processes");
noOfProcesses = sc.nextInt();
processes = new Process[noOfProcesses];
for (int i = 0; i < processes.length; i++) {
processes[i] = new Process(i);
}
}
public int getMax() {
int maxId = -99;
int maxIdIndex = 0;
for (int i = 0; i < processes.length; i++) {
if (processes[i].active && processes[i].id > maxId) {
maxId = processes[i].id;
maxIdIndex = i;
}
}
return maxIdIndex;
}
public void performElection() {
System.out.println("Process no " + processes[getMax()].id
+ " fails");
processes[getMax()].active = false;
System.out.println("Election Initiated by");
int initiatorProcesss = sc.nextInt();
int prev = initiatorProcesss;
int next = prev + 1;
while (true) {
if (processes[next].active) {
System.out.println("Process " +
processes[prev].id + " pass Election(" + processes[prev].id + ")
to " + processes[next].id);
prev = next;
}
next = (next + 1) % noOfProcesses;
if (next == initiatorProcesss) {
break;
}
}
System.out.println("Process " + processes[getMax()].id +
" becomes coordinator");
int coordinator = processes[getMax()].id;
prev = coordinator;
next = (prev + 1) % noOfProcesses;
while (true) {
if (processes[next].active) {
System.out.println("Process " +
processes[prev].id + " pass Coordinator (" + coordinator
+ ") message to process " +
processes[next].id);
prev = next;
}
next = (next + 1) % noOfProcesses;
if (next == coordinator) {
System.out.println("End Of Election ");
break;
}
}
}
public static void main(String arg[]) {
App r = new App();
r.initialiseApp();
r.performElection();
}
}

Output:
Last login: Sat Feb 22 18:00:52 on ttys000
yash@Yashs-MacBook-Air ~ % cd desktop
yash@Yashs-MacBook-Air desktop % javac App.java
yash@Yashs-MacBook-Air desktop % java App
Enter no of processes
5
Process no 4 fails
Election Initiated by
2
Process 2 pass Election(2) to 3
Process 3 pass Election(3) to 0
Process 0 pass Election(0) to 1
Process 3 becomes coordinator
Process 3 pass Coordinator (3) message to process 0
Process 0 pass Coordinator (3) message to process 1
Process 1 pass Coordinator (3) message to process 2
End Of Election
yash@Yashs-MacBook-Air desktop %

Experiment - 05

Aim: Write a program to simulate Mutual Exclusion (Raymond's Tree-Based Algorithm)


Theory:
Code:
n = 5

request_queue = {0: [], 1: [], 2: [], 3: [], 4: []}


holder = {0: 0, 1: 0, 2: 0, 3: 1, 4: 1}
token = {0: 1, 1: 0, 2: 0, 3: 0, 4: 0}

adj_matrix = [[1, 0, 0, 0, 0],


[1, 0, 0, 0, 0],
[1, 0, 0, 0, 0],
[0, 1, 0, 0, 0],
[0, 1, 0, 0, 0]]

print("Raymond Tree based Mutual Exclusion")


print("\nAdjacency Matrix for the spanning tree:\n")

for i in adj_matrix:
print(*i)

req_process = int(input("\nEnter the process who wants to enter


the CS: "))

def find_parent(req_process):
request_queue[req_process].append(req_process)
for i in range(n):
if (adj_matrix[req_process][i] == 1):
parent = i
request_queue[parent].append(req_process)
break

print("\nProcess {} sending Request to parent Process


{}".format(req_process, parent))
print("\nRequest Queue:", request_queue)

if (token[parent] == 1):
return parent

else:
parent = find_parent(parent)

return parent

parent = find_parent(req_process)
while (token[req_process] != 1):
child = request_queue[parent][0]
request_queue[parent].pop(0)
holder[parent] = child
holder[child] = 0
token[parent] = 0
token[child] = 1
print("\nParent process {} has the token and sends the token
to the reqeust process {}".format(parent, child))
print("\nRequest Queue:", request_queue)
parent = child

if (token[parent] == 1 and request_queue[parent][0] == parent):


request_queue[parent].pop(0)
holder[parent] = parent
print("\nProcess {} enters the Critical
Section".format(parent))
print("\nRequest Queue:", request_queue)

if (len(request_queue[parent]) == 0):
print("\nRequest queue of process {} is empty. Therefore
Release Critical Section".format(parent))

print("\nHolder:", holder)

Output:
Raymond Tree based Mutual Exclusion

Adjacency Matrix for the spanning tree:

10000
10000
10000
01000
01000

Enter the process who wants to enter the CS: 4

Process 4 sending Request to parent Process 1


Request Queue: {0: [], 1: [4], 2: [], 3: [], 4: [4]}

Process 1 sending Request to parent Process 0

Request Queue: {0: [1], 1: [4, 1], 2: [], 3: [], 4: [4]}

Parent process 0 has the token and sends the token to the reqeust process 1

Request Queue: {0: [], 1: [4, 1], 2: [], 3: [], 4: [4]}

Parent process 1 has the token and sends the token to the reqeust process 4

Request Queue: {0: [], 1: [1], 2: [], 3: [], 4: [4]}

Process 4 enters the Critical Section

Request Queue: {0: [], 1: [1], 2: [], 3: [], 4: []}

Request queue of process 4 is empty. Therefore Release Critical Section

Holder: {0: 1, 1: 4, 2: 0, 3: 1, 4: 4}

=== Code Execution Successful ===

Experiment - 06

Aim: Write a program to simulate Deadlock management in Distributed systems


(Banker's Algorithm)
Theory:
Code:
p = int(input("Enter the no. of processes: "))
r = int(input("Enter the no. of resources: "))

instances = []
print()
for i in range(r):
instance = int(input("Enter the instances of resource type R{}:
".format(i+1)))
instances.append(instance)

max = []
print("\nEnter the Max matrix for each process:")
for i in range(p):
max_i = [int(item) for item in input("P{}:
".format(i+1)).split()]
max.append(max_i)

alloc = []
print("\nEnter the Allocated matrix for each process:")
for i in range(p):
alloc_i = [int(item) for item in input("P{}:
".format(i+1)).split()]
alloc.append(alloc_i)

completed = []
for i in range(p):
completed.append(0)

sum = []
for i in range(r):
sum.append(0)

for i in range(p):
for j in range(r):
sum[j] += alloc[i][j]

avail = []
for i in range(r):
avail.append(instances[i] - sum[i])

need = []
print("\nNeed matrix: ")
for i in range(p):
need_i = []
print("P{}: ".format(i + 1), end="")
for j in range(r):
print(max[i][j] - alloc[i][j], end=" ")
need_i.append(max[i][j] - alloc[i][j])
print()
need.append(need_i)

count = 0
safeSequence = []
start = 0

while True:
process = -1
for i in range(start, p):
if completed[i] == 0:
process = i
for j in range(r):
if (avail[j] < need[i][j]):
process = -1
break

if process != -1:
break

if process != -1:
safeSequence.append(process + 1)
count += 1
for j in range(r):
avail[j] += alloc[process][j]
alloc[process][j] = 0
max[process][j] = 0
completed[process] = 1

if count != p and process != -1:


if (process + 1 == p):
start = 0
else:
start = process + 1
continue
else:
break

if (count == p):
print("\nThe system is in a Safe State.")
print("Safe Sequence : < ", end="")
for i in range(p):
print("P{}".format(safeSequence[i]), end=" ")
print(">")
else:
print("\nThe system is in an Unsafe State.")

Output:
Enter the no. of processes: 5
Enter the no. of resources: 3

Enter the instances of resource type R1: 10


Enter the instances of resource type R2: 5
Enter the instances of resource type R3: 7

Enter the Max matrix for each process:


P1: 7 5 3
P2: 3 2 2
P3: 9 0 2
P4: 2 2 2
P5: 4 3 3

Enter the Allocated matrix for each process:


P1: 0 1 0
P2: 2 0 0
P3: 3 0 2
P4: 2 1 1
P5: 0 0 2

Need matrix:
P1: 7 4 3
P2: 1 2 2
P3: 6 0 0
P4: 0 1 1
P5: 4 3 1

The system is in a Safe State.


Safe Sequence : < P2 P4 P5 P1 P3 >

=== Code Execution Successful ===

Experiment - 07

Aim:Write a program to simulate Load balancing Algorithm


Theory:
Code:
n_servers = int(input("Enter no. of servers: "))
n_processes = int(input("Enter no. of processes: "))

def rrlb(n_servers,n_processes):
lst = []
for i in range(n_processes):
lst.append((i%n_servers)+1)

print()

for i in range(n_servers):
print("Server {} has {}
processes".format(i+1,lst.count(i+1)))

while True:
rrlb(n_servers, n_processes)
choice = int(input("\n1.Add Server\n2.Remove Server\n3.Add
Process\n4.Remove Process\n5.Exit\n\nEnter your choice: "))

if choice == 1:
n_servers += 1
elif choice == 2:
n_servers -= 1
elif choice == 3:
n_processes += 1
elif choice == 4:
n_processes -= 1
else:
break

Output:
Enter no. of servers: 3
Enter no. of processes: 7

Server 1 has 3 processes


Server 2 has 2 processes
Server 3 has 2 processes

1.Add Server
2.Remove Server
3.Add Process
4.Remove Process
5.Exit

Enter your choice: 1

Server 1 has 2 processes


Server 2 has 2 processes
Server 3 has 2 processes
Server 4 has 1 processes

1.Add Server
2.Remove Server
3.Add Process
4.Remove Process
5.Exit

Enter your choice: 2

Server 1 has 3 processes


Server 2 has 2 processes
Server 3 has 2 processes

1.Add Server
2.Remove Server
3.Add Process
4.Remove Process
5.Exit

Enter your choice: 3

Server 1 has 3 processes


Server 2 has 3 processes
Server 3 has 2 processes

1.Add Server
2.Remove Server
3.Add Process
4.Remove Process
5.Exit

Enter your choice: 4

Server 1 has 3 processes


Server 2 has 2 processes
Server 3 has 2 processes

1.Add Server
2.Remove Server
3.Add Process
4.Remove Process
5.Exit

Enter your choice: 5

=== Code Execution Successful ===

You might also like