Distributed “Producers-Consumers” System
The objective of the project is design and development of a client-server system, which performs classical synchronization problem with a bounded number of resources – clients consume some resources, producers generate resources. The program covers some techniques discussed in the Operating System course:
• Distributed Client-Server processing;
• Utilization of threads;
• Synchronization of concurrent processing;
• Sockets for network communication;
• Implementation of Internet application (not Web application) .
It is important to note that the program should demonstrate the distributed client-server programming features, multithreaded programming and usage of synchronization techniques in concurrent programming. It should not mean to be a professional industrial strength program. The students are encouraged to add features according to their interests in learning of modern technologies.
2. Functions of the programs
The producer-consumer problem (also known as the bounded-buffer problem) is a classical example of a multi-process synchronization problem. The problem describes two processes, the producer and the consumer, who share a common, fixed-size buffer. The producer’s job is to generate a piece of data, put it into the buffer and start again. At the same time the consumer is consuming the data (i.e. removing it from the buffer) one piece at a time. The problem is to make sure that the producer won’t try to add data into the buffer if it’s full and that the consumer won’t try to remove data from an empty buffer.
The problem becomes complicated with several consumers and producers. For examples, with several consumers working in parallel, one consumer could erroneously try to take an item out of the buffer while another process is consuming the last item in the buffer.
In this project the students are to create an experimental system with several consumers and producers in Internet environment. Figure 1 present a view of the structure of the system.
Remark: The students are free to create their own architecture of the project.
On the client (Consumers) side there is some a ConsumerMonitor, which:
– organizes a dialog with the user, who can enter the number of the clients, producers, the size of the buffer and some modes of the system;
– creates a socket connection with the ProducerServer to exchange some needed information;
– generates consumer threads;
– provides some results to the user.