CS 5523: Operating Systems
Homework 4
!!!!! No late HW will be accepted !!!!!!
(Check BlackBoard Learn for due date and submission)
Objectives
|
Learn and practice client-server paradigm and peer-to-peer paradigm Implement a simple distributed system using Java RMI. |
Description
You will design and implement a simplified tracking and chatting system, where a server keeps track of
the registered clients and provide necessary information for clients to directly send each other short
messages when they come close. You will implement a server program and a client program along with
application layer protocol(s) to enable them to communicate. The same client program will be executed
several times to simulate different users.
The server program will serve client requests and maintain all the below mentioned information about
each active client in a linked list. (Note that Java RMI automatically uses multiple threads to process
requests originating from different clients.)
Each client will connect to the server and register itself by reporting its initial (x,y) location along with
other information such as name, age etc. The server will assign a unique ID to each client and send this ID
to the client. The client program should be able to get the short messages that might be sent by other
clients (peers) and print them on the screen. So the client program should also register the additional
information that makes this possible to the server and server should maintain that information too.
After the registration step, the server program will wait for clients’ requests and accordingly respond to
them. A client’s main thread can make the following requests (which are entered by the user running the
client program):
1. go -50 30 : client wants to go 50m South and 30m East, server updates the location
and reports the new location (go 40 -20 means go 40m North and 20m West)
2. get location : client wants to know its current (x,y) location, server reports the current
location of this client
3. list 30 : client wants to get the list of users within 30m, server determines such
clients/users within 30m of requesting client and send their information (user-id, name, age,
additional info) to the client, client keeps that list in a linked list and prints their user-id,
name, and age on the screen
4. send user-id msg : client sends msg directly to user-id. Server not involved here.
5. quit : client leaves the system, server takes it out from the list
Clearly, there will be some shared resource at the server and/or client so you need to protect them and
implement necessary synchronization mechanisms.
Run the rmiregistry and server program on hostA as follows:
hostA> rmiregistry [port] &
hostA> java server &
Run each clients on different hosts as follows:
anyhost> java client –SH hostA -N name -L x y –A age
——————————————————————————————————————————-
Grading: This is a 200-point homework.
First write a 2-3 page report (20 points) to describe your design choices at the high level and particularly
describe your remote objects and the services they provide…
Then implement your server and client programs and make sure client can register and be able to interact
with the server to update its locations, get list of other users etc. (100 points)
Finally, enhance your client programs so that clients (peers) can send each other messages through remote
objects. (This part will be 80 points)
——————————————————————————————————————————-
Submission
You must submit your work using Blackboard Learn and respect the following rules:
1) All assignments must be submitted as either a zip or tar archive file unless it is a single pdf file.
2) Assignments must include all source code.
3) Assignments must include an output.txt file which demonstrates the final test output run by the
student.
4) If your assignment does not run/compile, the output.txt file should include an explanation of what
was accomplished, what the error message was that prevented the student from finishing the
assignment and what the student BELIEVES to be the underlying cause of the error.