In: Computer Science
1. Find out what a race condition is, and explain in your own words what goes wrong.
As you can see in the example i assume here b=1 and c=2 as a resouces and there are two prcoesses P1 and P2 and each of this process will execute states in given manner.
p1 will execute stat1() first and then execute state2()
p2 will execute stat2() first and then execute state1()
we assume that process p1 execute first to check what output comes
p1
****
state1() = b=2+1 = 3 so b=3 // value of b is now updated
state2() = c=3+2 = 5 so c=5
p2
****
state2() = c=1+2 = 3 so c=3 // value of c is now updated
state1() = b=1+3 = 4 so b=4
as you can compare if any process whose execution turn is at 2nd position and it execute 1st the output will be changed.
if you have any doubt then please ask me without any hesitation in the comment section below , if you like my answer then please thumbs up for the answer , before giving thumbs down please discuss the question it may possible that we may understand the question different way and we can edit and change the answers if you argue, thanks :)