Assignment 3

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

MANIPAL UNIVERSITY JAIPUR

School of Computing and Information Technology


Assignment 3
Operating Systems | IT2202
Class: B.Tech. 2nd Year IV Semester

Submission Date: 25th April’24 or before


1. A system consists of three processes P1, P2, and P3. There is a single resource type Printer but with
four instances. Each process declares the maximum resource demand of 3 instances. Is deadlock
possible in this situation?
2. Does an unsafe state always lead to a deadlock? Demonstrate your answer with an example.
3. Check whether a deadlock is present in the following:
a) Two processes with two files
b) Two processes access and lock database records
c) Three processes with CD drive, printer, plotter
4. In a system, the following state of processes and resources is given:
R2→P1, P1→R2, P2→R3, R1→P2, R3→P3, P3→R4, P4→R3, R4→P4, P4→R1, R1→P5
Draw a RAG and wait-for graph for the system, and check the deadlock condition.
5. Consider the following snapshot of a system:
Allocation Max Available
ABCD ABCD ABCD
P0 0 0 1 2 0 0 1 4 0 1 2 0
P1 1 3 0 0 1 7 5 0
P2 2 3 5 4 2 3 5 6
P3 0 6 3 2 0 6 5 2
P4 0 2 2 4 0 6 5 6

Answer the following questions using the banker’s algorithm:

a) What is the content of the Need matrix?


b) Is the system in a safe state? If yes, find the safe sequence.
c) If a request from process P1 arrives for (0,4,2,0), can the request be granted immediately?
6. Given 3 processes A,B and C, three resources x,y and z and following events,
a. A requests x ii) A requests y iii) B requests y iv) B requests z
v) C requests z vi) C requests x vii) C requests y
Assume that requested resources should always be allocated to the request process if it is available.
Draw the resource allocation graph for the sequences. And also mention whether it is a deadlock? If it
is, how to recover the deadlock.
7. In a paging scheme, 16-bit addresses are used with page size of 256 bytes. If the logical address is
0011010101110101, how many bits are used for the page number and offset? Also, compute the page
number and offset. What will be the physical address, if the frame address corresponding to the
computed page number is 20?
8. How many bits are there in a logical address in a paging system with 232 bytes of physical memory,
512 pages of logical address space, and a page size of 28 bytes?
9. How many bits are there in a logical address, where page size is of 210 bytes and 256 pages are there
in the logical address space?
10. A system with 32-bit logical address uses a two-level page table structure. It uses page size of 26. The
outer page table or directory is accessed with 10 bits of the address.
i). How many bits are required to access the page table?
ii). How many entries are there in the directory?
iii). How many entries are there in the page table?
11. Calculate the number of page faults for the following reference string using FIFO, Optimal and LRU
algorithms with frame size as 3.
5 0 2 1 0 3 0 2 4 3 0 3 2 1 3 0 1 5
12. 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?
a. FCFS
b. SSTF
c. SCAN
d. LOOK
e. C-SCAN

You might also like