CIS307: Homework 5: Using Threads

This homework is given November 16 and is due November 27 by 5pm.

This homework is a modification of homework 3 by way of homework 4 and the use of threads.

In homework 4 we liked to have a shared memory and not to have to build an agenda to deal with slow operations. Unfortunately not always it is possible to have a shared memory. In the homework following this one we will see how to have processes communicate across the internet. In this homework we assume that communications to the STORE_MANAGER are through pipes, like we did in homework 3. But now

Now when STORE_MANAGER receives a message from RAND_PROC1 and RAND_PROC2 it creates a thread to handle that specific request. The thread will do the logging of the received message, do the appropriate thing with the store (using locks to protect this access to the specified field), log the response message and put it in the appropriate pipe. Then it will terminate. [Do not create threads within STORE_MANAGER that remain alive past the request they satisfy. It might be more efficient, but it is not what is being asked.]

Be sure that the format of the messages (and of the logs) is the same as in homework 3, except that now message to STORE_MANAGER need not identify the sender.
Be aware of the fact that now the log file used in STORE_MANAGER is an object shared between concurrent activities.

ingargiola@cis.temple.edu