Why is register faster than memory?

Source: Internet
Author: User

Article source: Click to open the link reason one: the distance is different

Distance is not the main factor, but it is best to understand, so put it on the front. The memory is CPU far away, so it takes longer to read.

To3GHzOfCPUFor example, the current can oscillate every second30Billions of times, each time consuming about0.33Na seconds. Light in1In nanosecond time, you can move forward.30Cm. In other words,CPUWithin a clock cycle, the light can go forward10Cm. Therefore, if the memory distanceCPUMore than5Centimeters, it is impossible to complete the reading of the data in a clock cycle, which does not take into account the limitations of the hardware and the current actually does not reach the speed of light. In contrast, registers areCPUInside, of course it will be quicker to read.

The distance to the desktop computer has a large impact on the phone is much smaller. Cell phoneCPUThe clock frequency is relatively slow (iPhone 5sFor1.3GHz), and the phone's memory is next toCPU

Reason two: different hardware design

The new Apple company launchediPhone 5sCPUIsA7, The Register has6000More than31A64Bit register, plus32A128Bit register). andiPhone 5sThe memory is1GB, which is about80Billion bits (bit)。 This means that high-performance, high-cost, high-power designs can be used on registers,6000Multi-bit, but not in memory. Because the cost and energy consumption of each bit is increased by just a little, it will be amplified80Billion times.

In fact, the design of the memory is relatively simple, each bit is a capacitor and a transistor, and the register design is completely different, more than several electronic components. And after the power, register the transistor has been a power, and the memory of the transistor only used to have electricity, useless to the power, this is beneficial to power saving. These design factors determine that the register is faster than the memory read speed.

Reason three: different ways of working

Registers work in a very simple way, with only two steps: (1) Find the relevant bits, (2) read the bits.

The way memory works is much more complicated:

  1. Pointer to the data that was found. (The pointer may be stored in the register, so this step includes the full work of the Register.) )

  2. The pointer is sent to the Memory Management Unit ( MMU ) by MMU translating the virtual memory address into the actual physical address.

  3. The physical address is sent to the memory controller ( memory controller ), and the memory controller finds out which memory slot () it is on bank .

  4. Determine which memory block () The data is on chunk , and read the data from that block.

  5. The data is sent back to the memory controller, sent back CPU , and then started to be used.

The workflow of memory is a lot more than the register. Each step creates a delay, which accumulates to make the memory much slower than the register.

To mitigate the huge speed differences between registers and memory, hardware designers have made a lot of effort, including CPU setting up caches internally, optimizing CPU how they work, and trying to read all the data from memory to the command at once, and so on.

Why is register faster than memory?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.