Web Application

profilerhtstha7
OSProjectOneSpring2019.doc

Project I

Distributed “Producers-Consumers” System

1. Objective

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.

image1.emf

The client threads:

· make requests to the BoundedBufferResources to consume an item.

The ProducerServer:

· manipulates the size of the BoundedBufferResources;

· generates the producer threads.

The producer threads:

· produce items in the BoundedBufferResources.

Different aspects of the synchronization could be emulated. The producer and the consumers could go to sleep after successful producing and consuming. Playing with the sleeping time the synchronization problem will be more interesting. For example, the Producer sleeps for a random amount of time before repeating the producing cycle. The consumers, being ravenous, could consume all items from the buffer (the exact same objects into which the producers put the items in the first place) as quickly as they become available.

Additionally (optional), some inter-thread communication could be organized. For example, a consumer can awake (interrupt the sleeping state) of other consumers, if it sees that the buffer is full. On the other side, the producers also can increase its sleeping time if the buffer is seen totally full.

3. Development environment and programming language

Student choice. But I think Java is easier because of the incorporated synchronization of the methods.

4. Project components

4.1. Design Documentation

Textual or UML description of the classes, functions (methods) and main functionality (2 pages). JavaDoc is appreciated.

4.2. Source code with well prepared comments

Dates:

1. Project turn in (send the source code and the documentation by email) – April 15th

2. Presentation 10 min for each student - April 20th.

Consumer

Monitor

Client

Client

Client

. . .

.

.

Internet

Producers

Server

Bounded Buffer Resources

Producer

Producer

Producer

Fig.1. General Idea of the Distributed System

User

PAGE

1

_1299843564.doc