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

2 Answers

1 votes
1 votes
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.
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