Processes P1 and P2 use critical_flag in the following routine to achieve…

GATE · 2007 · IT

Processes P1 and P2 use critical_flag in the following routine to achieve mutual exclusion. Assume that critical_flag is initialized to FALSE in the main program.

get_exclusive_access ( )
{
    if (critical _flag == FALSE) {
        critical_flag = TRUE ;
        critical_region () ;
        critical_flag = FALSE;
    }
}

Consider the following statements.

i. It is possible for both P1 and P2 to access critical_region concurrently.

ii. This may lead to a deadlock.

Which of the following holds?

  1. A.

    (i) is false and (ii) is true

  2. B.

    Both (i) and (ii) are false

  3. C.

    (i) is true and (ii) is false

  4. D.

    Both (i) and (ii) are true

Attempted by 376 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…