How does RAM keep up with the CPU?

0

I am trying to understand how RAM manages to keep up with the CPU. Here is a breakdown of why I'm under the impression it wouldn't:

  1. The clock speeds of modern CPUs are often greater than the clock speeds of RAM modules (e.g. a 2.4GHz laptop processor vs a 2133MHz RAM module)
  2. Such CPUs often have multiple cores, allowing instructions to be executed at a greater rate than the clock speed
  3. These CPUs may also employ single-core parallelism techniques to execute more instructions per core than there are clock cycles
  4. Given this, instructions are executed at a far greater rate than the RAM frequency
  5. At most, you can fetch the contents of one address from RAM per RAM clock cycle
  6. With perhaps the exception of the BIOS, instructions must ultimately come from RAM
  7. The demand for instructions to be fetched from memory, therefore, greatly outweighs RAM's ability to provide it

I found an answer by Peter Cordes on this Stack Overflow question, which explains that this problem is addressed by caching and prefetching, but I don't understand how the CPU even gets the opportunity to prefetch, given that the massive rate at which it needs to fetch instructions is seemingly more than can be provided by RAM. This Wikipedia page lists the Intel Core i7 6950X as being able to execute instructions at a rate of 317900 MIPS; using a RAM frequency of 2133MHz, this seems to work out as roughly 150 instructions per RAM clock cycle.

What am I missing?


I just looked at Sydney Hauke's answer to the previously linked question, which states that instructions that the CPU knows will repeat are not re-fetched from memory. Is this on its own sufficient to make up for the speed difference?

VortixDev

Posted 2019-09-22T13:07:54.413

Reputation: 1 106

This question might be more suited for [cs.se]. The short answer is: It doesn’t. – Daniel B – 2019-09-22T13:17:10.757

Back in the day when cache memory for the CPU was economically not feasible, the CPU had to insert wait states while the memory did its thing. That can still happen even with multilevel processor cache, i.e. the CPU has to simply wait for memory, whenever there is a cache miss. – sawdust – 2019-09-22T21:52:32.087

No answers