Submit and pass all tests to enable saving to GitHub.
Implementation
Why This Matters
Linux's physical page allocator in mm/page_alloc.c is a buddy system just like this one, tracking per-order free lists and coalescing blocks via the same base-address XOR trick to fight external fragmentation. Get the splitting or coalescing logic wrong and you reproduce the exact class of bug kernel developers chase when large contiguous allocations mysteriously fail under memory pressure.
Hints
0 / 3 revealed
Validation Suite
main.c
Workspace 1.0
Implement buddy system allocator for physical memory.
Requirements:
Define Block structure with size, status, next pointer
Maintain array of free lists (one per power-of-2 size)
Implement buddy_alloc(size) to allocate memory
Implement buddy_free(ptr) to free memory
Implement buddy_find_buddy(ptr) to find buddy block
Implement buddy_coalesce(ptr) to merge with buddy if free
Support memory sizes from 1 KB to 1024 KB (powers of 2)
Print allocation, splitting, and coalescing events