Skip to main content

Computer Architecture

Resource:

1. Components

1. Disk

  • A disk is the primary storage device for data in a computer. It is persistent, meaning the data will be persisted even when the computer crashes or is turned off.
  • How much information the disk can store is usually measured in TBs (terabytes). (10^12 bytes)

1. HDD - Hard Disk Drives

  • Mechanical, and have a head/write head.
  • The older they get, the more wear and tear they collect, which slows them down over time.

2. SDD - Solid-state Drive

  • Significantly faster and more popular.
  • They do not have moving parts and rely on reading and writing data electronically (similar to RAM).

2. RAM - Random Access Memory

  • Used for storing information but is typically a lot smaller in size compared to disk drives.
  • RAM is much more expensive than disk space.
  • Reading and writing to RAM is significantly faster than disk (at least 10–100 times faster).
  • It is often described as volatile memory, → the data gets erased once the computer is shut down. This is why it is important to save your work to disk before shutting down your computer.

The RAM and disk do not directly communicate with each other. They rely on the CPU to facilitate data transfer between them.

3. CPU - Central Processing Unit

  • The brain of the computer, it reads/writes from the RAM and disks, it’s the intermediary between the RAM and disk.
  • CPUs can have multiple cores in modern systems, allowing them to handle multiple tasks simultaneously.
  • All computations are done within the CPU, such as addition/subtraction/multiplication etc. This occurs in a matter of milliseconds.
    • It fetches instructions from the RAM, decodes those instructions, and executes the decoded instructions.
    • On the lowest level, all these instructions are represented as bytes.
  • The CPU also consists of a cache. A cache is extremely fast memory that lies on the same die as the CPU.

4. Caches

  • Most CPUs have an L1, L2, and L3 cache, which are physical components that are much faster than RAM and disk, but they only store data on the order of KBs or tens of MBs.
  • The CPU can choose a portion of the RAM that we’re writing/reading to frequently to store in the cache. → performing frequent tasks faster.
  • Whenever a read operation is requested, the CPU checks the before the RAM and the disk.
    • If data requested is in the cache, and is unchanged since the last time it was accessed, it will be fetched from the cache.

Caching is important concept applied in many areas. Web browsers use cache of frequently accessed web page to load them faster. However, in this case, the browser is storing the cache on the disk, because it’s faster to read from the disk than making internet requests.

2. Moore’s Law

  • Moore's Law is an observation, which suggests that the number of transistors in a CPU doubles every two years. (The speed doubles every two years.)
  • In recent years, however, the number of transistors, and thus the speed of the computers, has begun to plateau. → there are limitations to what an individual computer can do.
  • We can solve bigger problems when we combine multiple computers together.

There are a lot of parallels between computer architecture and when it comes to designing a distributed system. Understanding how data is stored, accessed, and processed within a computer system forms a critical foundation for designing larger, distributed systems.