Let a memory have four free blocks of sizes 4k, 8k, 20k, 2k. These blocks are…

2007

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.


2007_11

The time at which the request for J7 will be completed will be

Answer: B. 19Answer: 19 (J7 completes at time 19). Reasoning: All requests are in a queue and are allocated in arrival order using best-fit. Simulate the allocations and…

  1. A.

    16

  2. B.

    19

  3. C.

    20

  4. D.

    37

Attempted by 107 students.

Show answer & explanation

Correct answer: B

Answer: 19 (J7 completes at time 19).

Reasoning: All requests are in a queue and are allocated in arrival order using best-fit. Simulate the allocations and frees to find when J7 finishes.

  • Initial free blocks: 4k, 8k, 20k, 2k.

  • At time 0 allocations (best-fit, queue order):

    J1 (2k) → 2k block (finishes at time 4). J2 (14k) → 20k block (finishes at time 10). J3 (3k) → 4k block (finishes at time 2). J4 (6k) → 8k block (finishes at time 8).

  • Time 2: J3 frees the 4k block, but waiting requests (J5, J6, J7, J8) need larger blocks, so no allocation is possible then.

  • Time 4: J1 frees the 2k block; still no suitable block for the waiting 6k/7k/10k/20k requests.

  • Time 8: J4 frees the 8k block. The next in queue, J5 (6k), gets the 8k block and will finish at time 12.

  • Time 10: J2 frees the 20k block. The next waiting request, J6 (10k), gets the 20k block and finishes at time 11.

  • Time 11: J6 frees the 20k block. The next waiting request, J7 (7k), takes the 20k block (best-fit among available blocks) and runs for 8 units, finishing at time 19.

  • Therefore J7 completes at time 19.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…