22CS304 – Operating Systems (Lab Integrated)
22CS304 – Operating Systems (Lab Integrated)
13. a) i) Outline the Dining philosopher problem and provide the solution for it using (7)
semaphore.
ii) Explain the methods used to recover system from deadlock. (6)
(OR)
13. b) i) Consider the following current state of a system. (13)
Allocation Max Available
ABCD ABCD ABCD
P0 0012 0012 1520
P1 1000 1750
P2 1344 2356
P3 0632 0652
P4 0014 0556
Answer the following questions using the banker’s algorithm:
a. What is the content of the matrix Need?
b. Is the system in a safe state?
c. If a request from process P1 arrives for (0,5,2,0), can the request be
granted immediately?
14. a) i) Demonstrate how the paging memory management scheme avoids external (7)
fragmentation.
ii) Given six memory partitions of 300 KB, 600 KB, 350 KB, 200 KB, 750 KB, (6)
and 125 KB (in order), how would the first-fit, best-fit, and worst-fit
algorithms place processes of size 115 KB, 500 KB, 358 KB, 200 KB, and
375 KB (in order)? Rank the algorithms in terms of how efficiently they use
memory.
(OR)
14. b) i) Consider the following page reference string: (13)
1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.
How many page faults would occur for the following replacement
algorithms, assuming four frames? Remember that all frames are initially
empty, so your first unique pages will cost one fault each.
a. LRU replacement
b. FIFO replacement
c. Optimal replacement
Part C (1 x 15 = 15 Marks)
16. a) i) Analyze why interrupt and dispatch latency times must be bounded in a hard (8)
real-time system.
ii) How does the signal () operation associated with monitors differ from the (7)
corresponding operation defined for semaphores?
(OR)
16. b) i) Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4,999. The (8)
drive is currently serving a request at cylinder 2,150, and the previous
request was at cylinder 1,805. The queue of pending requests, in FIFO order,
is: 2,069, 1,212, 2,296, 2,800, 544, 1,618, 356, 1,523, 4,965, 3681. 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?
a. FCFS
b. SSTF
c. SCAN
d. LOOK
ii) Illustrate how the page faults are handled in demand paging technique. (7)