Bounded Buffer Module
Member rating: No Rating | Words: | Submitted: Fri Jan 14 2005
On the left is an image preview of every page of this document, and below are the first 150 words with formatting removed:
Bounded Buffer Module A Bounded Buffer is a data store that may hold a finite number of values. It behaves as a first-in first-out queue: values leave in order in which they arrive. We will develop a programming language implementation of a bounded buffer with three operations: • BufferInit - an initialisation • BufferIn, providing input to the buffer • BufferOut, accepting output from the buffer. We must specify these operations, design , and implement them. 1. Specification The state of a bounded buffer will include three components: • buffer: a sequences of values • size: the number of values present • maxsize: an indication of the buffer's capacity. The sequence buffer, and the state itself, will use a generic parameter X to refer to the type of values to be stored: ===Buffer[X]================= buffer : seq X size : N maxsize : N size = # buffer size ? maxsize At initialization, the bounded buffer is empty: buffer is equal to the empty sequence and...

