pt = 0;
for(j = i;j < n;j++) { } if(t == 0) {
curtime = 1500; for(j = i;j < n;j ++) { }
for(j = i;j < n;j++) {
if(pro[j].btime <= curtime) {
if(curtime > pro[j].btime) { }
curtime = pro[j].btime; if(pro[j].btime <= curtime) { }
a[t++] = j;
}
}
}
}
}
a[t++] = j;
for(j = 0;j < t;j++) { } if(m != i) { }
curtime = curtime + pro[i].runtime; p = pro[m]; pro[m] = pro[i]; pro[i] = p; bt = a[j];
if(pro[bt].priority > pt) { }
pt = pro[bt].priority; m = bt;
4、 测试用例,运行结果与运行情况分析;
5.1测试用例:
① 进程个数为4 ② 进程名唯一
③ 预计运行结果: 先来先服务:c a d b 优先级法:c a b d
进程名 a b c d 进程到达时间 2:12 3:10 1:15 2:13 运行时间 34 31 21 11 优先级 2 3 1 2
5.2运行结果:
模拟一种处理机调度算法
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)