Step 1: Define the Dining Philosopher Problem.
The Dining Philosopher problem illustrates a synchronization challenge where multiple philosophers share resources (like forks). The goal is to prevent deadlock and ensure fair access for eating.
Step 2: Explain Semaphore Usage.
Semaphores are OS synchronization tools. For the Dining Philosopher problem, they control fork access, ensuring only one philosopher uses a fork at a time, thus preventing deadlock and enforcing mutual exclusion.
Step 3: Evaluate Alternative Options.
- (2) Overlays: A memory management technique, irrelevant to this problem.
- (3) Mutual exclusion: Essential for deadlock prevention, but semaphores are the specific mechanism used here.
- (4) Bounded waiting: Guarantees no indefinite waiting but isn't the core solution.
Step 4: State the Conclusion.
The correct solution is (1) Use of semaphores, which enables safe fork acquisition and release, thereby avoiding deadlock.
Consider the following threads, T1, T2, and T3 executing on a single processor, synchronized using three binary semaphore variables, S1, S2, and S3, operated upon using standard wait() and signal(). The threads can be context switched in any order and at any time.

Consider the following multi-threaded code segment (in a mix of C and pseudo-code), invoked by two processes $P1$ and $P2$, and each of the processes spawns two threads $T1$ and $T2$:
int x = 0; // global
Lock L1; // global
main() {
create a thread to execute foo(); // Thread T1
create a thread to execute foo(); // Thread T2
wait for the two threads to finish execution;
print(x); }
foo() {
int y = 0;
Acquire L1;
x = x + 1;
y = y + 1;
Release L1;
print(y); } Which of the following statement(s) is/are correct?