Hacker News new | ask | show | jobs
by trwhite 333 days ago
How does a read-ahead cache work and why is it so effective here?
1 comments

When I request 1 random byte, the library fetches 512 bytes (for example) of random data from the OS, and then returns the first byte to me. When I request another 1 random byte, it just gives me the next byte that it already fetched without needing to make another syscall.
Thanks for the explanation