1,256 views
0 votes
0 votes

if mutual conditiion holds there will no race condition

is there any case where mutual exclusion doesnt hold and there is no race condition

i want to know if mutual exclusion and race condition are dependent on each other or independent

1 Answer

0 votes
0 votes

Race condition is when output depends on the order of execution of processes.

Suppose we have two processes sharing variable:

counter = 5

P1()

{

Critical Section

if counter == 6

    exit;  

counter --;

}

P2()

{

Critical section

if counter == 4

    exit;

counter ++;

}

If p1 is executed before p2 then value of counter = 4 

If p2 is executed before p1 then value of counter = 6

We have mutual exclusion in critical section but still race condition exists.

From Wikipedia: Race condition becomes a bug when events do not happen in the order the programmer intended.

But above needed that race condition.

Related questions

0 votes
0 votes
2 answers
1
student2018 asked Apr 12, 2017
873 views
If mutual exclusion is satisfied then race condition is satisfied or not
0 votes
0 votes
1 answer
3
Sanjay Sharma asked Nov 4, 2016
683 views
0 votes
0 votes
0 answers
4
Sanjay Sharma asked Oct 31, 2016
507 views
how race condition is resolved in master slave flip flops if we having rs master slave flip flop then what will be the output of master flip flop when both inputs are 1 o...