Starting from:

$29.99

Assignment 2 Distributed Systems Solved

2             Problem
For this assignment, you will be using RMI(Remote Method Invocation) in Java to implement a simple single server architecture with support for multiple clients. The details are as follows:

•    The server maintains a list of graphs each associated with a distinct identifier. 

•    Clients can request to add a new graph, update an existing graph and query for the total weight of the minimum weight spanning tree of a given graph.

•    Clients can request to add a new graph using ‘add graph ⟨graph identifier⟩ n’. This command will add a new graph on the server with the identifier graph identifier and n number of nodes. The graph identifier is a string with a maximum length of 10 and it won’t already exist. n will be in the range: 1 <= n <= 100,000.

•    Clients can request to add a new edge in a graph using ‘add edge ⟨graph identifier⟩ ⟨u⟩ ⟨v⟩ ⟨w⟩’. This will add an undirected edge between the nodes u and v with weight w. u and v are the node numbers of the endpoints of the edge such that 1 <= u,v <= n and 0 <= w <= 10,000. n is the number of nodes in the specified graph. A graph with identifier graph identifier will already exist. There can be multiple edges and self-loops added to the graph.

1

•    Clients can request for the total weight of the minimum weight spanning tree in a graph from the server using ‘get mst ⟨graph identifier⟩’. The client will print the solution the server returns. In case the graph does not have a spanning tree, -1 should be printed. A graph with identifier graph identifier will already exist.

•    All values should fit in 32-bit signed integers.

•    The server should be able to handle multiple clients simultaneously and should also work with clients on other machines.

•    You are free to use any algorithm for MST.

•    A tutorial for RMI can be found at https://www.tutorialspoint.com/java rmi/index.htm or https://www.geeksforgeeks.org/how-to-run-java-rmi-application/.

3             Submission Instructions
You need to submit a single file - ⟨RollNumber⟩.zip containing a directory with the same name as your roll number that holds the following files:

•    2 Java source files - Client.java and Server.java. Your code will be run using:

–    The files would be compiled with ‘javac *.java’.

–    The server is run using with ‘java Server ⟨server port⟩’.

–    The clients are run using ‘java Client ⟨server ip⟩ ⟨server port⟩’.

•    A report for the problem - README.md. The report should contain details of the architecture, algorithm implementation, results and observations.

More products