begin
var Smutex=
SCarCount=
cobegin
process Scari(i=
begin
p(Smutex);
if(SCarCount=
SCarCount=SCarCount+
v(Smutex);
過橋
p(Smutex);
SCarCount=SCarCount
if(SCarCount=
v(Smutex);
end
process Ncarj(j=
begin
p(Nmutex);
if(NCarCount=
NCarCount=NCarCount+
v(Nmutex);
過橋
p(Nmutex);
NCarCount=NCarCount
if(NCarCount=
v(Nmutex);
end
coend
end
返回《操作系統之PV金典》
[
From:http://tw.wingwit.com/Article/program/czxt/201311/24217.html