All Exams Test series for 1 year @ ₹349 only
Question

Consider contiguous allocation of physical memory to processes using variable partitioning scheme. Suppose there are 8 holes in the memory of sizes 20 KB, 4 KB, 25 KB, 18 KB, 7 KB, 9 KB, 15 KB, and 12 KB. Assume that no two holes are adjacent. Two processes P1 of size 16 KB and P2 of size 9 KB arrive in that order, and they are allocated memory using the best-fit technique. After allocating space to P1 and P2, the number of holes of size less than 8 KB is ____________. (answer in integer)

Note: 1K=$2^{10}$

Initial Memory State

The system starts with the following memory holes:

  • 20 KB
  • 4 KB
  • 25 KB
  • 18 KB
  • 7 KB
  • 9 KB
  • 15 KB
  • 12 KB

Process P1 Allocation (16 KB) using Best-Fit

The Best-Fit algorithm selects the smallest hole that is large enough to accommodate the process.

  • Holes large enough for P1 (>= 16 KB): 20 KB, 25 KB, 18 KB.
  • The smallest among these is the 18 KB hole.
  • P1 is allocated 16 KB from the 18 KB hole.
  • The remaining size of this hole becomes: $18 \text{ KB} - 16 \text{ KB} = 2 \text{ KB}$.

Memory state after P1 allocation:

  • 20 KB
  • 4 KB
  • 25 KB
  • 2 KB (updated from 18 KB)
  • 7 KB
  • 9 KB
  • 15 KB
  • 12 KB

Process P2 Allocation (9 KB) using Best-Fit

The Best-Fit algorithm is applied again for P2.

  • Current holes: {20, 4, 25, 2, 7, 9, 15, 12} KB.
  • Holes large enough for P2 (>= 9 KB): 20 KB, 25 KB, 9 KB, 15 KB, 12 KB.
  • The smallest among these is the 9 KB hole.
  • P2 is allocated 9 KB from the 9 KB hole.
  • The remaining size of this hole becomes: $9 \text{ KB} - 9 \text{ KB} = 0 \text{ KB}$. This hole is effectively removed.

Memory state after P2 allocation:

  • 20 KB
  • 4 KB
  • 25 KB
  • 2 KB
  • 7 KB
  • 15 KB
  • 12 KB

Counting Holes Less Than 8 KB

Identify and count the holes with a size strictly less than 8 KB from the final list.

  • Final Holes: {20, 4, 25, 2, 7, 15, 12} KB.
  • Holes less than 8 KB are: 4 KB, 2 KB, and 7 KB.
  • Total count = 3.

The number of holes of size less than 8 KB after allocating P1 and P2 is 3.

Was this answer helpful?

Important Questions from Memory Management

  1. Which of the following is/are the basic units of IAS computer?

  2. Which of the following have the fastest access time?

  3. _________ is a memory management scheme that permits the physical address space of a process to be noncontiguous.

  4. Which of the following is a type of memory and is similar to RAM?

  5. Suppose you have eight 'black and white' images taken with a 1‐megapixel camera and one '8‐color' image taken by an 8‐megapixel camera. How much hard disk space in total do you need to store these images on your computer?

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App