Question

Consider six memory partitions of sizes 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?

Choose one option
Official answer and solution
Official answer
A
From
Official GATE 2015 answer key

Solution

Trace the Best Fit dynamic memory allocation policy for the sequential process requests.

Initial available partitions:

{200 KB,  250 KB,  300 KB,  400 KB,  500 KB,  600 KB}\{200\text{ KB},\; 250\text{ KB},\; 300\text{ KB},\; 400\text{ KB},\; 500\text{ KB},\; 600\text{ KB}\}

The Best Fit algorithm allocates the smallest available partition that is large enough (size≥requestsize \ge request) for each process:

  1. Process 1 (357 KB):
    Partitions ≥357\ge 357 KB are {400,500,600}\{400, 500, 600\}.
    The smallest is 400 KB. 400 KB is allocated to Process 1.
    Remaining partitions: {200,250,300,500,600}\{200, 250, 300, 500, 600\}.
  1. Process 2 (210 KB):
    Partitions ≥210\ge 210 KB are {250,300,500,600}\{250, 300, 500, 600\}.
    The smallest is 250 KB. 250 KB is allocated to Process 2.
    Remaining partitions: {200,300,500,600}\{200, 300, 500, 600\}.
  1. Process 3 (468 KB):
    Partitions ≥468\ge 468 KB are {500,600}\{500, 600\}.
    The smallest is 500 KB. 500 KB is allocated to Process 3.
    Remaining partitions: {200,300,600}\{200, 300, 600\}.
  1. Process 4 (491 KB):
    Partitions ≥491\ge 491 KB is only {600}\{600\}.
    600 KB is allocated to Process 4.
    Remaining partitions: {200,300}\{200, 300\}.

The partitions that are NOT allotted to any process are 200 KB and 300 KB (option A).

Final answer

A

Common trap

Applying First Fit instead of Best Fit, which would allocate 600 KB to Process 1.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2015 Computer Science and Information Technology (CS) Session 2
Question
40 of 65, printed as CS Q.30
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.