Question

Why does memory access take more machine cycles than register access?

Asked by: Aliencenet

Why does memory access take more machine cycles than register access?
Assembly Language for Intel-Based Computers.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-09-09 at 13:45:39ID24719513
Tags

assembly language

Topic

Assembly Programming Language

Participating Experts
3
Points
500
Comments
4

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Some INTEL assembler
    Who is able to give me a DEEP explanation for the next 3 assembler lines ? MOV EAX,4[ESP] MOV EAX,[EAX] MOV 4[ESP],EAX The assembler is for INTEL 386EX and it is used inside an assembler procedure called by a C routine. The compiler is the CAD-UL by ISI. Thanks
  2. Cycling batch file slows to crawl or fails
    I have a batch file in a command prompt, running in a cycle, checking for the arrival of files in a certain directory. I've noticed that the file slows down after some time, and then, inexplicably, will fail to register the IF EXIST condition even after the files arrive! But ...
  3. PCI burst write cycles
    Hello, I'm currently developing a device driver to support our custom made PCI board. I can read/write a buffer from/to our PCI device but the system does not use burst write cycles. Does anyone know how I can use burst write cycles to write from the PC memory to my PCI car...
  4. registers and debug
    debugger shows various registers like eax, ebx, ecx, edx, esi,edi,ebp,edp,eip, some flags and floating point registers. can someone explain the use of these registers while debugging? i tried out many websites but couldn't get good understanding. it would be great if some one...
  5. Counting CPU cycles to measure time
    Hi, Is there any way that I can read the TSC (Time Stamp Counter) register (available in Intel processors since Pentium) at different times, calculate how many cpu cycles has passed and convert that to a time value? I want to do this on an Intel machine running Linux Debian 3...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: alefzeroPosted on 2009-09-09 at 13:58:41ID: 25295485

Well, because the memory runs slower than the CPU, duh? And the memory is a "peripheral" to the CPU, so it has to actually process the read/write request, which takes some time. That's what all the memory latencies are about.
In modern Intel CPUs, the memory runs about two, three, even four times slower than the CPU itself. And added to that it actually takes several memory cycles (around twenty, actually) to process a random access read request.
The registers, on the other hand, are already "in the CPU" (let's forget for now about all the nuances of RISC architecture, register assignment and renaming etc...), so they "run" as quickly as the CPU - because they are the CPU. So a register operand does not slow the procesor pipeline (let's forget again, now about the various stall conditions in superscalar architecture, like read-after-write etc)

 

by: Infinity08Posted on 2009-09-09 at 14:59:32ID: 25295969

This difference in access speeds is the precise reason why there's a memory hierarchy consisting of for example :

        the CPU registers
        the L1 cache
        the L2 cache
        the main memory (RAM)
        the virtual memory (on hard disk)

getting slower towards the bottom of the list, but also less expensive (fast memory costs money) and bigger (because it's cheaper).

Getting the right data in the right location at the right time is a very complex subject, but when done right, the speed-up of your code can be huge (because it has to wait less for data).

 

by: t0t0Posted on 2009-09-10 at 10:40:46ID: 25302510

the speed is related to the material used in their manufacture and the type of memory and technology.

cpu memory is made from gallium arsenide (well, it was when I last looked - 20 years ago) which is fast - around 2ns access time.

ram is made from something else (i can't remember - you'll have to google it). it's access time is slower.

dram (is dynamic ram) which means it's contents require constant refreshing otherwise it gets corrupt. this takes time and therefore adds to the overhead.

sram (is static ram) which does not need to be refreshed constantly. this is quicker than dram.

finally, there used to be EDO and pipelining technologies which increases access speeds of ram. nowadays it's DDR, DDR2, DDR3 etc... DD4 is due out in 2012. these technologies increase throughput and therefore, increase ram access times.

the speed of standard ram is about 10ns (compared to 2ns for cpu registers - ie, the gallium arseninde stuff). but adding the improved technoloogies has reduced this to below 5ns.

it would be lovelly to have ram built entirely from gallium arsenide however, the reason why it isn't is due to it's high cost.

if any of this is out of date then i apologise for not keeping up with technology....

i hope that helps you.

 

by: alefzeroPosted on 2009-09-10 at 12:42:53ID: 25303536

t0t0:
Let me set some things straight. You are correctly stating that the physical material from which CPUs and RAM modules are made is a bit different. But this does  not influence the access latencies, only the physical properties of the part (like, semiconductor parameters etc).
You are correct in saying that moddern PC RAM is dynamic ram - it needs to be refreshed periodically, during which time no read/write operations can occur.
The pipelining technologies and DDR-x RAMs, as you correctly state, increase throughput. But the latency stays the same.
"Speed" of standard ram can be calculated using the RAM's clock speed and the various latencies. Modern DDR3-1333 DRAM runs on 667MHz actually (DDR stands for Double-Data-Rate). Compare that to the not-unheard-of 3.3GHz of a modern CPU - already five times slower. That means that one "memory clock cycle duration" is 1.5ns (nanoseconds), compared to the 300picoseconds of the CPU. The DDR3 RAM takes some time to process a random access read request, for example. This time comprises of the various latencies (http://en.wikipedia.org/wiki/SDRAM_latency) - those are the well-known row address strobe latency, RAS-to-CAS latency, column access strobe latency, the actual "data read" latency and other latencies.
In our DDR3 one-byte random access example, these latencies can add up to over 20 - 30 memory cycles before the requested data is made available on the data bus. That means about 30 to 50 nanoseconds of typical latency between the random access command and the data available result. Sequential reads and block "burst" reads (CPU cache refreshes) are typically much faster, because either a) the data is already in CPU cache or b) the RAM doesn't have to go through all the necessary phases again, because it is pipelined in much the same way a CPU is.
If you were counting with me, the CPU managed to do about 100 cycles during that time (it is 5 times faster, remember). In ideal conditions, using the full power of its 4 cores x2(HT) architecture, it effectively could do almost 1000 cycles had it not been waiting for the memory, for example by computing something in the ALU.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...