Implementation of solution of bounded buffer(producer-consumer) problem

Input Area

Enter Number of blocks in Buffer:


Enter Size of each buffer block:



Information Box

Consumer Code

1.If buffer is empty make sleep the consumer

2.Else take an item from the buffer

3.Decerement count of items

4.If buffer is not full wake the producer

5.Consume the item

Buffer


Producer Code

1.Create a new item to put in the buffer.

2.If buffer is full make sleep producer.

3.Else put the item in the buffer.

4.Increment count of items.

5.If buffer is not empty wake the consumer.