Answer
See explanation
Work Step by Step
The set-and-clear flag system is a simple method for managing device allocation in which each device has a flag indicating whether it is free (clear) or busy (set). While easy to implement, it has several drawbacks:
Drawback: Risk of race conditions
- If two processes check the flag simultaneously, both might see the device as free and try to allocate it at the same time.
- This can lead to conflicts, data corruption, or system crashes.
Other limitations
- No automatic queuing: Processes must poll the flag repeatedly (busy waiting) until the device becomes free, wasting CPU time.
- No priority handling: All processes compete equally; the system cannot prioritize urgent requests.
- Scalability issues: With many devices or processes, the simple flag system becomes inefficient and error-prone.