Operating Systems Concepts with Java

 

These links will be used:

We will develop an application in which a group of clients are communicated through a server. In the process we will emphasize that object oriented programming is really about distributed processing. The first stage of the application (presented below) is not networked, but the design of the application is such that the separation of roles is carefully acknowledged. All clients behave the same, the server is only one (and behaves differently). They do communicate. To better emphasize what clients and servers should know about each other both classes group their public methods in interfaces (elements of pure design). This situation is exemplified below.

 

 


The entire program will be started (locally) through a main program placed in a class called Simulation. The diagram is presented below. When the program starts it will create a server and three clients. It will start the clients (three applets in three frames) which will then be able to communicate through a chat text area and a shared whiteboard.

 


The interface of a client consists of a frame in which an applet is placed. The applet’s user interface contains a text field, a text area and a draw pad. The draw pad is separately implemented. The set of connections is more complicated. Only a part of them are shown here.

 


 

Here’s the entire diagram. An Update class and a Line type of object complete it.

 

 


Rearranging the diagram a bit. Clients are sending Update objects to each other. These objects have a structure and they contain Line objects (this will support drawing).

 


We right click on the main class and select the method we want to run.

 


When invoked it asks for the command line arguments. There aren’t any so click OK.

 


Three empty GUIs pop up.

 


Switch between them and type text and draw. The information is propagated everywhere.

 

 

In class we will see that turning this program into a distributed application using RMI and running over the network can be achieved in zero time. Differences between local and distributed programs will be discussed (latency, concurrency, reliability and memory access issues need to be taken into account). Still, the generality of the transformation is not affected in any way, all four areas being effectively covered. In addition there are two significant advantages that stem from using Java (compared to a mixed XML-RPC or SOAP approach) which will be discussed. 

 

Code will be made available in the web page.