System Design
Computer Architecture

Computer Architecture

Disk (HDD/SSD)

  • persistent
  • primary storage
  • most modern computers are in terabytes (TB)

RAM

  • random access memory
  • typically a lot smaller in size compared to disks (much more expensive)
  • 1GB - 128GB typically
  • significantly faster read and writes vs disk
  • writing takes 1MB 1/10^6 seconds vs 1/10^3 (estimates)
  • open memory == data erased once computer shuts down
  • RAM and disk do not directly communicate, relies on CPU to faciliate data transfer

CPU

  • intermediary between RAM and disk; brain of computer
  • all computations done within CPU
  • consists of a cache

Caches

  • most CPUs have L1 L2 and L3 cache -> physical components that are much faster than RAM
  • only stores data in the order of KBs or tens of MB
  • Whenever a read operation is requested, the cache is checked before the RAM and the disk. If the data requested is in the cache, and is unchanged since the last time it was accessed, it will be fetched from the cache, and not the RAM.
  • Reading and writing to the cache is a lot faster than RAM and disk. It is up to the operating system to decide what gets stored in the cache.

Moore's Law

  • Moore's Law of how number of transistors in CPUs doubles every two years approximately is starting to break (aka speed of computers start to plateau), which means individual computers have limitations
  • Basically, we can solve bigger problems by combining multiple computers