Thread: typical access time of memory

  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    15

    typical access time of memory

    What is the typical access time of memory in a typical systems today?tens ofcycles?hundreds?thousands? if there is a good web source please tell me so i can read more about it thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    The clock rate of the FSB (assuming you're on some kind of recent Intel/AMD technology) would provide some indication.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    So does your memory latency indicator.

    There was a Google tech talk about this stuff recently. But I cannot find it.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Rough guide:
    L1 cache 0-2 cycles.
    L2 cache 10-20 cycles.
    L3 cache 20+ cycles
    External memory 50-100 cycles.

    This is not set in stone, and it depends on many factors. The above numbers for external memry, by the way, are sort of "good average case", not the worst possible case [which would be that some other device is holding the bus for many hundreds or thousands of cycles].

    A single random memory can also cause up to 4 other memory reads because the page-table needs to be accessed. Those are most likely "not best case" memory reads, so you can easily spend 1000 cycles for a single read in this case. Fortunately, for the common case of reading memory in a fairly linear fashion, it only happens once for every 4KB of memory.

    If the memory isn't marked present in the page-table you'd also incure a page-fault exception, which causes the processor to go off and execute the page-fault handler. If all it needs to do is mark that page present, you may get away with a few hundred cycles overhead and worst case it needs to read the data in from disk - see you next week [or, let's say a million cycles later or so].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Sep 2007
    Posts
    15
    so, typically it's tens of cycles, right?

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Yes, a few tens or more.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help! -Linked Lists, Memory Allocation, Time Steps, Debugg
    By MetallicaX in forum C Programming
    Replies: 2
    Last Post: 03-14-2009, 08:50 PM
  2. Assignment Operator, Memory and Scope
    By SevenThunders in forum C++ Programming
    Replies: 47
    Last Post: 03-31-2008, 06:22 AM
  3. how can we calculate excution time and memory needed
    By elton_fan in forum C Programming
    Replies: 3
    Last Post: 09-25-2007, 08:09 AM
  4. Sending an email in C program
    By Moony in forum C Programming
    Replies: 28
    Last Post: 10-19-2006, 10:42 AM
  5. Memory Access Error when using Strcpy()
    By fgs3124 in forum C Programming
    Replies: 2
    Last Post: 03-15-2002, 03:07 PM