Fireship · @fireship

How a CPU Works in 100 Seconds // Apple Silicon M1 vs Intel i9

Uploaded May 6, 2021 · Length 12:44

How a CPU Works in 100 Seconds // Apple Silicon M1 vs Intel i9

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.

  1. 0:00

    the central processing unit or cpu is

  2. 0:02

    like the engine in your car

  3. 0:04

    or the brain in your skull and is like a

  4. 0:05

    really fancy calculator

  5. 0:07

    used to run the applications on your

  6. 0:09

    computer when you write software in a

  7. 0:10

    language like javascript or python

  8. 0:12

    you're actually writing a set of

  9. 0:13

    instructions that will be executed as

  10. 0:15

    machine code by a cpu

  11. 0:17

    which itself is a carefully crafted

  12. 0:19

    piece of metal and silicon that contains

  13. 0:21

    billions of tiny transistors

  14. 0:23

    or on off switches that represent ones

  15. 0:25

    and zeros

  16. 0:26

    to perform mathematical calculations a

  17. 0:28

    cpu will combine multiple transistors

  18. 0:30

    together to form logic gates

  19. 0:32

    for example and will take two binary

  20. 0:35

    inputs and validate that both are true

  21. 0:37

    to produce a true output it only takes a

  22. 0:39

    few basic logic gates to solve highly

  23. 0:41

    complex computational problems

  24. 0:43

    modern chips contain billions of

  25. 0:44

    transistors and they can be flipped on

  26. 0:46

    and off billions of times per second

  27. 0:48

    the state of the cpu is synchronized by

  28. 0:50

    an oscillator known as the clock

  29. 0:52

    generator

  30. 0:53

    in general the more times the clock can

  31. 0:54

    pulse per second the faster the cpu can

  32. 0:57

    compute and is normally measured in

  33. 0:58

    gigahertz

  34. 0:59

    gamers will sometimes overclock their

  35. 1:01

    cpus to gain more performance

  36. 1:03

    at the cost of higher temperatures and a

  37. 1:05

    lower life expectancy now in order to

  38. 1:07

    run applications it interacts with the

  39. 1:09

    system memory or ram

  40. 1:10

    in a series of four steps known as the

  41. 1:12

    machine or instruction cycle

  42. 1:14

    step one is the fetch phase think of a

  43. 1:16

    software program as a set of

  44. 1:18

    instructions stored in the ram the cpu

  45. 1:20

    has registers to temporarily store the

  46. 1:22

    address and memory that it wants to

  47. 1:24

    interact with the program counter starts

  48. 1:26

    at 0

  49. 1:26

    and copies that address to the memory

  50. 1:28

    address register then the control unit

  51. 1:30

    sends out a signal to copy the data from

  52. 1:32

    that address

  53. 1:33

    to the instruction register at which

  54. 1:35

    point it needs to figure out how to use

  55. 1:37

    this instruction

  56. 1:38

    in the decode phase the control unit

  57. 1:40

    parses the actual bits in the

  58. 1:41

    instruction

  59. 1:42

    most importantly the opt code contains

  60. 1:44

    the instruction like add or subtract and

  61. 1:46

    the operand is the address in memory to

  62. 1:48

    perform that operation on

  63. 1:50

    the final execute stage takes the

  64. 1:52

    decoded information and passes it as

  65. 1:54

    electrical signals to the relevant parts

  66. 1:56

    of the cpu

  67. 1:57

    the arithmetic logic unit or alu can

  68. 1:59

    perform math on the data and then store