Data Structures and Algorithms

Computer Memory

In order to run code, computers need to keep track of pieces of information like variables.

computer memory diagram

The three main forms of memory are cache, main memory and secondary memory.

Cache
Holds temporary data that is frequently used by the CPU.
  • Extremely fast
  • Limited capacity and very expensive
  • Main Memory
    Holds the current programs, instructions and data.
  • A computer's main memory is RAM
  • Faster than secondary memory, but slower than cache
  • Volatile memory (requires power to retain stored data)
  • Secondary Memory
    Holds data or information that is permanent.
  • Can be a hard drive, disk drive, USB, etc.
  • Slower than main memory
  • No volatile (does not require power to store memory)
  • Stack vs Heap

    Currently working on…