QUIZ
CAT NO. 3 (2022)
1. Assume that there are 4 processes (P1, P2, P3 and P4) and 4 types of resources (A, B, C and D). At T0 we
have the following system state:
Allocation Maximum Available
A B C D A B C D A B C D
P1 1 2 2 1 3 3 2 2 3 1 1 2
P2 1 0 3 3 1 2 3 4
P3 1 1 1 0 1 1 5 0
P4 0 1 2 1 6 2 2 1
a) Create and fill in the Need matrix. (2 marks)
b) Is the system in a safe state? If yes, give a safe sequence of processes. If your answer is no, explain
why. (5 marks)
2. Given memory holes (i.e., unused memory blocks) of 100K, 500K, 200K,
300K and 600K (in address order) as shown below, how would each of the
first-fit, next-fit, best-fit and worst-fit algorithms allocate memory requests
for 290K, 420K, 110K and 350K (in this order)? (8 marks)
3. Consider the following segment table:
Length Base Segme
nt
600 219 0
14 2300 1
100 90 2
580 1327 3
96 1952 4
What are the physical addresses for the following logical addresses?
a) 0, 430 b) 1, 10 c) 2, 500 d) 3, 400 e) 4, 112 (5 Marks)
4. Consider a logical-address space of 16 pages of 1K words each, mapped
onto a physical memory of 128 frames.
a) How many bits are in the logical address? (2 Marks)
b) How many bits are in the physical address? (2 Marks)
CAT NO. 3 (2022)
1. Assume that there are 4 processes (P1, P2, P3 and P4) and 4 types of resources (A, B, C and D). At T0 we
have the following system state:
Allocation Maximum Available
A B C D A B C D A B C D
P1 1 2 2 1 3 3 2 2 3 1 1 2
P2 1 0 3 3 1 2 3 4
P3 1 1 1 0 1 1 5 0
P4 0 1 2 1 6 2 2 1
a) Create and fill in the Need matrix. (2 marks)
b) Is the system in a safe state? If yes, give a safe sequence of processes. If your answer is no, explain
why. (5 marks)
2. Given memory holes (i.e., unused memory blocks) of 100K, 500K, 200K,
300K and 600K (in address order) as shown below, how would each of the
first-fit, next-fit, best-fit and worst-fit algorithms allocate memory requests
for 290K, 420K, 110K and 350K (in this order)? (8 marks)
3. Consider the following segment table:
Length Base Segme
nt
600 219 0
14 2300 1
100 90 2
580 1327 3
96 1952 4
What are the physical addresses for the following logical addresses?
a) 0, 430 b) 1, 10 c) 2, 500 d) 3, 400 e) 4, 112 (5 Marks)
4. Consider a logical-address space of 16 pages of 1K words each, mapped
onto a physical memory of 128 frames.
a) How many bits are in the logical address? (2 Marks)
b) How many bits are in the physical address? (2 Marks)