Critical section problem

Posted by ambiance on Stack Overflow See other posts from Stack Overflow or by ambiance
Published on 2010-06-16T16:29:07Z Indexed on 2010/06/16 16:32 UTC
Read the original article Hit count: 221

Filed under:
|
proces P0:                             proces P1:
while (true)                           while (true)
{                                      {
  flag[0] = true;                          flag[1] = true;
  while (flag[1])                          while (flag[0])
  {                                        {
     flag[0] = false;                        flag[1] = false;
     flag[0] = true;                         flag[1] = true;
  }                                        }
 crit0();                                  crit1();
 flag[0] = false;                          flag[1] = false;
 rem0();                                   rem1();
}                                       }

Can someone give me a scenario with context switches to prove if the above stated code meets the requirements of progress and bounded waiting.

And can anyone give me some tips about how to detect if a code meets the requirements of progress or bounded waiting(and maybe including starvation,deadlock and after-you after you)

© Stack Overflow or respective owner

Related posts about os

Related posts about critical-section