S:semaphore=1; 盘子是否为空 S1:semaphore=0; 是否有苹果 S2
:semaphore=0; 是否有橘子 Process Father: Begin: L1: P(S);
Put Apple;
V(S1); GO TO L1; End; Process Mother: Begin:
L2: P(S); Put Orange; V(S2); GO TO L2; End;
Process Son: Begin: L3: P(S2); Get Orange; V(S);
GO TO L1; End; Process Daughter: Begin: L4: P(S1);
Get Apple; V(S); GO TO L4; End;