IT2060 - Operating System and System Administration
IT2060 - Operating System and System Administration
Final Examination
Year 2, Semester I (2023)
Duration: 2 Hours
Instructions to Candidates:
• This paper contains 5 pages including the cover page.
• This paper has 4 questions with a total of 100 marks.
• Answer all questions in the booklet given.
• Electronic devices capable of storing and retrieving text, including
calculators and mobile phones are not allowed.
Page 1 of 5
uestion 1 25 Marks
a) Briefly explain the following. (3 marks)
b) List the three solutions for critical section problem ofa program. (3 marks)
// Peterson's solution:
Process P Process P
/
/
repeat repeat
flag|lr| = true., flagun--true.,
turn = j., turn = i.I
while lf/ogLJ and turn =/.) do no-op; while tt/og[/1 and ft/in =/.) do r}o-op;
critical section critical section
Note: The initial values f;or turn is `i' and the foag[i] , foago] are set to false.
i. Evaluate the Peterson's solution and briefly discuss whether it satisfies the threLe
solutions for critical section problem. (9 Marks)
d) Consider the following code segment for the producer processes: (10 marks)
DO(
wait (empty) ;
wait (mutex) ;
signal (mutex) ,.
signal ( full ) ,.
} while (true),.
Page 2 of 5
00378
` ii. What are the initial value ofmutex, empty and full variables?
iii. Complete the consumers' code for consumer process using the above
variables.
uestion 2 25 Marks
c) In a system 3 process named Pl, P2, and P3 are available. There are 2 printers and 1 tape
drive in the system. Pl process is currently holding a printer and requesting for a tape dr`ive.
P2 process is holding only a printer. P3 process is holding a tape drive and requesting for a
printer.
i. Draw the resource allocation graph for above scenario using the correct symbols.
d) Deadlock recovery can be done by preempting some resources from one or more of the
deadlocked processes. Briefly discuss at least two factors that must be considered when
preempting a resource.
(2 marks)
Page 3 of 5
oo37ir
i. Is the system safe if the number of resources currently available is 4? Justify your
answer. (4 marks)
ii. In above table, for a given state and there are 4 resources available. If the Process 3
requests for three resources (in addition to the current resource allocation of 4
resources), should th-e request be granted? Justify your answer. (4 marks)
uestion 3 25 Marks
a) Briefly explain the followings. (2 marks)
i. Internal fragmentation
ii. External fragmentation
b) Consider a simple paging system with 2]9bytes of physical memory, 4096 pages of logical
address space, and a page size of4KB. Answer the following. (10marks)
c) Virtual memory is a technique that allows the execution of processes that are not
completely in memory.
ii. List the actions taken by the operating system when there is a page fault.
(2 Marks)
Page 4 of 5
00378
iii. How can the system distinguish between the pages that are in main memory
from the pages that are on the disk? (2 Marks)
1V. Consider the page reference sequence given below and find the number of page
faults using FIFO algorithm. Assume that there are three frames available, and
they are initially empty. (7 marks)
uestion 4 25 Marks
a) Listtwo program threats. (4 marks)
c) In a disk drive, Disk requests are generated for cylinders 9, 17, 2, 40, 8, and 90, in the
order. It takes 5 msec for a cylinder movement. Assuming that the arm head is initially at
cylinder 20 (the previous request was at cylinder 5) for a disk with 100 cylinders (1 to
100). How much seek time is needed for the following algorithms? (10 marks)
i. LOOK
ii. SCAN
d) Consider a flle currently consisting of 200 blocks. Assume that the file control block is
already in memory. Calculate how many disk I/0 operations are required for linked
allocation strategy if:
i. The second block from the beginning is removed.
ii. The middle block is removed.
iii. One block is added at the beginning.
iv. One block is added to the middle.
(8 Marks)
Page 5 of 5