System Design Concepts: Computer Architecture
Computers are integral to our daily lives, driving the applications we rely on and forming the backbone of the systems we interact with.
But before diving into the complexities of designing large-scale distributed systems, it’s crucial to grasp the high-level architecture of the individual computer.
Let’s see how different parts of the computer work together to execute our code.
The Hierarchical Architecture of Computers
Every computer operates through a multi-layered system. Each layer is optimized for specific tasks, ensuring efficient functioning of the entire machine.
From Bits to Terabytes: Understanding Computer Memory Units
At their most fundamental, computers operate using binary — comprising only 0s and 1s, known as bits. Here’s a breakdown:
1 Bit: This is the basic data unit in computing, representing either a 0 or 1.
1 Byte: Consisting of 8 bits, a byte is used to depict a single character (e.g., ‘A’) or a number (e.g., 1).
To further expand:
Kilobyte (KB): Roughly 1,024 Bytes.
Megabyte (MB): About 1,024 KBs.
Gigabyte (GB): Approximately 1,024 MBs.
Terabyte (TB): Circa 1,024 GBs.
Disk Storage: The Central Repository of Data
The primary data of computers is stored in disk storage devices.
Examples: This includes Solid State Drives (SSDs) and Hard Disk Drives (HDDs).
Notable Features:
Non-volatility: Even if you power down or reboot your computer, the data remains intact.
Storage Space: Disk storage devices usually range from 100 GBs to several terabytes.
Speed Variance: SSDs, while pricier, offer significantly faster data retrieval than HDDs. For instance, an SSD may have a read speed of 500 MB/s to 3,500 MB/s (depending on the type and quality), while an HDD might offer 80 MB/s to 160 MB/s.
RAM: The Forefront of Data Handling
The Random Access Memory (RAM) acts as the primary holder of data that’s actively used or being processed. When you launch a program, its data — from variables to runtime stacks — is stored here due to its quick read-and-write capabilities.
Examples: Common RAM types include DDR4 and LPDDR5.
Key Points:
Volatile Memory: RAM contents are lost when power is cut off.
Speed: RAM is much faster than Disk Storage, often exceeding 5,000 MB/s.
Storage Spectrum: For typical consumer devices, RAM can range from a few GBs (8 GB, 16 GB, 32 GB), while high-end servers can boast hundreds of GBs (128 GB or more).
Cache Memory: The Speed Maestro
For moments when even the swift RAM isn’t enough, there’s cache memory.
Characteristics:
Size: Cache is smaller yet faster than RAM, typically measured in megabytes.
Speed: Its access times outpace that of RAM, making it ideal for storing frequently used data for optimal CPU performance.
CPU: The Heartbeat of Every Computer
The Central Processing Unit (CPU) is often dubbed the “brain” of a computer. It plays a pivotal role in fetching, decoding, and executing instructions.
Characteristics:
Execution: The CPU interprets and processes operations from our code.
Code Translation: High-level programming languages need to be translated into machine code — a series of 0s and 1s — for the CPU to understand and run them. This conversion is performed by a compiler.
Motherboard: The Unifier of Components
Last but not least, the motherboard (or mainboard) acts as the central hub, connecting all the components mentioned above. From hosting the CPU and RAM slots to providing pathways for data flow, the motherboard ensures the seamless integration and function of all computer components.
Wrapping Up
With an understanding of these foundational concepts, you’re better equipped to delve deeper into the realm of system design.
If you’re eager to learn more, consider exploring topics like system design interview concepts and strategies.
Happy learning!