In: Computer Science
Q1. Explain what a race condition is. Provide an explanation of
how a race condition occurs, and what mechanisms operating systems
employ to prevent them.
Q2. True or False: Multi-level feedback queue scheduling can be
used to favor shorter processes without knowing estimated CPU burst
times in advance.
Solving as per the Chegg guidelines the first problem (Question number -1). Please ask other questions separately.
Race condition is referred to a situation where multiple operation are tried to be executed by a system. As the name suggests there is a race between the operations to be in execution state as early as possible (to be the first in that state).
Race condition occurs or is encountered in cases when the system requests for reading certain data along with writing of that data. In this case the system tends to write the new data on the previous data while the reading of the previous data is also going on. This situation generally results out in a fault or crash, system may also alert with a notification stating about the invalid operations executed. It can also be seen in cases where the order of the processes to be executed is not correct.
For preventing race condition in operating system one can use the concept of mutual exclusion in which only one process is given chance to be in the execution state (that is access the sharable resource / critical section). It can also be understood that process synchronization should be done. Execution of process should be done in a systematic fashion (serialized manner). There are further solutions which are used for solving the critical section problem which are based on certain criteria - mutual exclusion , progress and bounded wait.