Chapter 2 of 8
Before writing code, it helps to understand what's actually happening inside a computer. You don't need to be an electrical engineer โ but knowing the basics will make everything else make more sense.
At the lowest level, a computer is made of billions of tiny switches. Each switch is either ON (1) or OFF (0). Everything โ every image, song, video, message, and program โ is stored as a long sequence of these 0s and 1s. This system is called binary.
ANALOGY
Real-world analogy: Light switches. Imagine a room full of light switches. Each switch is either on or off. By combining millions of switches in specific patterns, you can represent any number, letter, colour, or instruction. That's essentially what a computer processor does โ at billions of operations per second.
This is where programming languages come in. When you write code in JavaScript or Python, a special program called a compiler or interpreter translates your human-readable instructions into the machine instructions the computer actually understands. You write English-like code โ the computer converts it โ the processor executes it.
| Part | What it does | Real-world equivalent |
|---|---|---|
| CPU (Processor) | Executes instructions โ the brain | A chef cooking the meal |
| RAM (Memory) | Temporary workspace while running | The kitchen counter โ active workspace |
| Storage (SSD/HDD) | Long-term file storage | The fridge โ stores things permanently |
| GPU | Handles graphics and heavy parallel tasks | A team of assistants for visual work |
| OS (Operating System) | Manages all programs and hardware | The restaurant manager โ coordinates everything |
A program is a file stored on your computer's storage. When you run it, the operating system loads it into RAM and the CPU starts executing the instructions one by one. When you close the program, it's removed from RAM. That's why RAM is called 'temporary' โ it only holds what's currently running.