OS Test 2 1516
OS Test 2 1516
OS Test 2 1516
Operating Systems
Test 2, Semester 1, 201512016 (75 minutes)
Totai marks are 100 marks for the test. This test contributes 10 o/o towards your grade.
Partial marks may be given for your working even though the final answer is incorrect.
Question Marks
1
Uo
2
T"
3
r(
Total
<1
ii. In a Readers and Writers process cooperation scheme, there is no need for
any critical section if there is only one writer and multiple readers.
iii.
iv.
By using additional processors, we can always reduce the amount of time
taken to solve anv task based on 1/(No. of CPU
For movable head disk drives, the main delay component is due to the track
q
seek time.
(b) On a
(10 marks)
multiprocessor system with 4 frrocessnrs, and 10_p1s!g$es that need access to a shared
?
ypury3. Given that the process context switching time is;L$U,rwhile the time each process
spends in the critical section is l3_s., answer the following questions:
\
CST 232
(i)Statethree(3)mutualexclusiontechniquesusedtoj*lgl4ggEgs-&&esharedmemoryarea
used by fypical
operating systems'
r -
(ii)Whichofthetechniquesin(b)(i)ismostefftcientforuseincontrollingaccesstotheshared
justifu your answer'
memory area? Please
{& ^4
"{.'A
Y*,i*#^{",yW,
(iii) lf the time spenr by
ffi'T*'*:
each process
::**a'ril,n!
t,:Yy"
':*:_":"::.,." i'stifv your
Prease'*tt1
ajasniver.
-'y'toliltr
^I
*'*ollaoal "t"
A*0}'uru -1h-'
o^l.t vr*u[/t-
( *e +o" {(sLa!
O
',"'cvr.tlr^\ gc,kn /--
/
(i6 marks)
P(emPtY)
Read data from buffer
P(mutex)
V(mutex)
Write data into buffer
V(mutex)
Consume data
v(tuli)
CST 232
(i) What are the three variablesfull, empty and mutex used for? What should be the initial
values for these variables?
nlN":.,S,*'$'J'%fu-/
t - r
tlnsutroo
/ u
.-klt\ :s \L\ei\ Rro,fn lrolrttl and. *or ntty.u
tni\+t<c \ .
\.r\\-_ tn
e,al.trf e_ 0 V
il"*k-_ o /\
(ii) Explain what happens if the initial value for emplt is 1. Will the system work properly for
the case where both the producer and consumer processes perform theirtask in 5 seconds while
.'the producer generates one output every 20 seconds? Justifo your answe
Ii"5;i1ilrH trW'i*' :ry HJ,#r
r;,ffi 4,u
*tr'W' H 't,,,,!'^-r,/r* Nd
Con}.t,yttlt ,
(12 marks)
2. A magnetic tape drive is used to store data for long term archiving.
(a) State two (2) advantages of using magnetic tape as an archiving storage medium
(b) A database file 1 GByte in size containing 5!,!._0,r9co:4l,needs to be stored to tape for later
processing. State three (3) disadvantages for storing the file as a single data stream written
continuously to tape (i.e., without any gaps between records) compared to writing data grouped
into 100 records per group as separate blocks on the tape.
(c) A movable head disk drive has 10.0 tracks, numbered as Track 0 to Track 99. Given that the
following track requests are passed to the Drive Manager at the beginning, and the currglt head is
on TBghA determine the track servicing seqaence and total number of tracks traveled using the
3 6 \, t. L? tL .ai
/vA,,A tWuYb/+/Y
e
,v-"
t&
(18 marks)
\q. 3 (a) An Address Book program needs to store 10,000 variable length data items in a file. Given that
9 *dvarrl\Y-', the file system can supporr either store q{gg4$gp.ds or variable-length records, answer
-
Con the following questions:
- thr- 'frlel andtwo (2) disadvantages orstoringthe variabre
^;;ffi
ffi .ryr* ;:",.;ff i.ff*"
N,#WW #yy 9'6{"rf i\L Io*+*r,
u615fe
,f
.*F=lil'E,'h.7',,Iftheusers*uffiJ"oi-,tu"iiilth*.add.".,Bookthatwerestoredinthe
,rt- lA.^q4
r- \hl, I - ' / file system as variable iength records, explain one (1) method in which random searches can be
^
-r\ tT( / performed without having to access each record in the file in sequence.
(i0 marks)
CST 232
(b)(i)Statethree(3)approachesforcontrollingaccesstofilesintypicaloperatingSystems.
/ Syclv-o|;za&'4
l'\Ser lttnW
t o*ty *r?D
with 100 users and 3,000 files, which of the above approaches
would
(ii) Given a computer system
<"W<co.
*-u\\ cu^{'s\
.^[ "M"^l
\lth /v\0r[- +'kr
(12 marks)
y'
marking the correct column with a '
g
Compression Format Suitable Unsuitable
!
Type of File
output