in Operating System
926 views
0 votes
0 votes
How the lock variable software synchronization mechanism guarantee that deadlock can never happen in lock variable??
in Operating System
926 views

2 Answers

1 vote
1 vote
Lock variable synchronization mechanism failed because reading and modifying the the lock variable isn't an atomic operation; so more than one process can read the value of lock variable as 0(i.e. 0 denotes critical section is unoccupied) and enter into the critical section by making the lock value as 1. Hence lock variable doesn't guarantee mutual exclusion. As mutual exclusion is one of the necessary conditions for deadlock to happen, so lock mechanism guarantees that deadlock can't happen as mutual exclusion isn't provided.

4 Comments

The restriction is that entry section of the processes have to be same.. So in lock mechanism, entry section of the processes are all same. So in this case can we say that no mutual exclusion implies no deadlock?
0
0
yes....
0
0
Ok got it..thanks :)
0
0
0 votes
0 votes
1. lock variable is a sowfware mechanism implement in user mode.

2. Busy waiting solution (in this busy waiting occur)

3.can be used even for more then two process

But lock variable does'n gurantee mutual exclusion means two or more process can simultaneously enter into critical section.As mutual exclusion is one of the necessary conditions for deadlock to happen, so lock mechanism guarantees that deadlock can't happen as mutual exclusion isn't provided.

Related questions