In all computer architecture books we study that Cache memory could be divided into 3 levels (L1,L2 and L3) and its very beneficial to do so. Why don't we use the same approach in case of main memory (RAM). Is there any particular reason that we avoid this?

  • $\begingroup$ I'm not sure what you are hinting to. Explicitly handling memory with different access time has been tried (some DSP and microcontrollers have internal and external memories for instance, and there is the whole set of NUMA multiprocessor architectures). The advantage of using cache is that they relieve the programmer of the task of handling the memory structure, allowing a cleaner hardware software interface and providing performance improvement for existing programs. $\endgroup$ – AProgrammer Mar 20 '13 at 12:15

Cache memory levels are inherently a "subdivision" of main memory (RAM). To speed up the access of RAM, the cache was created using the notion of "The Principle of Locality". Frequently in programs, memory is accessed in locations that are close (local) to previously accessed locations, so it benefits to keep sections of data stored in nearby cache instead of going all the way to the hard drive. Also, cost has historically been a factor. Cache memory is more expensive than memory space on a hard drive, etc. Keep in mind, the landscape of computer memory models is always changing, and it is likely that other methods will be used in the future to speed up memory access. I think the current trend is to move away from mechanical storage devices with moving parts, hence the SSD's.

  • 2
    $\begingroup$ Note: cache size is not determined by just a cost factor: whatever the price you can pay, there is a limit on the amount of memory you can access in a small number of cycles. $\endgroup$ – AProgrammer Mar 20 '13 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.