GATEverse
← GATE CSE 2015 Set 3

Q10

MCQ1 mark, −0.33

Two processes XX and YY need to access a critical section. Consider the following synchronization construct used by both the processes

Process XProcess Y/* other code for process X*//* other code for process Y */while (true)while (true){{varP = true;varQ = true;while (varQ == true)while (varP == true){{/* Critical Section *//* Critical Section */varP = false;varQ = false;}}}}/* other code for process X *//* other code for process Y */\begin{array}{|l|l|}\hline \text{Process X} & \text{Process Y} \\ \hline \text{/* other code for process X*/} & \text{/* other code for process Y */} \\ \text{while (true)} & \text{while (true)} \\ \text{\{} & \text{\{} \\ \quad\text{varP = true;} & \quad \text{varQ = true;} \\ \quad\text{while (varQ == true)} &\quad \text{while (varP == true)}\\ \quad\text{\{} & \quad\text{\{} \\ \quad\quad\text{/* Critical Section */} & \quad\quad\text{/* Critical Section */} \\ \quad\quad\text{varP = false;} &\quad\quad \text{varQ = false;} \\ \quad\text{\}} & \quad\text{\}} \\ \text{\}} & \text{\}} \\ \text{/* other code for process X */} & \text{/* other code for process Y */}\\ \\ \hline \end{array}

Here varP and varQ are shared variables and both are initialized to false. Which one of the following statements is true?

Sign in to save attempts.

Loading…