-1

if in peterson's algo, A process is preempted just after comming out of critical region before setting its flag to false. Then will not be there a deadlock. ?? plz help !

Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
Abhishek
  • 9
  • 1
  • 1
  • 5
    Not even proper sentences? Are you currently in an exam? – Shawn Mclean Jan 21 '11 at 20:56
  • Hi, and welcome to Stack Overflow, but unfortunately your question is too vague to answer completely. A deadlock requires at least 2 participants (strangely enough, those two participants can be the same one), that between themselves lock resources in the opposite order, and then end up waiting on each other. You need to post more information about the problem you're exhibiting and best of all, some code that demonstrates it. – Lasse V. Karlsen Jan 21 '11 at 20:58
  • Also, the sentence "Then will not be there a deadlock" is rather incomprehensible. Are you suggesting that there will or won't be a deadlock, or are you asking? If the latter, you're missing a question mark. – Lasse V. Karlsen Jan 21 '11 at 20:59
  • There may or may not be a deadlock. – IVlad Jan 21 '11 at 20:59
  • @IVlad, and there may or may not be a question here. – Lasse V. Karlsen Jan 21 '11 at 21:00

2 Answers2

2

No deadlock. That's why we all learn this theoretical algorithm at schools.

note: You can encounter deadlock anywhere if you do something wrong. But it is not caused by a bug or property of this algorithm.

Al Kepp
  • 5,831
  • 2
  • 28
  • 48
2

This cannot cause deadlock, because there is nothing that is blocking the process which just exited the critical section from proceeding.

Null Set
  • 5,374
  • 24
  • 37