Process Synchronization Question Bank
Process Synchronization Question Bank
1. Multiprogramming
A: Definition: An OS that allows multiple programs to run concurrently by managing CPU time among them.
Key Points:
Multiuser: Supports multiple users accessing the same CPU from terminals.
A: - File System
- Command Processor
- Transient Area
A: - Windows
- UNIX
- MP/M
- XENIX
- DESQview
2. Process Synchronization
Key Points:
- Avoids deadlocks.
A: When multiple processes access and modify shared data concurrently, leading to unexpected outcomes.
A: A part of the code where shared resources are accessed. Only one process should execute it at a time.
A: - Mutual Exclusion
- Progress
- Bounded Waiting
A: If Process P1 is in the critical section, P2 should wait. This prevents simultaneous access.
A: A process should not wait forever to enter its critical section. There must be a limit.
Process Synchronization - Question Bank with Answers
A: A hardware-supported atomic instruction. It checks and sets lock simultaneously to avoid race conditions.
A: Uses a 'turn' variable to alternate access between two processes. Ensures one at a time access.
A: It may not provide bounded waiting. One process may repeatedly enter CS.
A: Producer adds items to buffer, consumer removes. Need synchronization to avoid overflow/underflow.
A: - Buffer overflow
- Buffer underflow
A: Multiple readers can read simultaneously, but writers need exclusive access.
A: When all philosophers pick one chopstick and wait forever (deadlock).
6. Semaphores
Q: What is a semaphore?
A: A variable used to control access to resources using wait() and signal() operations.
A: Track available and full slots using two semaphores: empty and full, and a mutex for access.
Q: Advantages of semaphores?