GATE Exam  >  GATE Questions  >   Consider the following synchronization const... Start Learning for Free
Consider the following synchronization construct used by two process P0 and P1 which need to access a critical section:
P0 :
while (true) {
turn_0 = true;
while (turn_l = = true)
turn_0 = false;
CRITICAL SECTION
}
/ * Remainder section*/
P1 :
while (true) {
turn_1 = true;
while (turn_0 = = true)
turn_1 = false;
CRITICAL SECTION
}
/*Remainder section*/
Here, turn_0 and turn_1 are shared variables, which are initialized to false. Which of the following statements is true about the above construct?
  • a)
    It ensures mutual exclusion and prevents deadlock.
  • b)
    It requires that processes enter the critical section in strict alternation.
  • c)
    It does not ensure mutual exclusion.
  • d)
    It ensures mutual exclusion but cannot prevent deadlock.
Correct answer is option 'C'. Can you explain this answer?
Verified Answer
Consider the following synchronization construct used by two process ...
When both processes P0 and P1 execute concurrently. P0 and P1 make turn_0 = true and turn_1 = true, process P0 executes while loop before executing turn_0 = false it preempts and P1 starts executing it to make tum_1 = false and preempted. P0 makes turn_0 = false, both processes enter into the critical section. It does not ensure mutual exclusion.
View all questions of this test
Explore Courses for GATE exam

Similar GATE Doubts

Consider the following synchronization construct used by two process P0 and P1 which need to access a critical section:P0 :while (true) {turn_0 = true;while (turn_l = = true)turn_0 = false;CRITICAL SECTION}/ * Remainder section*/P1 :while (true) {turn_1 = true;while (turn_0 = = true)turn_1 = false;CRITICAL SECTION}/*Remainder section*/Here, turn_0 and turn_1 are shared variables, which are initialized to false. Which of the following statements is true about the above construct?a)It ensures mutual exclusion and prevents deadlock.b)It requires that processes enter the critical section in strict alternation.c)It does not ensure mutual exclusion.d)It ensures mutual exclusion but cannot prevent deadlock.Correct answer is option 'C'. Can you explain this answer?
Question Description
Consider the following synchronization construct used by two process P0 and P1 which need to access a critical section:P0 :while (true) {turn_0 = true;while (turn_l = = true)turn_0 = false;CRITICAL SECTION}/ * Remainder section*/P1 :while (true) {turn_1 = true;while (turn_0 = = true)turn_1 = false;CRITICAL SECTION}/*Remainder section*/Here, turn_0 and turn_1 are shared variables, which are initialized to false. Which of the following statements is true about the above construct?a)It ensures mutual exclusion and prevents deadlock.b)It requires that processes enter the critical section in strict alternation.c)It does not ensure mutual exclusion.d)It ensures mutual exclusion but cannot prevent deadlock.Correct answer is option 'C'. Can you explain this answer? for GATE 2024 is part of GATE preparation. The Question and answers have been prepared according to the GATE exam syllabus. Information about Consider the following synchronization construct used by two process P0 and P1 which need to access a critical section:P0 :while (true) {turn_0 = true;while (turn_l = = true)turn_0 = false;CRITICAL SECTION}/ * Remainder section*/P1 :while (true) {turn_1 = true;while (turn_0 = = true)turn_1 = false;CRITICAL SECTION}/*Remainder section*/Here, turn_0 and turn_1 are shared variables, which are initialized to false. Which of the following statements is true about the above construct?a)It ensures mutual exclusion and prevents deadlock.b)It requires that processes enter the critical section in strict alternation.c)It does not ensure mutual exclusion.d)It ensures mutual exclusion but cannot prevent deadlock.Correct answer is option 'C'. Can you explain this answer? covers all topics & solutions for GATE 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider the following synchronization construct used by two process P0 and P1 which need to access a critical section:P0 :while (true) {turn_0 = true;while (turn_l = = true)turn_0 = false;CRITICAL SECTION}/ * Remainder section*/P1 :while (true) {turn_1 = true;while (turn_0 = = true)turn_1 = false;CRITICAL SECTION}/*Remainder section*/Here, turn_0 and turn_1 are shared variables, which are initialized to false. Which of the following statements is true about the above construct?a)It ensures mutual exclusion and prevents deadlock.b)It requires that processes enter the critical section in strict alternation.c)It does not ensure mutual exclusion.d)It ensures mutual exclusion but cannot prevent deadlock.Correct answer is option 'C'. Can you explain this answer?.
Solutions for Consider the following synchronization construct used by two process P0 and P1 which need to access a critical section:P0 :while (true) {turn_0 = true;while (turn_l = = true)turn_0 = false;CRITICAL SECTION}/ * Remainder section*/P1 :while (true) {turn_1 = true;while (turn_0 = = true)turn_1 = false;CRITICAL SECTION}/*Remainder section*/Here, turn_0 and turn_1 are shared variables, which are initialized to false. Which of the following statements is true about the above construct?a)It ensures mutual exclusion and prevents deadlock.b)It requires that processes enter the critical section in strict alternation.c)It does not ensure mutual exclusion.d)It ensures mutual exclusion but cannot prevent deadlock.Correct answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for GATE. Download more important topics, notes, lectures and mock test series for GATE Exam by signing up for free.
Here you can find the meaning of Consider the following synchronization construct used by two process P0 and P1 which need to access a critical section:P0 :while (true) {turn_0 = true;while (turn_l = = true)turn_0 = false;CRITICAL SECTION}/ * Remainder section*/P1 :while (true) {turn_1 = true;while (turn_0 = = true)turn_1 = false;CRITICAL SECTION}/*Remainder section*/Here, turn_0 and turn_1 are shared variables, which are initialized to false. Which of the following statements is true about the above construct?a)It ensures mutual exclusion and prevents deadlock.b)It requires that processes enter the critical section in strict alternation.c)It does not ensure mutual exclusion.d)It ensures mutual exclusion but cannot prevent deadlock.Correct answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider the following synchronization construct used by two process P0 and P1 which need to access a critical section:P0 :while (true) {turn_0 = true;while (turn_l = = true)turn_0 = false;CRITICAL SECTION}/ * Remainder section*/P1 :while (true) {turn_1 = true;while (turn_0 = = true)turn_1 = false;CRITICAL SECTION}/*Remainder section*/Here, turn_0 and turn_1 are shared variables, which are initialized to false. Which of the following statements is true about the above construct?a)It ensures mutual exclusion and prevents deadlock.b)It requires that processes enter the critical section in strict alternation.c)It does not ensure mutual exclusion.d)It ensures mutual exclusion but cannot prevent deadlock.Correct answer is option 'C'. Can you explain this answer?, a detailed solution for Consider the following synchronization construct used by two process P0 and P1 which need to access a critical section:P0 :while (true) {turn_0 = true;while (turn_l = = true)turn_0 = false;CRITICAL SECTION}/ * Remainder section*/P1 :while (true) {turn_1 = true;while (turn_0 = = true)turn_1 = false;CRITICAL SECTION}/*Remainder section*/Here, turn_0 and turn_1 are shared variables, which are initialized to false. Which of the following statements is true about the above construct?a)It ensures mutual exclusion and prevents deadlock.b)It requires that processes enter the critical section in strict alternation.c)It does not ensure mutual exclusion.d)It ensures mutual exclusion but cannot prevent deadlock.Correct answer is option 'C'. Can you explain this answer? has been provided alongside types of Consider the following synchronization construct used by two process P0 and P1 which need to access a critical section:P0 :while (true) {turn_0 = true;while (turn_l = = true)turn_0 = false;CRITICAL SECTION}/ * Remainder section*/P1 :while (true) {turn_1 = true;while (turn_0 = = true)turn_1 = false;CRITICAL SECTION}/*Remainder section*/Here, turn_0 and turn_1 are shared variables, which are initialized to false. Which of the following statements is true about the above construct?a)It ensures mutual exclusion and prevents deadlock.b)It requires that processes enter the critical section in strict alternation.c)It does not ensure mutual exclusion.d)It ensures mutual exclusion but cannot prevent deadlock.Correct answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider the following synchronization construct used by two process P0 and P1 which need to access a critical section:P0 :while (true) {turn_0 = true;while (turn_l = = true)turn_0 = false;CRITICAL SECTION}/ * Remainder section*/P1 :while (true) {turn_1 = true;while (turn_0 = = true)turn_1 = false;CRITICAL SECTION}/*Remainder section*/Here, turn_0 and turn_1 are shared variables, which are initialized to false. Which of the following statements is true about the above construct?a)It ensures mutual exclusion and prevents deadlock.b)It requires that processes enter the critical section in strict alternation.c)It does not ensure mutual exclusion.d)It ensures mutual exclusion but cannot prevent deadlock.Correct answer is option 'C'. Can you explain this answer? tests, examples and also practice GATE tests.
Explore Courses for GATE exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev