It completely depends on the hardware implementation. Some implementations load one line from main memory at a time; and cache line sizes vary greatly between different processors. I have seen row sizes from 64 bytes to 256 bytes. Basically, the size of the "cache line" means that when the CPU requests memory from the main RAM, it does this by n bytes at a time. Therefore, if n is 64 bytes, and you load a 4-byte integer into 0x1004, the MMU will actually send 64 bytes on the bus, all addresses from 0x1000 to 0x1040. This entire piece of data will be stored in the data cache as a single line.
Some MMUs can retrieve several cache lines on the bus for each request, so a request to the address 0x1000 on a machine with 64 byte caches actually loads four lines from 0x1000 to 0x1100. Some systems allow you to do this explicitly with special prefetch codes or DMA codes.
However, the article on your first link is completely incorrect. It confuses the OS size of the memory page with the hardware cache line . These are completely different concepts. The first is the minimum size of the virtual address space that the OS will allocate immediately. The latter provides detailed information on how the processor interacts with the main RAM.
They are similar to each other only in the sense that when the OS does not work much in physical memory, it will output some recently used virtual memory to disk; and then when you use this memory again, the OS loads the entire page from disk back into physical RAM. This is similar (but not related) to the way the processor loads bytes from RAM, so the author of Secrets of Hardware was confused.
A good place to learn all about computer memory and why caches work the way they do is Ulrich Drapper's paper. What every programmer should know about memory .
Crashworks
source share