5
3
What is the difference between cache memory and registers?I know them by definition but why do we need the other when we have any one of them?
5
3
What is the difference between cache memory and registers?I know them by definition but why do we need the other when we have any one of them?
10
Registers are:
Cache is:
My question might go a bit off the question I asked but can we make a computer that is totally based on cache?So that it may be a zero state machine. – None – 2010-11-10T18:25:53.323
2At the very least a CPU needs an Instruction Pointer register so that it knows what it's trying to run. So, no. – Ignacio Vazquez-Abrams – 2010-11-10T18:28:24.430
1
to make it simple processor register are much faster than cache memory, and unlike cache memory that store data, the processor register store instructions that manipulate data, by instruction i mean (address , opcode, small chuck of data that we need to operate in ...).
Right. The CPU dpesn't fetch opcodes (instructions) from registers; but many instructions (take ADD for example, which adds two numbers and stores the result somewhere) can either get their data from a register, or a memory location. – LawrenceC – 2010-11-14T13:26:33.017
1
Registers are controllable, you can store and retrieve information from them. There are very few of them (on x86 at least), but very fast. A lot of them have very particular uses (Instruction Pointer, Base Pointer, etc) and should not be used by the user.
Cache is almost completely uncontrollable. You can invalidate it (INVD and WBINVD privileged instructions) but you cannot explicitly store or retrieve information from it. It is also placed between memory and the CPU, so you don't even know whether it's working or not, unless you do timing comparisons. It is intended to be completely transparent in operations. Also, they can be hierarchical and fairly large (comparatively to registers at least).
0
So I guess what you're wondering is, since it's all just stored bytes, why single some of them out as registers, and call the rest cache?
Well, it's been a while since I programmed on the PIC but if I remember correctly the PIC does not distinguish between "memory" and "registers", and calls all of its memory "registers"; they all share an address space. Some of these are special purpose, for things like IO ports, but most are general purpose.
Is this a good idea? Well it's obviously not a terrible one because the PIC is a reasonably successful microcontroller. But you can see that this would have limitations when you start scaling up to add more memory and a faster clock. (I am not an EE so take this with a grain of salt). The advantage to singling out a few particular registers is that they can be connected to fewer things: all the wires attaching to a circuit add capacitive loading which slows it down. On a modern machine with kilobytes of cache that would be a lot of loading for something you want to access basically every instruction. I imagine there might also cost advantages because you could make the registers out of wide, fast transistors, and then scale down for the cache which doesn't need to be as fast.
0
A register holds instructions or data that the processor is working on or will be working on shortly. They form part of the processor and are capable of holding only one item at a time.
A cache memory is an area in the computer where codes and instructions are stored.
As the accepted answer from 4 years ago says: cache just sits between the cpu and main ram, which is where instructions and data are stored. – psusi – 2014-03-20T00:21:58.413
0
Cache has a content-addressable nature -- a given row (at least conceptually) contains both data and address as dynamic values, so that the row will recognize its own address and respond, vs having to be addressed with a specific externally-generated hard-wired address.
It is this content-addressable nature that defines something as "cache".
(Of course in practice cache is often implemented with relatively conventional "hard-wired address" RAM, and an address translation unit on the side, but it's not really a "cache" until you combine the two.)
http://stackoverflow.com/questions/14504734/cache-or-registers-which-is-faster – Ciro Santilli 新疆改造中心法轮功六四事件 – 2017-03-26T22:41:49.437