MC
SJF scheduling is approximated by predicting the next CPU burst with an
exponential average of the measured lengths of previous CPU bursts.
Which of the following scheduling algorithms must be nonpreemptive? FCFS
What method can be used to prevent a starvation condition? Aging can be used to gradually
increase the priority of a process.
Load balancing is typically only necessary on: Systems with a separate queue for every
processor.
The necessary condition(s) for deadlock is ,
a) At least one resource must be held in a nonsharable mode.
b) Process is holding some resources and waiting for others.
c) There is a circular wait between processes
d) Resources cannot be pre-empted
√ e) All of the other options.
Suppose that there are ten resources available to three processes. At time 0, the following data
is collected. The table indicates the process, the maximum number of resources needed by the
process, and the number of resources currently owned by each process. Which of the following
correctly characterizes this state?
It is not safe.
The factor(s) that influence(s) the decision of when to invoke a deadlock
detection algorithm is (are):
a) How often a deadlock is likely to occur
b) How many processes will be affected by deadlock when it happens
c) When the CPU utilization drops below a certain threshold.
√d) All of the other options.
about:blank 1/55
,9/22/23, 10:08 AM OS Cheat Sheet - Answers to quizzes and exam questions
Consider a logical address of length 20 bits with a page size of 8 KB. How many bits must be
used to represent the page offset in the logical address? 13
Which of the following statements is true?
a) Inverted page tables require each process to have its own page table.
b) Fragmentation does not occur in a paging system.
c) Mobile operating systems typically support swapping.
d) Without a mechanism such as an address-space identifier, the TLB must
be flushed during a context switch.
Suppose we have the following page accesses: 1 2 3 4 2 3 4 1 2 1 1 3 1 4 and that there are
three frames within our system. Using the FIFO replacement algorithm, what is the number of
page faults for the given reference string? 8
Suppose we have the following page accesses: 1 2 3 4 2 3 4 1 2 1 1 3 1 4 and that there are
three frames within our system. Using the LRU replacement algorithm, what is lthe lnumber
lof l page lfaults lfor lthe lgiven lreference lstring? l8
Which lof lthe lfollowing lstatements lis ltrue?
a) On la lsystem lwith ldemand-paging, la lprocess lwill lexperience la lhigh lpage
lfault lrate l when lthe lprocess lbegins lexecution.
b) If lthe lpage-fault lrate lis ltoo lhigh, lthe lprocess lmay lhave ltoo lmany lframes.
c) On lsystems lthat lprovide lit, lvfork() lshould lalways lbe lused linstead lof lfork().
d) In lgeneral, lvirtual lmemory ldecreases lthe ldegree lof lmultiprogramming lin la lsystem
Given lthe lreference lstring lof lpage laccesses: l1 l2 l3 l4 l2 l3 l4 l1 l2 l1 l1 l3 l1 l4 land la
lsystem lwith lthree l page lframes, lwhat lis lthe lfinal lconfiguration lof lthe lthree lframes
lafter lthe lLRU lalgorithm lis l applied? l 4, l1, l3
Suppose lwe lhave lthe lfollowing lpage laccesses: l1 l2 l3 l4 l2 l3 l4 l1 l2 l1 l1 l3 l1 l4
land lthat lthere lare l three lframes lwithin lour lsystem. lUsing lthe lFIFO lreplacement
lalgorithm, lwhat lwill lbe lthe lfinal l configuration lof lthe lthree lframes lfollowing lthe
lexecution lof lthe lgiven lreference lstring? l2, l3, l4
Suppose lwe lhave lthe lfollowing lpage laccesses: l1 l2 l3 l4 l2 l3 l4 l1 l2 l1 l1 l3 l1 l4
land lthat lthere lare l three lframes lwithin lour lsystem. lUsing lthe lFIFO lreplacement
lalgorithm, lwhat lwill lbe lthe lfinal l configuration lof lthe lthree lframes lfollowing lthe
lexecution lof lthe lgiven lreference lstring? l3, l4, l2
about:blank 2/55
,9/22/23, 10:08 AM OS Cheat Sheet - Answers to quizzes and exam questions
Consider lthe lfollowing lset lof lprocesses, lwith lthe llength lof lthe lCPU lburst ltime lgiven lin
l milliseconds l(1ms l= l1 lunit ltime):
The lprocesses lare lassumed lto lhave larrived lat ltime lzero lshown lin lthe ltable land lthe
lscheduling l decisions lare lmade lat lthe l1 lunit ltime lboundary. l Draw lGantt lcharts
lthat lillustrate lthe lexecution l of lthese lprocesses lusing lthe lfollowing lscheduling
lalgorithms:
The lConvoy leffect loccurs lin lFCFS lscheduling lwhen la lprocess lwith la llong lCPU lburst
loccupies l the lCPU
Processor l affinity l allows l a l thread l to l run l on l only l one l processor.
Supposed lthat lthe lfollowing lprocesses larrive lfor lexecution lat lthe ltimes lindicated. lEach
lprocess l will lrun lfor lthe lamount lof ltime llisted. lIn lanswering lthe lquestions, luse
lpreemptive lscheduling, l and lbase lall ldecisions lon lthe linformation lyou lhave lat lthe
ltime lthe ldecision lmust lbe lmade l(each l unit ltime.
Process Arrival lTime Burst lTime
1 0 8
2 1 4
3 2 1
What lis lthe laverage lturnaround ltime lfor lthese lprocesses lwith lthe lShortest lremaining ljob
lfirst l scheduling lalgorithm? l6.33
about:blank 3/55
, 9/22/23, 10:08 AM OS Cheat Sheet - Answers to quizzes and exam questions
The l RR l (Round l Robin) l scheduling l algorithm l is l designed l especially l for l time-sharing
l systems.
A lsignificant lproblem lwith lpriority lscheduling lalgorithm lis lstarvation
SJF lscheduling lis lapproximated lby lpredicting lthe lnext lCPU lburst lwith lan lexponential
laverage l of lthe lmeasured llengths lof lprevious lCPU lbursts
Throughput lis lthe lnumber lof lprocesses lthat lare lcompleted lper
ltime lunit l The ltrend lin ldeveloping lparallel lapplications lis lto luse
limplicit lthreading l A l mutex l lock l is l essentially l a l boolean
l variable
The lMany lto lmany lmultithreading lmodel lmultiplexes lmany luser-level lthreads lto la
lsmaller lor l equal lnumber lof lkernel lthreads.
Assume lyou lhad la lfunction lnamed lupdate() lthat lupdates lshared ldata. lIllustrate lhow
la lmutex l lock lmight lbe lused lto lprevent la lrace lcondition lin lupdate()
Ans:
void lupdate(){
mutex.acquire
//update lshared ldata
l mutex.release
}
A lcounting lsemaphore lis lessential lan linteger lvariable
Which lof lthe lfollowing lwould lbe lan lacceptable lsignal lhandling lscheme lfor la
lmultithreaded l program? lAll lof lthe loptions
Options linclude: lDeliver lthe lsignal lto lthe lthread lto lwhich lthe lsignal lapplies.
lDeliver lthe l signal lto lonly lcertain lthreads lin lthe lprocess. lDeliver lthe lsignal lto levery
lthread lin lthe lprocess.
Which lof lthese lstatements linvolving lthreads lis lfalse? lSharing lis lautomatically
lprovided lin l java lthreads.
Ensuring lthere lis la lsufficient lnumber lof lcores lis lnot la lchallenge lwhen ldesigning
l applications lfor lmulticore lsystems
A l race l condition l results l when l several l threads l try l to l access l and l modify l the l same
l data l concurrently
about:blank 4/55