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?
|
A (i) is false and (ii) is true
|
B
|
Both (i) and (ii) are false
|
C |
(i) is true and (ii) is false
|
D
|
Both (i) and (ii) are tru
|
|