我刚刚得到了一个问题,但提到的答案似乎令人困惑。最大。进程数量可以在其临界区域
Que.- Each Process Pi, i=1....9 is coded as follows
repeat
P(mutex)
{Critical section}
V(mutex)
forever
The code for P10 is identical except it uses v(mutex) in place of p(mutex). What is the largest number of processes that can be inside the critical section at any moment.
a) 1 b) 2 c) 3 d) None
我相信答案可以是3作为裨的任一项(i = 1至9)可以在它的CS。一旦处理器上下文切换到P10,它就会发出一个互斥信号,它可以从Pi的另一个进程(i = 1..9)转到CS。
但是提到的答案是2.请建议。
感谢
谢谢,我以相同的方式计算出来。忘记将答案放在这里 – codeomnitrix
@ user2129312如果互斥量的值为0,则p10或任何其他进程不允许在CS中输入。 – akashchandrakar
p10在两个地方都会有V(mutex)我们误读了这个地方 – AAB