lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

Cache memory.md (1696B)


      1 +++
      2 title = 'Cache memory'
      3 +++
      4 # Cache memory
      5 very small, very fast
      6 
      7 between processor and main memory, its there to be a wingman and make the main memory look good in front of the processor
      8 
      9 locality of reference — many instructions in localised areas of the program are executed repeatedly during some time period
     10 
     11 - temporal — recently executed is likely to be executed again soon
     12 - spatial — instructions close to a recently executed instruction are likely to be executed again soon
     13 
     14 basically, whenever some info is needed, it should be brought into the cache. and might as well grab data at adjacent addresses too.
     15 
     16 cache block/line — set of contiguous address locations of some size
     17 
     18 the mapping function specifies correspondence between main memory blocks and those in cache
     19 
     20 replacement algorithm decides which blocks to remove to make space for a newly referenced word
     21 
     22 cache hits
     23 
     24 - processor issues read/write requests
     25 - cache control circuitry determines if the requested word is in cache
     26 - if read hit, data is read from cache & main memory is not involved
     27 - if write hit, two options:
     28     - write-through — both cache and main memory are updated
     29     - write-back — update only cache location and mark block with an associated flag bit (dirty/modified bit), main memory is updated later
     30 
     31 cache misses:
     32 
     33 - read miss — the block containing the requested word is copied from main memory into cache, then the word is forwarded to the processor
     34     - load-through — alternative approach where word is sent to processor as soon as it’s read from memory. less waiting time for processor, more complex circuitry.
     35 - write miss — info is written directly into main memory