CS FundamentalsVery hardGATE CS

A 1024 KB buddy system (minimum block 32 KB, lowest-address-first allocation) serves A=70 KB, B=35 KB, C=80 KB, D=60 KB in that order, getting blocks of 128, 64, 128 and 64 KB. Then A, B and D are freed in this order while C stays allocated. Immediately afterwards, which statement is true?

  1. A. There are 3 free blocks and the largest is 512 KB
  2. B. There are 3 free blocks and the largest is 256 KB
  3. C. There are 4 free blocks and the largest is 512 KB
  4. D. There is 1 free block of 896 KB

Correct answer: A. There are 3 free blocks and the largest is 512 KB

After the four allocations the free blocks are 512 and 128. A frees 128 (its buddy is split, no merge). B frees 64 whose buddy D is busy. D then frees 64, merges with B's 64 into 128, merges with A's 128 into 256, but its buddy 256 contains C. Free blocks: 512, 128 and 256, so 3 blocks, largest 512 KB.

More Operating Systems questions

Exams that ask this topic