What are the two ‘Classic Problems of Synchronization’ mentioned in the source material?
The Bounded-Buffer Problem and the Dining-Philosophers Problem.
What is the primary use for classic synchronization problems like the Bounded-Buffer and Dining-Philosophers problems?
They are used for testing nearly every newly proposed synchronization scheme.
What synchronization primitive is traditionally used to present solutions to classic synchronization problems?
Semaphores.
In the context of classic synchronization problems, what primitive could be used as an alternative to binary semaphores?
Mutex locks.
In the Bounded-Buffer problem solution, what is the initial value of the mutex semaphore?
The mutex semaphore is initialized to 1.
What is the purpose of the mutex semaphore in the Bounded-Buffer problem solution?
It provides mutual exclusion for access to the buffer manipulation code.
In the Bounded-Buffer problem, the empty semaphore is initialized to ‘n’. What does ‘n’ represent?
‘n’ represents the number of empty buffers (slots) available in the bounded buffer.
In the Bounded-Buffer problem solution, what is the initial value of the full semaphore?
The full semaphore is initialized to 0.
What does the value of the full semaphore represent in the Bounded-Buffer problem?
It represents the number of full buffers (slots) available in the bounded buffer.
In the Bounded-Buffer problem, what is the first operation the producer process performs inside its loop to add an item?
wait(empty).
Why must the producer in the Bounded-Buffer problem execute wait(empty) before adding an item to the buffer?
To ensure there is an empty slot available to place the new item, blocking if the buffer is full.
In the Bounded-Buffer problem, what is the second operation the producer process performs inside its loop?
wait(mutex).
After gaining access to the buffer, what is the first operation the producer process performs to release resources?
signal(mutex).
What is the final operation the producer process performs in its loop after adding an item to the buffer?
signal(full).
Why does the producer in the Bounded-Buffer problem execute signal(full) after adding an item?
To increment the count of full slots, potentially waking up a waiting consumer.
In the Bounded-Buffer problem, what is the first operation the consumer process performs inside its loop to remove an item?
wait(full).
Why must the consumer in the Bounded-Buffer problem execute wait(full) before removing an item?
To ensure there is a full slot available to consume from, blocking if the buffer is empty.
In the Bounded-Buffer problem, what is the second operation the consumer process performs inside its loop?
wait(mutex).
After removing an item from the buffer, what is the first operation the consumer process performs to release resources?
signal(mutex).
What is the final operation the consumer process performs in its loop after removing an item from the buffer?
signal(empty).
Why does the consumer in the Bounded-Buffer problem execute signal(empty) after removing an item?
To increment the count of empty slots, potentially waking up a waiting producer.
Describe the symmetry between the producer and consumer in the Bounded-Buffer problem.
One can view the producer as producing full buffers for the consumer, or the consumer as producing empty buffers for the producer.
Describe the physical setup of the Dining-Philosophers problem.
Five philosophers share a circular table with five chairs, a central bowl of rice, and five single chopsticks.
In the Dining-Philosophers problem, what must a philosopher acquire to be able to eat?
The philosopher must acquire the two chopsticks that are closest to them (left and right).