October University for Modern Sciences & Arts
CS352
Advanced Operating Systems
Assignment 2 Model Answer
Faculty Computer Science
Spring Spring 2021
Total Mark 30
Mark Distribution & Module Question 1 12 marks LO’s 1, 2,3
Learning Outcomes Distribution Question 2 18 marks LO’s 1, 2,3
No. of Pages (including cover 3
page)
October University for Modern Sciences & Arts Module Code: CS352
Faculty of Computer Science Module Title: Advanced Operating Systems
Assignment 2 Model Answer- Spring 2021
Answer all of the following questions:
Question 1: Suppose that a disk drive has 5000 cylinders, numbered 0 to
4999. The drive is currently serving a request at cylinder 143, and the
previous request was at cylinder 125. The queue of pending requests, in
FIFO order, is 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130 Starting
from the current head position, what is the total distance (in cylinders) that
the disk arm moves to satisfy all the pending requests, for each of the
following disk-scheduling algorithms?
(12 Marks, 2 Marks for each algorithm)
a- FCFS
b- SSTF
c- SCAN
d- LOOK
e- C-SCAN
f- C-LOOK
Answer:
FCFS :
The FCFS schedule is 143, 86, 1470, 913, 1774, 948, 1509, 1022,1750, 130. The
total seek distance is 7081.
SSTF:
Page 1 of 3
October University for Modern Sciences & Arts Module Code: CS352
Faculty of Computer Science Module Title: Advanced Operating Systems
Assignment 2 Model Answer- Spring 2021
The SSTF schedule is 143, 130, 86, 913, 948, 1022, 1470, 1509, 1750,1774. The
total seek distance is 1745.
SCAN:
The SCAN schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774,4999, 130,
86. The total seek distance is 9769.
CSCAN:
The C-SCAN schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774,4999, 0,
86, 130. The total seek distance is 9985.
LOOK:
The LOOK schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774,130, 86. The
total seek distance is 3319.
CLOOK:
The C-LOOK schedule is 143, 913, 948, 1022, 1470, 1509,1750, 1774, 86, 130.
The total seek distance is 3363.
Question 2: Consider a file currently consisting of 150 blocks.
Assume that the file control block (and the index block, in the case of
indexed allocation) is already in memory.
Calculate how many disk I/O operations are required for contiguous, linked,
and indexed (single-level) allocation strategies, if, for one block, the
following conditions hold:
Page 2 of 3
October University for Modern Sciences & Arts Module Code: CS352
Faculty of Computer Science Module Title: Advanced Operating Systems
Assignment 2 Model Answer- Spring 2021
In the contiguous-allocation case, assume that there is no room to grow at
the beginning but there is room to grow at the end.
Also assume that the block information to be added is stored in memory.
a- The block is added at the beginning.
b- The block is added in the middle.
c- The block is added at the end.
d- The block is removed from the beginning.
e- The block is removed from the middle.
f- The block is removed from the end.
Answer:
Contiguous Linked Indexed
301 1 1
151 77 1
1 3 1
298 1 0
148 77 0
0 149 0
Page 3 of 3