Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

CPU caches are used by exploiting temporal and spatial locality. My question is who is responsible for managing these caches? Is this Operating system that identifies a particular access pattern and then manages (i.e store the data in) cache, using low level OS function calls?

share|cite|improve this question
If caches where managed by software, CPUs would not get anything done time-wise; also, wouldn't that be a catch 22? – Raphael Feb 24 '13 at 16:09
up vote 3 down vote accepted

The CPU cache handles each and every access to memory, that is just too fast to be under software control. It is entirely built into the hardware, either on the CPU chip itself or on the motherboard.

share|cite|improve this answer

The CPU caches are operational from the very moment on when the CPU is powered up. Neither the BIOS nor an OS are strictly speaking “necessary” to control the caches. The BIOS and the OS can change cache configuration settings in the CPU but they don’t control the normal operation, this is all built into the CPU itself.

share|cite|improve this answer
Some processors default to having caching enabled; some default to having it disabled. Having a cache enabled may make it possible for a processor to behave in somewhat controlled fashion even when there's no RAM (e.g. the processor might beep the speaker some number of times); having it initially disabled will avoid the need to disable it before changing any memory-configuration options. – supercat Jun 27 '15 at 18:00

It is totally depends on your hardware platform (For example Nios® II provides some instruction for managing caches). You should read the instruction and assembly language. Some processor provide you some instructions to manage cache in some level. for example WBINVD provides Write back and flush Internal caches; initiate writing-back and flushing of external caches (or INVD).

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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