BIO vs DIO
BIO vs DIO
Posted Jun 6, 2024 17:02 UTC (Thu) by joib (subscriber, #8541)In reply to: BIO vs DIO by Paf
Parent article: Measuring and improving buffered I/O
Posted Jun 7, 2024 17:25 UTC (Fri)
by Paf (subscriber, #91811)
[Link]
Alignment means "byte N in this page of memory is byte N in a block on disk".
So let's say you want to do I/O from a 1 MiB malloc, and this 1 MiB buffer starts at 100 bytes into a page.
*Every* byte in the IO is 100 bytes off, and that means there's not a 1-to-1 mapping between pages in memory and page on disk. So you have to shift them *all*. Allocate a 1 MiB buffer and copy everything to it.
This is the same for the page cache, FWIW. It has to shift *everything*.
But since you can do the copying in parallel, it's still *really* fast.
BIO vs DIO