操作系统概论大题集中呢营考点(绝对无毒).doc

上传人:本田雅阁 文档编号:2106473 上传时间:2019-02-14 格式:DOC 页数:16 大小:17.04KB
返回 下载 相关 举报
操作系统概论大题集中呢营考点(绝对无毒).doc_第1页
第1页 / 共16页
操作系统概论大题集中呢营考点(绝对无毒).doc_第2页
第2页 / 共16页
操作系统概论大题集中呢营考点(绝对无毒).doc_第3页
第3页 / 共16页
亲,该文档总共16页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《操作系统概论大题集中呢营考点(绝对无毒).doc》由会员分享,可在线阅读,更多相关《操作系统概论大题集中呢营考点(绝对无毒).doc(16页珍藏版)》请在三一文库上搜索。

1、1. 1FCFS2/SJF3CPUCPU4+R= =562. =-84/minJob1 8:00 60 1Job2 8:30 50 2Job3 8:40 30 4Job4 8:50 10 3,| /min | /min |Job1| 8:00 | 60 | 8:00 | 9:00 | 60 | 1Job2| 8:30 | 50 | 9:40 | 10:30 | 120 | 2.4Job3| 8:40 | 30 | 9:00 | 9:30 | 50 | 1.67Job4| 8:50 | 10 | 9:30 | 9:40 | 50 | 5T=(60+120+50+50)/4=70W=(1+2.4+

2、1.67+5)/4=2.52J18:009J2J3J4J1J1CPUJ3J2J4J3J4CPUJ2| /min | /min |Job1| 8:00 | 60 | 8:00 | 10:30 | 150 | 2.5Job2| 8:30 | 50 | 8:30 | 10:00 | 90 | 1.8Job3| 8:40 | 30 | 8:40 | 9:10 | 30 | 1Job4| 8:50 | 10 | 9:10 | 9:20 | 30 | 3T=(150+90+30+30)/4=75W=(2.5+1.8+1+3)/4=2.075174SJFSRTF10:05J1J2J2|/min |/minJ

3、ob1| 10:00 | 30 | 10:00 | 11:05 | 65Job2| 10:05 | 20 | 10:05 | 10:25 | 20Job3| 10:10 | 5 | 10:25 | 10:30 | 20Job4| 10:20 | 10 | 10:30 | 10:40 | 20T=(65+20+20+20)/4=31.25W=(65/30+20/20+20/5+20/10)/4=2.29251:1. int B;2. semaphore empty;/3. semaphore full;/4. empty=1;/5. full=0;/6. cobegin7. process pr

4、oducer() process consumer()8. while(true) while(true) 9. produce( ); P(full);10. P(empty); take( ) from B;11. append( ) to B; V(empty);12. V(full); consume( );13. 14. 1. item Bk;2. semaphore empty; empty=k;/3. semaphore full; full=0;/4. semaphore mutex; mutex=1;/5. int in=0;/6. int out=0;/7. cobegin

5、8. process producer_i ( ) process consumer_j ( )9.while(true) while(true)10. produce( );P(full);11. P(empty);P(mutex);12.P(mutex); take( ) fromBout;13. append to Bin;out=(out+1)%k;14. in=(in+1)%k;V(mutex);15. V(mutex);V(empty);16. V(full);consume( );17. 18. 19. coend21. intreadcount=0;/2. semaphore

6、writeblock,mutex;3. writeblock=1;mutex=1;4. cobegin5. process reader_i( )6. P(mutex);7. readcount+;8. if(readcount=1)9. P(writeblock);10. 11. V(mutex);12. ;13. P(mutex);process writer_j( )P(writeblock);V(writeblock);14. readcount-;15. if(readcount=0)16. V(writeblock);17. V(mutex);18. (patil, 19713PV

7、Semaphoreempty=1,full1=full2=full3=0;/full1full2,full3process producer()P(empty);if(paper& match)V(full1);/elseif(paper&)Vfull2elseV(full3)processPfull1;paper &matchV(empty);processPfull1;paper &V(empty);processpaperPfull1;&matchV(empty);20.PiQjRkPiQjM1buf1QjRkM2buf2Pibuf1,Qjbuf2Rk.PV(0)int c1=c2=0;

8、Semaphore empty1=k,empty2=m,full1=full2=0,mutex1=mutex2=1;process Pi()Pempty1;P(mutex1);c1+;if(c1=2)c1=0;V(full1);V(mutex1);process Qj()P(full1)P(mutex1);V(mutex1);V(empty1);V(empty1);Pempty2Pmutex2;c2+;if(c2=3)c2=0;V(full2);V(mutex2);Process Rk()P(full2)P(mutex1);3;V(mutex2);V(empty2);V(empty2);V(e

9、mpty2);28.Available(1,1,2)Claim AllocationR1R2R3 R1R2R3P1 322 100P2 613 511P3 314 211P4 422 002(1)Cki-Aki(2)(3)P2request2(0,0,1),(4)P2P1request1(1,0,1),(5)P1P3request3(0,0,1),:(1)Need=Cki-Aki,Claim Allocation Need AvailablerR1R2R3 R1R2R3 R1R2R3 1 1 2P1 322100 222P2 613511 102P3 314211 103P4 422002 4

10、20:(2)P2P1P3P4Claim Allocation Need AvailablerR1R2R3 R1R2R3 R1R2R3 1 1 2P1 322100 222 623P2 613511 102 723P3 314211 103 934P4 422002 420 9361,1,2,P2,P2Available=(1,1,2)+5,1,1=6,2,3AvailableP2P1P3P4:(3)P2P1P3P4request2(0,0,2)1,1,2,2P2P1P3P4(4)(5)36.1PVSemaphore lmutex=rmutex=1,bridge=0;int lcar=rcar=

11、0;process lcar()P(lmutex);lcar+;P(bridge);V(lmutex);if (lcar=1);P(lmutex);lcar-;if(lcar=0) V(bridge)V(lmutex);process rcar()P(rmutex);rcar+;P(bridge);V(rmutex);if (rcar=1);P(rmutex);rcar-;if(rcar=0) V(bridge)V(rmutex);37.21k.PVSemaphorelmutex=rmutex=1,bridge=0mutex=k;int lcar=rcar=0;process lcar()P(

12、lmutex);lcar+;P(bridge);V(lmutex);if (lcar=1)P(mutex);V(mutex);P(lmutex);lcar-;if(lcar=0) V(bridge)V(lmutex);process rcar()P(rmutex);rcar+;P(bridge);V(rmutex);if (rcar=1)P(mutex);V(mutex);P(rmutex);rcar-;if(rcar=0) V(bridge)V(rmutex);44.Apple,Semaphoreempty1=1,full1=full2=0;/full1full2process Father

13、()P(empty);V(full1);/process Mother()P(empty);V(full2);/process Daugther()P(full1)V(empty);process Son()P(full2)V(empty);45.Apple,Semaphore empty1=k,empty2=m,full1=full2=0,mutex1=mutex2=1;/full1full2process Father()P(empty1);P(mutex1);V(mutex1);V(full1);/process Mother()P(empty2);P(mutex2)V(mutex2);

14、V(full2);/process Daugther()P(full1)P(empty1)V(empty1)V(mutex1);process Son()P(full2)P(empty2)V(empty2)V(mutex2);1) OPT2) FIFO3) LRULFU4) SCR5) Clock11006cachecache20nscache60ns12us60nscachecache0.90.6ns)tatctmth,htc+tm:tc+2tmta=hctc+(1-hc)hm(tc+tm)+(1-hm)(2tc+2tm+th)ta=506ns0,430430600219+430=649.1

15、51640962F6AH0121012141640961242F6AH0010 1 1 11 0110 1010214EF6AH=8kb133,18F6AH.9000=*+=So,PA=14*4096+808=58152.31.46055,20,108,180,79,310170,255,246,433,488,369(1)100(2)200FIFOLRU(1)1000,0,1,1,03,1,2,2,4 ,4,3.(2)m=2FIFOLRUm=2FIFO LRU0 0 1 1 0 3 1 2 2 4 4 30 0 1 1 0 3 1 2 2 4 4 30 0 1 1 1 3 3 2 2 4 4

16、30 0 1 1 0 3 1 2 2 4 4 30 0 0 1 1 3 3 2 240 0 1 0 3 1 1 2 2 46/12=50%6/12=50%47m=4,FIFOLRU1.2.SSTF()3.FCFS4.SCAN5.6. 120V2012(112020(22011t=10ms12ms41818ms22010 + 3 + ( l + 2 + 18 ) *19 = 13 + 2 1 * 19 =412ms2201 , 8 , 15 , 2 , 9 , 16 , 3 , 10 , 17 , 4 ,11, 18, 5 , 12 , 19 , 6,13,20,7, 1412ms22010+3+3*19=13+57=70ms .t1=1+2=3ms;t2=18*1+3=21ms,t=t1+19t2+t=412mst=20t1+t=70ms.()7200O- 19914312586, 147 , 91 , 177 , 94, 150 , 102 , 175 , 130(1FCFS;(2SSTF(3SCAN(4(l

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1