The STORE_MANAGER is a server program running on a computer, say Snowhite.cis.temple.edu. It is started from the Unix shell and it is called without command line parameters. It obtains a port from the system and prints out its id. It creates a datagram socket, and it binds it to this port. Then it waits to receive messages from the clients. When it receives a message from a client, it creates a thread and gives the request to it together with information on the requestor (the thread needs this information in order to send information back to the requesting client). The thread carries out the request (starting the operation, sleeping a bit, and then completing the operation) and sends back a reply on the same socket. It then terminates. In the meanwhile STORE_MANAGER waits for and services the next message which it handles in a similar way. Since a number of threads will be executing concurrently and sharing the table, you will need mutexes to enforce the appropriate mutual exclusions on a per table-entry basis. [Implement the STORE_MANAGER first without using threads and mutexes, i.e. as a program that handles requests sequentially. Only after it works re-implement it using threads.]
A client program RAND_PROC is also started from the Unix shell on the same or on a different computer. It is given two command line parameters:
Both the client and the server will use timeouts when waiting for messages. At the timeout they print a warning message and then they go back to waiting.
The RAND_PROC program has the same structure as in Homework 4, only now the store operations instead of being implemented by creating/accessing shared memory, are implemented by communicating with the server through a socket.
RAND_PROC and STORE_MANAGER will exchange messages and log in the same way
as they did in homework 2 (but of course now they use sockets, not pipes).
The programs should keep operating correctly even if you launch a number
of copies of RAND_PROC, perhaps on different computers.
STORE_MANAGER will terminate when we send to it from the unix shell the appropriate kill signal. The RAND_PROC processes terminate by the users making the appropriate menu selection.
ingargiola@cis.temple.edu