操作系统英文版课后习题答案整理.doc
《操作系统英文版课后习题答案整理.doc》由会员分享,可在线阅读,更多相关《操作系统英文版课后习题答案整理.doc(14页珍藏版)》请在冰豆网上搜索。
![操作系统英文版课后习题答案整理.doc](https://file1.bdocx.com/fileroot1/2022-10/4/72658c69-e89e-4647-b345-4ec43de00f86/72658c69-e89e-4647-b345-4ec43de00f861.gif)
14
OSExerciseBook
ClassNo.Name
1.1Whatarethethreemainpurposesofanoperatingsystem?
(1)Interfacebetweenthehardwareanduser;
(2)managetheresourceofhardwareandsoftware;
(3)abstractionofresource;
1.2Listthefourstepsthatarenecessarytorunaprogramonacompletelydedicatedmachine.
Preprocessing>Processing>Linking>Executing.
1.6Definetheessentialpropertiesofthefollowingtypesofoperatingsystems:
a.Batch
b.Interactive
c.Timesharing
d.Realtime
e.Network
f.Distributed
1.7Wehavestressedtheneedforanoperatingsystemtomakeefficientuseofthecomputing
hardware.Whenisitappropriatefortheoperatingsystemtoforsakethisprincipleandto“waste”resources?
Whyissuchasystemnotreallywasteful?
2.2Howdoesthedistinctionbetweenmonitormodeandusermodefunctionasarudimentary
formofprotection(security)system?
2.3Whatarethedifferencesbetweenatrapandaninterrupt?
Whatistheuseofeachfunction?
2.5Whichofthefollowinginstructionsshouldbeprivileged?
a.Setvalueoftimer.
b.Readtheclock.
c.Clearmemory.
d.Turnoffinterrupts.
e.Switchfromusertomonitormode.
2.8Protectingtheoperatingsystemiscrucialtoensuringthatthecomputersystemoperates
correctly.Provisionofthisprotectionisthereasonbehinddual-modeoperation,memory
protection,andthetimer.Toallowmaximumflexibility,however,wewouldalsoliketo
placeminimalconstraintsontheuser.
Thefollowingisalistofoperationsthatarenormallyprotected.Whatistheminimalset
ofinstructionsthatmustbeprotected?
a.Changetousermode.
b.Changetomonitormode.
c.Readfrommonitormemory.
d.Writeintomonitormemory.
e.Fetchaninstructionfrommonitormemory.
f.Turnontimerinterrupt.
g.Turnofftimerinterrupt.
3.6Listfiveservicesprovidedbyanoperatingsystem.Explainhoweachprovidesconveniencetotheusers.Explainalsoinwhichcasesitwouldbeimpossibleforuser-levelprogramstoprovidetheseservices.
3.7Whatisthepurposeofsystemcalls?
3.10Whatisthepurposeofsystemprograms?
4.1MS-DOSprovidednomeansofconcurrentprocessing.Discussthreemajorcomplications
thatconcurrentprocessingaddstoanoperatingsystem.
4.6Thecorrectproducer–consumeralgorithminSection4.4allowsonlyn-1bufferstobe
fullatanyonetime.Modifythealgorithmtoallowallbufferstobeutilizedfully.
5.1Providetwoprogrammingexamplesofmultithreadinggivingimproveperformanceover
asingle-threadedsolution.
5.3Whataretwodifferencesbetweenuser-levelthreadsandkernel-levelthreads?
Underwhatcircumstancesisonetypebetterthantheother?
6.3Considerthefollowingsetofprocesses,withthelengthoftheCPU-bursttimegivenin
milliseconds:
Process Burst TimePriority
P1 10 3
P2 1 1
P3 2 3
P4 1 4
P5 5 2
TheprocessesareassumedtohavearrivedintheorderP1,P2,P3,P4,P5,allattime0.
a.DrawfourGanttchartsillustratingtheexecutionoftheseprocessesusingFCFS,SJF,anonpreemptivepriority(asmallerprioritynumberimpliesahigherpriority),andRR
(quantum=1)scheduling.
b.Whatistheturnaroundtimeofeachprocessforeachoftheschedulingalgorithmsin
parta?
c.Whatisthewaitingtimeofeachprocessforeachoftheschedulingalgorithmsinpart
a?
d.Whichoftheschedulesinpartaresultsintheminimalaveragewaitingtime(overall
processes)?
Answer:
6.4Supposethatthefollowingprocessesarriveforexecutionatthetimesindicated.Each
processwillrunthelistedamountoftime.Inansweringthequestions,usenonpreemptive
schedulingandbasealldecisionsontheinformationyouhaveatthetimethedecision
mustbemade.
a.WhatistheaverageturnaroundtimefortheseprocesseswiththeFCFSscheduling
algorithm?
b.WhatistheaverageturnaroundtimefortheseprocesseswiththeSJFschedulingalgorithm?
c.TheSJFalgorithmissupposedtoimproveperformance,butnoticethatwechoseto
runprocessP1attime0becausewedidnotknowthattwoshorterprocesseswould
arrivesoon.ComputewhattheaverageturnaroundtimewillbeiftheCPUisleft
idleforthefirst1unitandthenSJFschedulingisused.RememberthatprocessesP1
andP2arewaitingduringthisidletime,sotheirwaitingtimemayincrease.This
algorithmcouldbeknownasfuture-knowledgescheduling.
6.10Explainthedifferencesinthedegreetowhichthefollowingschedulingalgorithmsdiscriminateinfavorofshortprocesses:
a.FCFS
b.RR
c.Multilevelfeedbackqueues
7.7Showthat,ifthewaitandsignaloperationsarenotexecutedatomically,
thenmutualexclusionmaybeviolated.
7.8TheSleeping-BarberProblem.