CS FundamentalsModerateGATE CS (PYQ pattern)
A slab allocator builds each slab from two contiguous 4 KB pages. A slab has a 16-byte header and holds as many 200-byte objects as fit; the leftover bytes are used for cache colouring, i.e. the first object is shifted by 0, 64, 128, ... bytes in successive slabs, as long as the shift does not exceed the leftover. How many objects does a slab hold and how many different colours (offsets) exist?
- A. 40 objects, 2 colours
- B. 40 objects, 3 colours
- C. 20 objects, 2 colours
- D. 40 objects, 4 colours
Correct answer: B. 40 objects, 3 colours
(8192 - 16) / 200 = 40 objects (8000 bytes), leaving 8192 - 16 - 8000 = 176 bytes. Shifts 0, 64 and 128 fit within 176 (192 does not), so 3 colours; 176 / 64 = 2 forgets the zero offset. 20 objects uses a single 4 KB page.
More Operating Systems questions
- LRU-2 replacement: on a fault the victim is the resident page whose SECOND most recent reference is oldest (a page referenced only once…
- The aging algorithm keeps an 8-bit counter per page (initially 0). At every clock tick each counter is shifted right by one bit and the…
- A single resource has 9 units and three processes have maximum claims 6, 5 and 4. Consider every possible current allocation (a0, a1, a2)…
- An ext3-style file system appends one data block to a file; the update also modifies the inode and the block bitmap. In ORDERED journaling…
- A RAID 0 array has 5 disks and a chunk size of 4 blocks (chunk k is on disk k mod 5, as the (k div 5)-th chunk on that disk). On which…
- An inode has 12 direct pointers, one single-, one double- and one triple-indirect pointer; blocks are 2048 bytes and pointers are 4 bytes…