To Understand Process Synchronization

Pre Test

1. What is the primary challenge in the Dining Philosophers problem?

a) Ensuring that each philosopher eats in a timely manner.
b) Preventing starvation of any philosopher due to resource contention.
c) Allocating an equal amount of food to each philosopher.
d) Optimizing the time it takes for all philosophers to eat.

2. What are the resources that philosophers compete for in this problem?

a) Chopsticks
b) Plates
c) Food
d) Tables

3. In the Producer-Consumer problem, what does the "full" semaphore represent?

a) The number of empty slots in the buffer
b) The total size of the buffer
c) The number of filled slots in the buffer
d) The number of producers

4. What operation is used to decrement a semaphore?

a) signal()
b) wait()
c) increment()
d) release()

5. How does a semaphore help solve the Dining Philosophers problem?

a) By allowing only one philosopher to access a chopstick at a time.
b) By signaling when a chopstick becomes available.
c) By preventing a philosopher from using both chopsticks simultaneously.
d) All of the above.