How does a processor determine what data it stores in memory (RAM, cache, registers)?

When the processor runs the program, does it move all the data along the memory pipeline? Then any piece of data will be moved from the ram-> cache-> registers so that all the data that was running on the CPU is logged at some point. Or does he somehow choose the code that he uses in these faster types of memory, or can you as a programmer choose the specific code that you want to save, for example, the cache for optimization?

+4
source share
1 answer

The answer to this question is a whole course in itself! A very brief summary of what (usually) happens is that:

  • You, the programmer, indicate what is happening in RAM. Well, the compiler does this on your behalf, but you control it by how you declare your variables.
  • , , CPU MMU , , , "", . ( ) , . , MMU "-", . , , . MMU, , ..
  • - , , ALU ( ) , . , .

(DMA), , . ( UART /). , ​​.

, , , , , , , . ( " " C: , .) , . - , . ( Leeor .)

+6

Source: https://habr.com/ru/post/1570455/


All Articles