BoundedBuffer Example
BBDriver.java contains implementation of a simple bounded buffer and several auxiliary classes used to exercise the behavior of the buffer. The BoundedBuffer class has two methods used for adding and removing elements from the buffer. You can add to the buffer if the buffer is not full and if you have a lock of the bounded buffer that guarantees an exclusive access to the buffer. If the buffer is not empty and you have access to the buffer, you can take an element out of the buffer. The BoundedBuffer has 4 fields: buffer represented by an array of Objects, bound, head, and tail represented by an int. The bound variable represents the number of slots
in the buffer. The head variable points to the next available slot in the buffer, and tail points to the last available slot. The driver creates two bounded buffers b1 and b2 and two threads of type InOut1 and InOut2 that work with the buffers. Thread InOut1 constantly takes an element out of the
first buffer and puts in into the second buffer. Thread InOut2 takes an element out of the second buffer and puts it into the first one. Proper synchronization is used to control threads' activities.Artifacts: