On this page:
Introduction CPU & Essential Components GPUs & Architecture Pipelining & Hazards Memory Hierarchy Virtual Memory Fetch-Decode-Execute Cycle Cloud Computing Stack Binary & Hexadecimal Data Representation (ASCII, Unicode, Media) Logic Gates & Adders Operating Systems & Utilities Computer Networking Control & Embedded Systems Software Translation (Compilers, Assemblers) Putting It All TogetherYou're reading this on a screen right now. Maybe a laptop, a tablet, your phone. You tap, click, swipe. Things happen instantly. Apps open. Videos play. Games respond to every move.
But what's actually happening inside that device? Most people use computers every day without thinking about the machinery underneath. It's like driving a car without knowing what's under the hood. You don't need to know. It just works.
Understanding how computers actually work changes everything. You start to see why some programs are fast and others slow. Why your phone heats up during certain tasks. Why adding more RAM helps. Why programmers talk about "efficiency" and "optimization."
This isn't just theory. This is how modern computing works at the most fundamental level—from the CPU processing billions of calculations per second to the operating system juggling dozens of programs simultaneously.
The CPU (Central Processing Unit) is the primary component of a computer that performs instructions defined by software. It executes the fetch-decode-execute cycle to process data and control all other hardware components.
Clock Speed: Measured in GHz (Gigahertz). A 3 GHz processor has a clock that ticks 3 billion times per second. Each tick is an opportunity to execute a basic operation.
Multi-Core Processors: Contains two or more independent processing units (cores) on a single chip. Allows Parallel Processing where different cores work on different tasks (e.g., core 1 renders video, core 2 scans for viruses) actually simultaneously.
Multithreading: Dividing a program into multiple independent sequences (threads). Note: Software must be written specifically to take advantage of multi-core hardware.
Graphics Processing Units (GPUs) are specialists designed to rapidly process and render graphics by performing parallel operations on massive blocks of data simultaneously.
The Architecture Difference: While a CPU has 4-32 powerful cores, a modern GPU has thousands of small, simple cores (e.g., NVIDIA RTX 4090 has 16,384 CUDA cores). This achieves enormous throughput for repetitive tasks.
| Feature | CPU | GPU |
|---|---|---|
| Core count | 4-32 powerful cores | 1,000s of simple cores |
| Design philosophy | Low latency, versatile | High throughput, specialized |
| Best for | Sequential tasks, complex logic | Parallel tasks, repetition |
| Example tasks | Running OS, complex calculations | Graphics, AI training, mining, scientific computing |
Pipelining is a technique where multiple instructions are overlapped during execution by dividing the process into discrete stages. Imagine a car factory where one worker builds an entire car (slow) vs an assembly line where workers perform one task and pass the car along (fast).
Without pipelining, 4 instructions might take 16 clock cycles. With pipelining, they can be completed in just 7 cycles. For large numbers of instructions, pipelining approaches a 4x speedup.
| Clock | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
| Inst 1 | IF | ID | EX | WB | - | - | - |
| Inst 2 | - | IF | ID | EX | WB | - | - |
| Inst 3 | - | - | IF | ID | EX | WB | - |
| Inst 4 | - | - | - | IF | ID | EX | WB |
IF: Fetch | ID: Decode | EX: Execute | WB: Write-back
Why multiple types? Cost and physics. Fastest memory is expensive and large; you can't fit GBs of cache on a CPU chip economically.
The OS creates an illusion of more physical memory by using secondary storage. When RAM fills up, the OS moves less-used data to the hard drive (swap space) to free RAM for active programs.
Paging: Memory is divided into fixed 4KB pages. Programs are split across them, eliminating external fragmentation.
Swapping: Moving pages to disk. When done excessively, it causes Thrashing (severe lag) because disk access is 1000x slower than RAM.
Benefits: Run more programs than physically possible. Drawback: Significant performance hit during heavy swapping.
This cycle happens billions of times per second. Every program breaks down into simple instructions executed in this sequence.
Program: Add two numbers from memory.
LOAD R1, 500LOAD R2, 504ADD R1, R2STORE R1, 508Step-by-Step for Instruction 1:
Today, much of what we do happens "in the cloud"—on remote servers accessed via the internet.
Hosted apps accessible via browser (e.g., Gmail, Netflix).
Development environment (e.g., Heroku, Azure App Service).
| Model | You Manage | Provider Manages | Example |
|---|---|---|---|
| SaaS | Your data | Everything else | Gmail, Microsoft 365 |
| PaaS | Applications, data | Infrastructure, OS, runtime | Google App Engine |
| IaaS | OS, apps, data | Physical hardware | AWS EC2 |
Computers work with electricity (High voltage = 1, Low = 0). Every piece of data—text, images, programs—is ultimately stored as binary.
Binary to Decimal: 11010₂ = (1x16) + (1x8) + (0x4) + (1x2) + (0x1) = 26₁₀
Decimal to Binary: 45 ÷ 2 (remainders): 45(1), 22(0), 11(1), 5(1), 2(0), 1(1) → 101101₂
Binary to Hex: Group 1010 1111 0100 1110 → AF4E₁₆
| Dec | Bin | Hex |
|---|---|---|
| 10 | 1010 | A |
| 11 | 1011 | B |
| 12 | 1100 | C |
| 13 | 1101 | D |
| 14 | 1110 | E |
| 15 | 1111 | F |
Computers represent everything—text, images, sound—as numbers.
At the lowest level, computers are built from transistors—tiny electronic switches. By combining them, we create logic gates.
| A | B | AND | OR | XOR |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
NAND and NOR are universal—any circuit can be built using only these gates. NAND outputs 0 only when all inputs are 1.
Half Adder: Adds two bits. XOR for Sum, AND for Carry.
Full Adder: Adds three bits (A, B, and Carry_in from previous). Built from two half adders + an OR gate.
| A | B | C_in | Sum | C_out |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 |
| ... | ... | ... | ... | ... |
An OS is system software that manages hardware and acts as an intermediary between users and computer hardware. Without an OS, every program would need to directly control hardware, which is impossibly complex.
CLI (Command Line): Text-based (Terminal). Powerful, efficient for experts, scriptable, but steep learning curve.
GUI (Graphical): Visual icons/windows. Intuitive and easy to learn, but higher resource usage.
Specialized programs like Disk Defragmentation (reorganizes HDD sectors), Compression (ZIP), Antivirus, and Backup utilities.
A control system regulates the behavior of devices using control loops. Examples: Cruise control, thermostats, autopilot.
Executes predetermined actions without monitoring output. Example: Traditional washing machine timer runs regardless of cleanliness.
Continuously monitors output and adjusts. Example: Thermostat compares temp to setpoint and adjusts heating.
Specialized computers for dedicated functions within larger systems. Characteristics: Dedicated function, Real-time requirements, Limited resources, and High reliability.
Examples: Car engine controllers, medical devices (pacemakers), industrial robots, and traffic light controllers.
Networks allow computers to communicate and share resources.
Topologies: Star (central hub), Bus (single cable), and Mesh (all-to-all redundancy).
Common Protocols:
Humans write in high-level languages (Python, C++), but computers only execute binary Machine Code. We bridge this gap using translators.
Java: Compiles to Bytecode, then JVM interprets. JIT (Just-In-Time) compilation compiles frequently-used code to machine code during runtime for near-native performance.
Assemblers: Translates Assembly Language (MOV, ADD) directly into binary machine code. One-to-one mapping.
The CPU fetches, decodes, and executes billions of instructions per second. The Control Unit orchestrates, the ALU calculates, and Registers hold working data at incredible speed.
From logic gates forming circuits to operating systems managing resources, every layer of the computer works in harmony to turn ones and zeros into the apps, games, and tools we use every day.