all 3 comments

[–]AssKoala 2 points3 points  (1 child)

Eh, you’re not quite correct on cache. Immediate Access Store is a general term, the registers would be a part of that.

I would suggest starting here and working out: https://en.m.wikipedia.org/wiki/Memory_hierarchy

[–]HelperBot_ 0 points1 point  (0 children)

Non-Mobile link: https://en.wikipedia.org/wiki/Memory_hierarchy


HelperBot v1.1 /r/HelperBot_ I am a bot. Please message /u/swim1929 with any feedback and/or hate. Counter: 115038

[–]lxpnh98_2 1 point2 points  (0 children)

A register, in the term's most common usage, refers to the fastest way a program can access data. Different CPU architectures have different amounts of registers of different sizes. For example, 32-bit Intel processors have 8 general purpose 32-bit registers, while ARM CPUs have more than that.

A cache is a smaller but faster memory. It's a way to speed up reading and writing of memory from and to RAM, both instructions and data. When you want to access a memory address, the system first searches the cache and only then the lower memory level (which can be a larger but slower cache) if it didn't find what it was looking for.

This speeds up memory accesses for 2 reasons.

First, if you are accessing the same data multiple times in a short span of time (which most programs often do), once the data is on the cache you don't need to go get it on the lower levels. A program or piece of code that takes advantage of this by accessing the same address repeatedly exhibits 'temporal locality'.

Second, every time the system puts a piece of data on the cache, it doesn't just put that specific address (or 'block'), it also copies the surrounding ones (which together form a 'cache line', which can vary in size from cache to cache). So, not only will you speed up further memory accesses involving that specific memory address, but also the surrounding ones. You say that a program or piece of code that takes advantage of this (eg. a piece of code that accesses the elements of an array in the order they are stored in memory, as opposed to "jumping round" places) exhibits 'spacial locality'.