Need ABCD
Allocation Work:=Work+ Allocation[i]
ABCD ABCD
Order
P1
2121
1100 3011 5132
②
P2
5132
0112 0100 5232
③
P3
5232
3100 1110 6342
④
P4
1020
0010 1101 2121
①
P5
6342
2110 0000 6342
• (1) 系统此时处于安全状态吗? • (2) 若此时P2发出request1(1, 2, 2, 2),系统能分配资源给它吗?
为什么?
Process
P0 P1 P2 P3 P4
Allocation ABCD 0032 1000 1354 0332 0014
MAX ABCD 0044 2750 3 6 10 10 0984 0 6 6 10
售票; wait(s2); 开车门; 上下乘客; }
}
11
s1:表示是否允许司机起动车辆, s2:表示是否允许售票员开门
Semaphore s1=0; Semaphore s2=0; main() {parbegin
driver(); conductor(); parend; }
driver() {while(1)
24
25
思考题
一个四道作业的操作系统中,设在一段时间内先后到达 6个作业,它们的提交时间和运行时间见表
作业号
提交时间
运行时间
JOB1
8:00
60
JOB2
8:20
35
JOB3