What is Memory Hierarchy?
Simply put, memory hierarchy is the arrangement of storage within a computer. Think of it like a pyramid. The fastest memory is at the top—and also the most scarce. Descending down, the memory gets slower, but more plentiful. The advantage of this system is that while a small number of oft-used functions can be done quickly, a large number of functions may also be accessed at a somewhat slower rate, which is very cost effective.
The memory at the top of this pyramid is referred to as registers, or processor registers. These are built within the CPU to speed up the more immediate processes, requiring only a single CPU cycle to process. They only run a few hundred bytes in size, however, they can't do too much at once. More processor registers are very expensive, but if the system will be running multiple functions at once and can't afford to be slow, then investing in this might be a good idea.
Below these processor registers in the memory hierarchy is the cache memory. There are usually multiple levels of cache memory. Mostly these serve as an in between for the top of the hierarchy and the bottom. These are denoted by L1, L2, etc. The difference between these levels is striking: whereas the top level will only require a few CPU cycles to access, the bottom may require tens or hundreds, depending on the number of levels. Things held in cache memory are typically things that are likely to be used again in the near future.
The next level of the memory hierarchy is the main memory. This typically contains multiple gigabytes, and holds things that are to be used at some foreseeable future point, but maybe not quite as often as things in cache memory.
At the very bottom of the memory hierarchy is storage. This is the slowest of the slow, but on the other hand, it can hold hundreds or hundreds of thousands of gigabytes of data. These tend to be very cheap, so large amounts of rarely accessed data may be very cost effectively stored with a very storage-heavy computer.
Continue reading on the second page to learn about the Memory Management Unit, or MMU and how Linux manages these different types of memory.