A Memory device that allows data items to be read or written in essentially the same amount of time irrespective of the physical location of data inside the memory. The RAM for your main memory is DRAM

Warning

The words “memory” and “RAM” may be used interchangably! Keep in mind that they mean different things. See Memory for more info.

Performance

  • Accessing (modern) memory is SLOW! 100 times slower than one Clock Cycle
  • Why would we consider loading values into registers before computing with them? Doesn’t that use more instructions?
    • Yes it does, but it saves memory accesses because we can re-use the values
  • You can usually do stuff while accessing memory

Allocation

Heap Heap Allocation Stack Stack Frame malloc calloc realloc sbrk

Varieties

TLDR: small or fast but not both

DRAM

Dynamic RAM, typically used as the main RAM Slower but denser

  • Benefits ✅
    • Each bit is stored in a cell which only needs a transistor and a capacitor, which is dramatically fewer components than a typical Flip Flop.
      • More bits/cells can be stuffed into a chip
      • Each bit is cheaper.
  • Drawbacks ❌
    • The capacitor of each cell leaks over time, meaning that the information of each cell will be lost after a certain amount of time.
      • In order to prevent data loss, you need a memory controller to rewrite the memory occasionally (every couple milliseconds).

SRAM

Static RAM Faster but bulkier