What Is a Computer?
A computer is a programmable device that processes, stores and retrieves data according to a set of instructions.
A computer:
- It accepts input
- This input can include both data to be processed and programs that tell the computer what to do
- The computer processes the input according to the instructions it was programmed to follow
- It produces output from that processed data
- That data can be stored and modified for future use
Computers are versatile because they can perform logical operations, and both data/programs can be stored and reused.
They are deterministic: given the same input, they always produce the same output. This is why they are accurate and highly reliable.
Computers follow instructions exaclty as given. Errors only come from incorrect programs (human error) from hardware failures (very rare).
They are also extremely fast: modern computers can perfom millions or billions of operations per second!
Automation is another key property: once programmed, computers execute instructions automaticaly without human intervention.
The Foundation
At the foundation of all computation are logic gates.
Logic gates are what enable computers to make decisions. They are based on Boolean algebra.
A logic gate can be any device that can reliably produce 2 distinguishable states and enforce conditional behaviour.
To perform logic, a device must have:
1 - Two stable states
Examples:
- ON / OFF
- Open / Closed
- True / False
- 1 / 0
This is the binary requirement. A logic gate must reliably produce 2 distinct states, and nothing in between.
2 - Repeatability
Same input → Same outputThe output must be determined only by the input state. A gate cannot produce different outputs for the same set of inputs.
If a device satisfies these two rules, it can perfom logic. A logic gate can be built from almost any material, as long as it obeys those rules.Examples
- Mechanical devices: Logic can be implemented using dominoes.
- Fluid devices: Logic can be implemented using water flowing through tubes, controlled by valves.
Why Transistors?
We use transistors because they are the fastest, smallest, cheapest, and most reliable way to switch between states.
Early computers used relays and vacuum tubes:
- Relays are slow, mechanical, noisy and wear out
- Vaccum tubes switch faster but consume large amounts of energy and generate significant heat
Transistors solved these problems:
- They are silent
- Extremely reliable
- Energy efficient
- And can be manufatured at nanometer scale
This is why moden computers use transistors
The fundamental logic gates
Now that we know why transistors are used, we can explore the 3 most basic logic gates
- NOT gate
- AND gate
- OR gate
All computers are built from logic gates.
In essence, a computer processor is just millions (or billions) of transistors wired together according to laws of logic, controlling the flow of electricity to produce results. All inside a tiny package called microchip.
The combination of milions of those logic gates allows computers to produce results at extraordinary speed.
Why these three gates?
NOT, AND, and OR are the simplest set of gates that can construct any possible logical function, no matter how complex.
There are other common logic gates: NAND, NOR, XOR, and XNOR. But all of them can be built using only NOT, AND, and OR gates. These 3 are the fundamental building blocks of Boolean logic.
These gates also align with how humans naturaly think and reason. Logic gates are digital versions of the logic we already use in everyday decision-making.
In the next article, we'll break down the NOT, AND, and OR gates.