- Join over 1.2 million students every month
- Accelerate your learning by 29%
- Unlimited access for just £4.99 per month
Bounded Buffer Module
The first 200 words of this essay...
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 size is zero:
===BufferInit[X]==============
Buffer'[X]
buffer'=<>
Found what you're looking for?
- Start learning 29% faster today
- Over 150,000 essays available
- Just £4.99 a month
Not the one? We have 100's more
Microbiology (view all)