大门|大门-CS-2001 |问题47

考虑彼得森在两个并行进程i和j之间互斥的算法。

null
   repeat   
      flag [i] = true; 
      turn = j; 
      while ( P ) do no-op; 
      Enter critical section, perform actions, then exit critical 
      section 
      flag [ i ] = false; 
      Perform other non-critical section actions. 
   until false; 

对于保证互斥的程序,while循环中的谓词P应该是。 (A) flag[j]=true,turn=i (B) flag[j]=true,turn=j (C) flag[i]=true,turn=j (D) flag[i]=true,turn=i 答复: (B) 说明: 见本报告问题2 https://www.geeksforgeeks.org/operating-systems-set-2/ 这个问题的小测验

© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享