Fireship · @fireship
How a CPU Works in 100 Seconds // Apple Silicon M1 vs Intel i9
Uploaded May 6, 2021 · Length 12:44
Summary
A CPU is like a brain in your computer, executing instructions and performing calculations using billions of tiny transistors, and modern chips can run multiple computations in parallel using multiple CPU cores.
- cpu architecture
- apple silicon m1
- intel i9
- processor comparison
- system on chip
- cpu efficiency
- developer tools
- javascript performance
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
the central processing unit or cpu is
- 0:02
like the engine in your car
- 0:04
or the brain in your skull and is like a
- 0:05
really fancy calculator
- 0:07
used to run the applications on your
- 0:09
computer when you write software in a
- 0:10
language like javascript or python
- 0:12
you're actually writing a set of
- 0:13
instructions that will be executed as
- 0:15
machine code by a cpu
- 0:17
which itself is a carefully crafted
- 0:19
piece of metal and silicon that contains
- 0:21
billions of tiny transistors
- 0:23
or on off switches that represent ones
- 0:25
and zeros
- 0:26
to perform mathematical calculations a
- 0:28
cpu will combine multiple transistors
- 0:30
together to form logic gates
- 0:32
for example and will take two binary
- 0:35
inputs and validate that both are true
- 0:37
to produce a true output it only takes a
- 0:39
few basic logic gates to solve highly
- 0:41
complex computational problems
- 0:43
modern chips contain billions of
- 0:44
transistors and they can be flipped on
- 0:46
and off billions of times per second
- 0:48
the state of the cpu is synchronized by
- 0:50
an oscillator known as the clock
- 0:52
generator
- 0:53
in general the more times the clock can
- 0:54
pulse per second the faster the cpu can
- 0:57
compute and is normally measured in
- 0:58
gigahertz
- 0:59
gamers will sometimes overclock their
- 1:01
cpus to gain more performance
- 1:03
at the cost of higher temperatures and a
- 1:05
lower life expectancy now in order to
- 1:07
run applications it interacts with the
- 1:09
system memory or ram
- 1:10
in a series of four steps known as the
- 1:12
machine or instruction cycle
- 1:14
step one is the fetch phase think of a
- 1:16
software program as a set of
- 1:18
instructions stored in the ram the cpu
- 1:20
has registers to temporarily store the
- 1:22
address and memory that it wants to
- 1:24
interact with the program counter starts
- 1:26
at 0
- 1:26
and copies that address to the memory
- 1:28
address register then the control unit
- 1:30
sends out a signal to copy the data from
- 1:32
that address
- 1:33
to the instruction register at which
- 1:35
point it needs to figure out how to use
- 1:37
this instruction
- 1:38
in the decode phase the control unit
- 1:40
parses the actual bits in the
- 1:41
instruction
- 1:42
most importantly the opt code contains
- 1:44
the instruction like add or subtract and
- 1:46
the operand is the address in memory to
- 1:48
perform that operation on
- 1:50
the final execute stage takes the
- 1:52
decoded information and passes it as
- 1:54
electrical signals to the relevant parts
- 1:56
of the cpu
- 1:57
the arithmetic logic unit or alu can
- 1:59
perform math on the data and then store


