Let a memory have four free blocks of sizes 4k, 8k, 20k, 2k. These blocks are allocated following the best-fit strategy. The allocation requests are stored in a queue as shown below.
The time at which the request for J7 will be completed will be
(A) 16
(B) 19
(C) 20
(D) 37
Answer: (B)
Explanation: Initially when a process arrives and needs memory, it would search for a hole big enough to fit the job and if the hole is larger then the remaining hole is returned to the free storage list.
Memory Block | Size | Job (t=0) | Job(t=8) | Job(t=10) | Job(t=11) |
1 | 4k | J3 – 2 units (1K free left) | |||
2 | 8k | J4 – 8 units (2K free left) | J5 – 14 units | J5 – 14 units | J5 – 14 units |
3 | 20k | J2 -10 units(6K free left) | J2 -10 units | J6 – 11 units | J7 – 19 units |
4 | 2k | J1 -4 units |
Therefore, the process finishes at J7=19 units
Option B