Homework 4 Version 0 |
|
👤 Author: by 871257367qqcom 2019-10-10 03:31:45 |
There are four factory assembly lines. AB assembly lines produce raw material A0 and B0,then put them in a transit warehouse. C and D assembly lines use the raw material continue to produce. Assembly line C uses A0,D uses B0.
S, S1, S2 :semaphore=1,0,0;
Cobegin:
Process A:
Begin:
L1: P(S);
Put A0;
V(S1);
GO TO L1;
End;
Process B:
Begin:
L2: P(S);
Put B0;
V(S2);
GO TO L2;
End;
Process C:
Begin:
L3: P(S2);
Get A0;
V(S);
GO TO L1;
End;
Process D:
Begin:
L4: P(S1);
Get B0;
V(S);
GO TO L4;
End;
CoEnd;