Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / CS/CE 6378: Advanced Operating Systems Section 001 Project 1 This project must be done in a group

CS/CE 6378: Advanced Operating Systems Section 001 Project 1 This project must be done in a group

Computer Science

CS/CE 6378: Advanced Operating Systems Section 001 Project 1 This project must be done in a group. A group size can vary from two to three students. Code sharing among groups as well as copying code from the Internet without permission is strictly prohibited and will result in disciplinary action being taken. Each group is expected to write their own code and demonstrate the operation of this project to the instructor or the TA if asked. You may be graded not only on the correct behavior of your project, but also on your responses to questions concerning your implementation which the instructor or TA may ask during your demo. This project must be done in Java. Since the project involves socket programming, you can only use machines dcXX.utdallas.edu, where XX ?{01, 02, .., 45}, for running the program. Although you may develop the project on any platform, the demonstration has to be on dcXX machines; otherwise you will be assessed a penalty of 20%. 1 Project Description You have to create a library that can be used to build a distributed system consisting of nodes arranged in any communication topology. Each node sends messages to and receives messages from only its neighbors in the communication topology. A node in a distributed system will be modeled using a Node class. A distributed application creates a node by creating an object of type Node. Intuitively, a Node object handles all communications pertaining to the node and may create one or more threads as needed. The constructor to Node class takes three arguments: (a) the unique identifier associated with the node (which is a non-negative number), (b) the name of the configuration file that describes the system topology including the location of each node, and (c) a handle used to notify the application of an event of interest. The constructor establishes a dedicated connection to each neighbor using TCP/IP or SCTP/IP sockets. A connection should persist until it is terminated by the application. The Node class supports the following methods: (i) getNeighbors: it returns an array that contains the identifiers of the neighboring nodes (ii) send: it sends a given message to a given neighbor (iii) sendToAll: it sends a given message to all the neighbors (iv) tearDown: it closes connections to all the neighbors public class Node { // node identifier private NodeID identifier; // constructor public Node( NodeID identifier, String configFile, Listener listener ); // methods public NodeID[] getNeighbors( ); public void send( Message message, NodeID destination ); public void sendToAll( Message message ); public void tearDown( ); } /* Helper classes */ public class NodeID implements Serializable { private int identifier; public int getID( ); } public interface Listener { public void receive( Message message ); public void broken( NodeID neighbor ); } public class Message implements Serializable { NodeID source; byte[] data; } The Node class uses three helper classes, namely NodeID, Listener and Message. The NodeID class denotes the unique identifier associated with the node, which is a non-negative number. The Listener class is an interface that is used by the Node class to notify the application of an event of interest. It supports two methods: (i) receive: it is used to deliver a message received from a neighbor to the application (ii) broken: it is used to inform the application that a connection has been terminated by a neighbor Both NodeID and Message classes extend the Serializable interface in Java. It makes it easy to convert a message into a byte stream for transmission, and vice versa, over the network. The interface Listener will be implemented by the application. 2 # number of nodes 5 0 dc02 12234 # nodeID hostName listeningPort 1 dc03 11233 2 dc04 22233 3 dc05 15232 4 dc06 16233 1 4 # space delimited list of neighbors for node 0 0 2 3 # space delimited list of neighbors for node 1 1 3 # ... node 2 1 2 4 # ... node 3 0 3 # ... node 4 Goal: Your goal in this project is to implement the Node class. You will be provided with a simple Java application to test your program. 2 Submission Information All submissions will be through eLearning. Submit all the source files necessary to compile the program and run it. Also, submit a README file that contains instructions to compile and run your program. 3 Configuration Format The configuration file will be a plain-text formatted file no more than 100kB in size. Only lines which begin with an unsigned integer are considered to be valid. Lines which are not valid should be ignored. The configuration file will contain 2n+1 valid lines. The first valid line of the configuration file contains one token that denotes the number of nodes in the system. After the first valid line, the next n lines consist of three tokens. The first token is the node identifier. The second token is the host-name of the machine on which the node runs. The third token is the port on which the node listens for incoming connections. After the first n + 1 valid lines, the next n lines consist of a space delimited list of at most n? 1 tokens. The kth valid line after the first line is a space delimited list of node IDs which are the neighbor of node k. Your parser should be written so as to be robust concerning leading and trailing white space or extra lines at the beginning or end of file, as well as interleaved with valid lines. The # character will denote a comment. On any valid line, any characters after a # character should be ignored. You are responsible for ensuring that your program runs correctly when given a valid configuration file. Make no additional assumptions concerning the configuration format. If you have any questions about the configuration format, please ask the TA. 3

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE