大连交大os第二章作业.doc

上传人:b****2 文档编号:1643044 上传时间:2022-10-23 格式:DOC 页数:3 大小:59.50KB
下载 相关 举报
大连交大os第二章作业.doc_第1页
第1页 / 共3页
大连交大os第二章作业.doc_第2页
第2页 / 共3页
大连交大os第二章作业.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

大连交大os第二章作业.doc

《大连交大os第二章作业.doc》由会员分享,可在线阅读,更多相关《大连交大os第二章作业.doc(3页珍藏版)》请在冰豆网上搜索。

大连交大os第二章作业.doc

第二章作业

14.What’sthebiggestadvantageofimplementingthreadinuserspace?

What’sthebiggestdisadvantage?

Solution:

Thefirstadvantageisthatauser-levelpackagecanbeimplementedonanoperatingsystemthatdoesnotsupportthreads.Thesecondadvantageisthattheyalloweachprocesstohaveitsowncustomizedschedulingalgorithm.

Thedisadvantageistheproblemofhowblockingsystemcallsareimplemented.Anotherproblemisthatifathreadstartsrunning,nootherthreadinthatprocesswilleverrununlessthefirstthreadvoluntarilygivesuptheCPU.

35.MeasurementsofcertainsystemhaveshownthattheaverageprocessrunsforatimeTbeforeblockingonI/O.AprocessswitchrequiresatimeS,whichiseffectivelywasted(overhead).Forround-robinschedulingwithquantumQ,giveaformulafortheCPUefficiencyforeachofthefollowing:

(a)Q=∞CPUefficiency=T/(T+S)

(b)Q>TCPUefficiency=T/(T+S)

(c)S

(d)Q=SCPUefficiency=50%

(e)Qnearly0CPUefficiencyisnearly0

36.Fivejobsarewaitingtoberun.Theirexpectedruntimesare9,6,3,5,andX.Inwhatordershouldtheyberuntominimizeaverageresponsetime?

(YouranswerwilldependonX.)

Solution:

IF(X<=3):

X,3,5,6,9

IF(X>=3ANDX<=5):

3,X,5,6,9

IF(X>=5ANDX<=6):

3,5,X,6,9

IF(X>=6ANDX<=9):

3,5,6,X,9

IF(X>=9):

3,5,6,9,X

37.FivebatchjobsAthroughE,arriveatacomputercenteratalmostthesametime.Theyhaveestimatedrunningtimesof10,6,2,4,and8minutes.Their(externallydetermined)prioritiesare3,5,2,1,and4,respectively,with5beingthehighestpriority.Foreachofthefollowingschedulingalgorithms,determinethemeanprocessturnaroundtime.Ignoreprocessswitchingoverhead.

(a)Roundrobin

(b)Priorityscheduling

(c)First-come,first-served(runinorder10,6,2,4,8)

(d)Shortestjobfirst

For(a),assumethatthesystemismultiprogrammed,andthateachjobgetsitsfairshareoftheCPU.For(b)through(d)assumethatonlyonejobatatimeruns,untilitfinishes.AlljobsarecompletelyCPUbound.

Solution:

processes

Arrivaltime

Processingtime

priority

A

0

(1)

10

3

B

0

(2)

6

5(HIGH)

C

0(3)

2

2

D

0(4)

4

1

E

0(5)

8

4

(a)Roundrobin(quantum=2)

A

2

A

A

E

A

B

C

D

E

B

D

E

B

E

A

Turnaroundtime:

A:

10+6+2+4+8=30

B:

30-4*2=22

C:

2+2+2=6

D:

2*8=16

E:

30-2=28

Meanturnaroundtime=(30+22+6+16+28)/5=80/5=20.4

(b)priorityscheduling

6

A

C

B

E

D

8

10

2

4

Turnaroundtime:

A:

6+8+10=24

B:

6

C:

24+2=26

D:

26+4=30

E:

6+8=14

Meanturnaroundtime=(24+6+26+30+14)/5=100/5=20

(c)FCFS

10

C

D

A

B

E

6

2

4

8

Turnaroundtime:

A:

10

B:

10+6=16

C:

16+2=18

D:

18+4=22

E:

22+8=30

Meanturnaroundtime=(10+16+18+22+30)/5=96/5=19.2

(d)Shortedjobfirst

10

C

D

A

B

E

6

2

4

8

Turnaroundtime:

A:

2+4+6+8+10=30

B:

2+4+6=12

C:

2

D:

2+4=6

E:

2+4+6+8=20

Meanturnaroundtime=(30+12+2+6+20)/5=70/5=14

41.Asoftreal-timesystemhasfourperiodiceventswithperiodsof50,100,200,and250mseceach.Supposethatthefoureventsrequire35,20,10,andxmsecofCPUtime,respectively.Whatisthelargestvalueofxforwhichthesystemisschedulable?

Solution:

35/50+20/100+10/200+x/250<=1max(x)=12.5

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

当前位置:首页 > 表格模板 > 表格类模板

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1