Reading material
Pages i - 2-6 of Linda User's Guide & Reference Manual
Pages 230-233 of Threads Library Functions
Additional material
philosopher.c
Package EDU.oswego.cs.dl.util.concurrent including the class Semaphore
Question
Consider the following Linda-C code.
int get()
{
int data
in("buffer", ?data); /* get data from buffer */
return data;
}
void put(int data)
{
out("buffer", data); /* put data in buffer */
}
This is a first attempt to implement a bounded fifo buffer which
contains integers as data. The elements stored in the buffer
are kept as tuples of the form ("buffer", data) in the
tuple space, where data is the integer stored in the
buffer. Note that in("buffer", ?data) blocks if the buffer
is empty. The above code fragment implements a buffer which is
unbounded and which is not necessarily fifo. Improve the above
attempt.