search
Log In
1 vote
338 views

in Operating System
edited by
338 views
0
option C. We can get deadlock
0
how??
0
is not it peterson's solution??which is Mutual exclusive ..so C
0
Both process arrive at the while loop at the same time
0
If both process arrive at while loop simultaneously then one while loop will definitely be false because turn value will be either i or j

isnt it???
0
process I()

{

   while(turn == j    &&  flag[j] ==true)

}

 

process J()

{

   while(turn == i    &&  flag[i] ==true)

}
0

@Sushant Gokhale 

is it Peterson solution ?

1 Answer

2 votes

Option (b) 

The process that executes statement-2 last will always be the first one to enter the CS.

 

Related questions

2 votes
1 answer
1
318 views
Consider the below code for synchronizing the classical readers and writers. int rc = 0; int c = 0; Semaphore mutex =1; Semaphore db =1; void Reader(void) { L1: down (mutex): if (c ! = 0 && rc! = 0) { up (mutex); goto L1; } else { rc = rc + 1 ... for both reader and writer accessing the database at the same time. c) more than one writers can access the database at the same time. d) None of these.
asked Jan 16, 2019 in Operating System shaz 318 views
1 vote
0 answers
3
289 views
Consider the following 2 functions P and Q which share 2 common variables A and B: P() Q() { { A=A+5; A=B+6; B=A-3; B=A-2; } } If P and Q execute concurrently, the initial value of A=2 and B=3 then the sum of all different values that B can take ____ (do not count B=3) Why have they taken intermediate values of B like 4..? :/
asked Jan 2, 2019 in Operating System MiNiPanda 289 views
0 votes
1 answer
4
172 views
The definition of progress is: When no process is in the critical section and another process wants to enter the critical section, then it should be allowed without any delay Suppose we do a context switch from 1 to 2 after executing Wait(P). Now the second ... is no process in the critical section, the second process is unable to enter the critical section. How does this achieve progress then?
asked Dec 21, 2018 in Operating System Gokulnath 172 views
...