Questions: Slab Allocator for Kernel Memory

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

What is the primary performance advantage of keeping freed kernel objects in a pre-initialized state in the slab allocator?

AIt allows the operating system to reclaim memory during idle periods by reusing object slots
BIt eliminates the cost of re-initializing objects on each allocation — since freed objects are returned ready-to-use, the next allocation just grabs a pre-constructed slot
CIt prevents memory leaks by maintaining a reference count on every allocated object
DIt allows multiple object types to share the same slab, increasing memory utilization
Question 2 Multiple Choice

A kernel developer argues: 'We should use the buddy system for all kernel allocations — it already handles fragmentation and is simpler.' What is the strongest objection to this proposal?

AThe buddy system cannot allocate memory on modern multi-core hardware
BThe buddy system allocates power-of-two blocks, so a 96-byte inode gets a 128-byte block (wasting 32 bytes per allocation), and it returns freed blocks as raw uninitialized memory — the slab allocator eliminates both the fragmentation and the re-initialization overhead
CThe buddy system is too slow for allocations larger than one page
DThe buddy system can only be used for user-space allocations, not kernel objects
Question 3 True / False

In a slab allocator, each object type (inode, task_struct, file descriptor) has its own dedicated cache containing slabs sized for that type.

TTrue
FFalse
Question 4 True / False

The slab allocator replaces the buddy system, taking over page-level memory management from the Linux kernel.

TTrue
FFalse
Question 5 Short Answer

Why does the slab allocator reduce internal memory fragmentation compared to the buddy system, and how does object caching further improve performance beyond just fragmentation reduction?

Think about your answer, then reveal below.