Author |
Message |
cyberguy
|
Posted: Tue Sep 15, 2009 9:54 pm Post subject: Is there a difference between cache and regiister? |
|
|
The both are special high speed memory but what is the difference? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
btiffin
|
Posted: Tue Sep 15, 2009 10:18 pm Post subject: Re: Is there a difference between cache and regiister? |
|
|
One difference is that registers may allow for shortcuts in circuitry. A lot of instructions that use registers can be encoded in fewer bytes, less work all round. Speed to read access may be similar (at speeds and distances that electrons need to travel, where the differences will be negligible, ), but you can't really write to cache. It shadows "on the bus" ram, so you benefit from the on the circuit memory, but it's up to the chip to reap those benefits for you, with your hints through locality of reference.
Cheers |
|
|
|
|
|
jernst
|
Posted: Wed Sep 16, 2009 6:40 am Post subject: Re: Is there a difference between cache and regiister? |
|
|
I realize you are talking about processor cache but I just thought I'd point out that the cache isn't necessarily restricted to being on a processor.
For example, I research certain types of wireless networks where caching is a strategy to store common data on the devices in the network so that the neighbouring nodes are able to access the same data without requesting all the way from the source. |
|
|
|
|
|
DemonWasp
|
Posted: Wed Sep 16, 2009 8:29 am Post subject: RE:Is there a difference between cache and regiister? |
|
|
The cache on a CPU is a special set of memory that isn't usually directly accessible; accesses to main RAP are automatically cached in the CPU's cache space by the hardware. Typical sizes are in the orders of a few MB currently. While CPU cache is located on the CPU die, it is further away from the processor than the registers are.
Registers are the "working set" of the CPU and are found as a part of the actual processor. They're built to be ridiculously fast to access, but there's generally less than 1KB worth of registers.
The biggest difference is that registers are directly managed by applications and operating system, while the cache is handled by the hardware. |
|
|
|
|
|
McKenzie
|
Posted: Sun Sep 20, 2009 10:36 am Post subject: Re: Is there a difference between cache and regiister? |
|
|
If you look at assembly programming the difference will be more obvious. It's been a very long time since I've done assembly but I recall you had direct access to the registers and some/most had a special purpose. Although your L1 cache is on chip and very fast, from an assembly programming point of view it is still main memory. |
|
|
|
|
|
|