Consider six memory partitions of size 200 KB, 400 KB, 600 KB, 500 KB, 300 KB,…

2015

Consider six memory partitions of size 200 KB, 400 KB, 600 KB, 500 KB, 300 KB, and 250 KB, where KB refers to kilobyte. These partitions need to be allotted to four processes of sizes 357 KB, 210 KB, 468 KB and 491 KB in that order. If the best fit algorithm is used, which partitions are NOT allotted to any process?

  1. A.

    200 KB and 300 KB

  2. B.

    200 KB and 250 KB

  3. C.

    250 KB and 300 KB

  4. D.

    300 KB and 400 KB

Attempted by 288 students.

Show answer & explanation

Correct answer: A

Key idea: Best-fit selects the smallest partition that is large enough for the process.

Initial partitions (KB): 200, 400, 600, 500, 300, 250. Processes in order (KB): 357, 210, 468, 491.

  • Process of size 357 KB: available partitions that fit are 400, 600, 500. The smallest that fits is 400 KB, so allocate the 400 KB partition.

  • Process of size 210 KB: remaining partitions are 200, 600, 500, 300, 250. The partitions that fit are 600, 500, 300, 250. The smallest that fits is 250 KB, so allocate the 250 KB partition.

  • Process of size 468 KB: remaining partitions are 200, 600, 500, 300. The partitions that fit are 600 and 500. The smallest that fits is 500 KB, so allocate the 500 KB partition.

  • Process of size 491 KB: remaining partitions are 200, 600, 300. The only partition that fits is 600 KB, so allocate the 600 KB partition.

After all allocations the unallocated partitions are 200 KB and 300 KB.

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

Explore the full course: Gate Guidance By Sanchit Sir