Loading the code workspace…
Write a C program that demonstrates the cost of unaligned I/O.
Requirements:
Direct I/O (O_DIRECT) on Linux enforces exactly the alignment this task models, which is why PostgreSQL, MySQL, and every serious storage engine call posix_memalign for their I/O buffers instead of using regular malloc. Getting alignment wrong silently turns a single 4KB write into a read-modify-write cycle that can double or quadruple the bytes actually hitting disk.
Sample case for Run. Submit grades this sample plus all hidden tests.