《计算机等级考试操作系统考试大纲.ppt》由会员分享,可在线阅读,更多相关《计算机等级考试操作系统考试大纲.ppt(36页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、上机作业:进 程 调 度,1 设计一个进程控制块PCB包括:进程名、进程优先数、进程所占cpu时间、还需要CPU时间、进程状态、下一列指针2 建立进程就绪队列3 编制两个调度算法(1)时间片轮转法(2)优先数算法 优先数 = 50 - 运行时间 每运行一次优先数减3,1 时间片轮转法运行结果:input name and needtime:a1 3a2 2a3 4a4 2a5 1,Name cputime needtime count round state a1 0 3 0 2 R a2 0 2 0 2 W a3 0 4 0 2 W a4 0 2 0 2 W a5 0 1 0 2 W就绪队列
2、:a2、a3、a4、a5完成队列:,Name cputime needtime count round state a2 0 2 0 2 R a3 0 4 0 2 W a4 0 2 0 2 W a5 0 1 0 2 W a1 2 1 1 2 W就绪队列:a3、a4、a5 、a1完成队列:,Name cputime needtime count round state a3 0 3 0 2 R a4 0 2 0 2 W a5 0 4 0 2 W a1 2 1 1 2 W a2 2 0 1 2 F就绪队列:a4、a5 、a1完成队列:a2,Name cputime needtime count r
3、ound state a1 3 0 0 2 F a2 2 0 0 2 F a3 4 0 0 2 F a4 2 0 0 2 F a5 1 0 0 2 F就绪队列:完成队列:a2、a4、a5、a1、a3,2 优先数算法运行结果:input name and needtime:a1 3a2 2a3 4a4 2a5 1,Name cputime needtime count pri state a5 0 1 0 49 R a2 0 2 0 48 W a4 0 2 0 48 W a1 0 3 0 47 W a3 0 4 0 46 W就绪队列:a2、a4、a1、a3完成队列:,Name cputime n
4、eedtime count pri state a2 0 2 0 48 R a4 0 2 0 48 W a1 0 3 0 47 W a3 0 4 0 46 W a5 1 0 1 49 f就绪队列:a4、a1、a3 完成队列:a5,Name cputime needtime count pri state a4 0 2 0 48 R a1 0 3 0 47 W a3 0 4 0 46 W a2 1 1 1 45 W a5 1 0 1 49 F就绪队列:a1、a3 、a2完成队列:a5,Name cputime needtime count pri state a1 0 3 0 47 R a3 0
5、 4 0 46 W a2 1 1 1 45 W a4 1 1 1 45 W a5 1 0 1 49 F就绪队列:a3、a2 、a4完成队列:a5,Name cputime needtime count pri state a5 1 0 0 49 F a2 2 0 0 45 F a4 2 0 0 45 F a1 3 0 0 41 F a4 4 0 0 37 F就绪队列:完成队列:a5、a2、a4、a1、a3,存储管理分区分配算法,建立分区描述区建立自由主存队列针对不同的放置策略建立相应队列结构编写分区分配算法编写分区回收算法,最佳适应法:运行结果,* adr * end * size1 0 32
6、766 32767input the way (best or first):bestAssign or Accept: asinput APPLACATION: 30000SUCCESS! ADDRESS=2767,Index * adr * end * size 1 0 2766 2767Assign or Accept: acInput adr and size:3000 2767,Index * adr * end * size 1 0 2766 2767 2 3000 5766 2767Assign or Accept : acInput adr and size: 8000 400
7、0,Index * adr * end * size 1 0 2766 2767 2 3000 5766 2767 3 8000 11999 4000Assign or Accept :ac Input adr and size: 2767 10,Index * adr * end * size 1 3000 5766 2767 2 0 2776 2777 3 8000 11999 4000Assign or Accept: asinput APPLACATION: 3000SUCCESS! ADDRESS=9000,Index * adr * end * size 1 8000 11999
8、1000 2 3000 5766 2767 3 0 2776 2777 Assign or Accept: asinput APPLACATION: 3000Too large application!,首次适应法:运行结果,* adr * end * size1 0 32766 32767input the way (best or first): firstAssign or Accept: asinput APPLACATION: 30000SUCCESS! ADDRESS=2767,Index * adr * end * size 1 0 2766 2767 Assign or Acc
9、ept: acInput adr and size:3000 2767,Index * adr * end * size 1 0 2766 2767 2 3000 5766 2767 Assign or Accept : acInput adr and size: 8000 4000,Index * adr * end * size 1 0 2766 2767 2 3000 5766 2767 3 8000 11999 4000Assign or Accept :ac Input adr and size: 2767 10,Index * adr * end * size 1 0 2776 2
10、777 2 3000 5766 2767 3 8000 11999 4000Assign or Accept: asinput APPLACATION: 3000SUCCESS! ADDRESS=9000,Index * adr * end * size 1 0 2776 2777 2 3000 5766 2767 3 8000 8999 1000Assign or Accept: asinput APPLACATION: 3000Too large application!,银行家算法,实现银行家算法实现安全性算法,运行结果,Input the type of resource and nu
11、mber of customer:3 5Input the amount of resource (maximum , allocated) of each customer:P0 7,5,3 0,1,0P1 3,2,2 2,0,0 P2 9,0,2 3,0,2P3 2,2,2 2,1,1P4 4,3,3 0,0,2,1、judge the system security2、judge the request security3、quit,1,Work Need Allocation Work+ Allocation FinishP1 3 3 2 1 2 2 2 0 0 5 3 2 TP3 5
12、 3 2 0 1 1 2 1 1 7 4 3 TP4 7 4 3 4 3 1 0 0 2 7 4 5 TP2 7 4 5 6 0 0 3 0 2 10 4 7 TP0 10 4 7 7 4 3 0 1 0 10 5 7 TSYSTEM SECURITY!,1、judge the system security2、judge the request security3、quit,2,Please input the customers name and request:p1 1 0 2,Work Need Allocation Work+ Allocation FinishP1 2 3 0 0
13、2 0 3 0 2 5 3 2 TP3 5 3 2 0 1 1 2 1 1 7 4 3 TP4 7 4 3 4 3 1 0 0 2 7 4 5 TP0 7 4 5 7 4 3 0 1 0 7 5 5 TP2 7 5 5 6 0 0 3 0 2 10 5 7 TSYSTEM SECURITY!CUSTOMER P1 CAN GET RESOURCES IMMEDIATELY.,1、judge the system security2、judge the request security3、quit,2,Please input the customers name and request:p4 3 3 0RESOURCE INSUFFICIENT!CUSTOMER P4 CAN NOT OBTAIN RESOURCES IMMEDIATELY.,1、judge the system security2、judge the request security3、quit,2,Please input the customer name and request:p0 0 2 0SYSTEM INSECURITY!CUSTOMER P0 CAN NOT OBTAIN RESOURCES IMMEDIATELY.,
限制150内