0% found this document useful (0 votes)
26 views5 pages

IT2060 - Operating System and System Administration

Uploaded by

it20046798
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views5 pages

IT2060 - Operating System and System Administration

Uploaded by

it20046798
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

/ 00378

Sri Lanka Institute of Information Technology

B.Sc. Special Honours Degree/Diploma


in
Information Technology

Final Examination
Year 2, Semester I (2023)

IT2060 -Operating System and System


Administration

Duration: 2 Hours

May/ June 2023

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)

i. Critical section ofaprogram


ii. Atomic operations
iii. Semaphore

b) List the three solutions for critical section problem ofa program. (3 marks)

c) Consider the Peterson's solution provided as a solution for synchronization issue.

// 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

flagli] = false., flagul--false.,


remainder section remainder section
until/o'se; until,o'se;

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) ;

/* produce an item in next produced */

signal (mutex) ,.
signal ( full ) ,.

/* add next produced to the buffer */

} while (true),.

Page 2 of 5
00378

i. List the semaphores used in this code.

` 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

a) List four necessary conditions to create a deadlock in the system? (4 marks)

b) Consider the resource allocation graph given in the figure below.

i. Is the graph containing a deadlock? Justify your answer. (3 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.

ii. Is there a deadlock in this system? Justify your answer. (8 marks)

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

e) For a state described in the following table:

Process Current Allocation Maximum Allocation


Rl Rl
Pl 2 4
P2 2 3
P3 4 10
P4 3 8

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)

Note: draw the table and illustrate the calculation

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)

i. What is the difference between logical and physical addresses?

ii. How many bits are in the physical address?

iii. How many bits are in the logical address?

iv. Where does thepagetable store in the computer?

v. How long is the page table mentioned above?

c) Virtual memory is a technique that allows the execution of processes that are not
completely in memory.

i. List two advantages of virtual memory. (2 Marks)

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)

Page reference sequence: 7,0,1, 2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1

uestion 4 25 Marks
a) Listtwo program threats. (4 marks)

b) List the three methods of allocating disk blocks to files. (3 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)

*** End of paper ***

Page 5 of 5

You might also like