Q1. What are the necessary conditions to avoid race condition?
Ans. Although critical section’s requirement avoids race conditions, it is not sufficient for having parallel process cooperate correctly and efficiently using shared data. We need four conditions to hold to have a good solution:
- No two processes may be simultaneously inside their critical regions.
- No assumptions may be made about speeds or the number of CPUs.
- No process running outside its critical region may block other processes.
- No process should have to wait forever to enter its critical region.