Teaching HPSC Lecturer (Technical) Mock Test 2024 Operating Systems Concurrency and Synchronization Operating System Solution
Lets there are many processes. To implement mutual exclusion following code is used.
do
{
key = true;
while (key == true)
swap(lock, key);
lock = false;
}while(1);
Mutual exclusion will be done if
1
lock is shared variable initialized to true
2
lock is local to all process and is initialized to false whereas key is shared
3
lock is shared variable, key is shared variable and lock is initialized to true
4
lock is shared variable and is initialized to false, key is local to each process.
5
Question Not Attempted