How is RAM able to acess any place in memory at O(1) speed

后端 未结 4 1524
遥遥无期
遥遥无期 2021-02-04 21:21

We are taught that the abstraction of the RAM memory is a long array of bytes. And that for the CPU it takes the same amount of time to access any part of it. What is the device

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-04 21:42

    The component responsible for dealing with memory accesses is the memory controller. It is used by the CPU to read from and write to memory.

    The access time is constant because memory words are truly layed out in a matrix form (thus, the "byte array" abstraction is very realistic), where you have rows and columns. To fetch a given memory position, the desired memory address is passed on to the controller, which then activates the right column.

    From http://computer.howstuffworks.com/ram1.htm:

    Memory cells are etched onto a silicon wafer in an array of columns (bitlines) and rows (wordlines). The intersection of a bitline and wordline constitutes the address of the memory cell.

    So, basically, the answer to your question is: the memory controller figures it out. Of course that, given a memory address, the mapping to column and row must be easy to calculate in a constant time.

    To fully understand this topic, I recommend you to read this guide on how memory works: http://computer.howstuffworks.com/ram.htm

    There are so many concepts to master that it is difficult to explain it all in one answer.

提交回复
热议问题