The Fetch-Execute Cycle: What's Your Computer Actually Doing?

29 481
Tom Scott
Tom Scott - 2 months ago
And away we go with another season of three computer-science videos! A whole team made this happen: pull down the description for all the details! And thanks to Dashlane for sponsoring: you can find more about them at
Bbiigg__ddoogg Gaming
Bbiigg__ddoogg Gaming - 21 day ago
Tom Scott I’ve been where you filmed on a school trial
only funny
only funny - Month ago
You should write a book
Jake the Wolfie
Jake the Wolfie - Month ago
So my phone has a core of just you clicking your fingers billion of times a second?
Sebastian Knight
Sebastian Knight - Month ago
You have a lot of answer, but there is one I would love to know, why do you look old and young in same time ? I had to google your name to find out your age because II was unsure if you when in your 20 or 40 D:
Anish Sarkar
Anish Sarkar - Month ago
You just summed up the elctronics microprocessor semester in a few minutes grt video, and damn the snappy clock was good ,hope you cover video on computer clocks and frequency
Artemius9 - 2 days ago
So good! Thank you so much, Tom! Ouf of the numerous videos I watched on CPU, yours is the best one. Done professionally, straight to the point and extremely easy to understand. Thank you!
Anders Struck
Anders Struck - 15 days ago
Good thing you didn't include pipelining, multi-layer caches or different architectures (register to register vs register to mem, etc)
Overbite Games
Overbite Games - 21 day ago
watching this with a wrist injury has my hands feeling a certain way.

Gull Lars
Gull Lars - 21 day ago
I did code a 16-bit RISC assembly program once for a project, which was an interpreter for ASCII encoded commands and piping of data in an FPGA soft core to control the hardware blocks' functionality. There are some really clever things you can do at the machine code level to make your code small and fast, but to do so correctly is very hard and basically requires you to be able to step through the code flow in your head (or with flowcharts for assistance). If you think refactoring c++, java or C# is hard, try refactoring hundreds or thousands of lines of assembly. Some experience with code golfing can come in really handy then. (our case was on the order of 450-500 lines of an initial assembly implementation getting refactored and reduced to 150 lines because of a need to keep more data state in the limited registers, and a severe penalty for too much memory access to shuffle data between RAM and registers.
Rei - 22 days ago
lil glitchy there
EramsorGR - 25 days ago
I should make a song of Tom saying "fetch, decode, execute"
losthor1zon - 25 days ago
Nice demonstration. I'm only disappointed that you didn't give an example of assembly language so that people can see what it looks like. (I vaguely remember 8080 / Z80 assembler, but any would do.)
Neonic Plays
Neonic Plays - 26 days ago
Register? I thought that was a cache
Claxvii 177th
Claxvii 177th - 27 days ago
Tom, you are a bloody wizard
Daniel Wilson
Daniel Wilson - 28 days ago
Ah, good ol' ECE 4613 -- Computer Architecture. That example's a little on the slow side, though -- typically you'll see some pipelining, with instruction 2 loading while instruction 1 decodes, or rather instruction 2 loading and decoding while instruction 1 goes about the rather slower process of executing (provide the execute phase hasn't been split up and not counting speeding things along some more by making memory accesses another phase in the pipe). That way once the pipe fills up, you're burning through a phase of as many instructions as you have pipeline phases all at once (which gives the components no respite, often making them switch every clock cycle, dramatically increasing heat build-up), making for big ol' gains in throughput when not frustrated by conditional jumps making a missed branch prediction mean dumping large portions of the pipe, leaving a so-called "bubble".
I sure can see why you left it out, though!
Dojel Notmyrealname
Dojel Notmyrealname - 28 days ago
Wouldn't the fetch/decode/execute be happening simultaneously? Most CPU's are pipelined like that in my understanding.
KidUKnott - 29 days ago
I love your The Basics series, Tom. Do keep them coming. I bet it's a lot of work to come up with topics and make them, but they are awesome. I wish I'd watched these ten years ago. Subscribed.
Deeptadeep Roy
Deeptadeep Roy - Month ago
very well explained... definitely better than my microprocessor book... got myexam tomorrow... this definitely helped
Ren Kelb-Lancaster
Ren Kelb-Lancaster - Month ago
This is crazy I can't believe my laptops so hardworking
Cyrus Hale
Cyrus Hale - Month ago
I'm tech enough to use something betting than dashlane.
Dr Logiq
Dr Logiq - Month ago
What's my computer actually doing? Well, Tom... most of the time it's just doing whatever it feels like, which is almost never what I need it to be doing! Blummin' Windows 10 _mumble mumble_ "Don't turn off your computer" _mumble_ ...
This is a great explanation, nice and concise :)
Kiki Tay
Kiki Tay - Month ago
Where can I find more about what's going on in his video's background?
joshmbrown42 - Month ago
As someone who's studied CS in the US, "programme counter" really threw me off for a few seconds.
SteveVi0lence - Month ago
God Bless Scott's Tot's
SteveVi0lence - Month ago
Mine is downloading porn
talzO9 - Month ago
is that a green screen
Hydrochloric Acid
Hydrochloric Acid - Month ago
Are you trying to hypnotize me tom?
Dull Bananas
Dull Bananas - Month ago
you love red
VidarW - Month ago
Great video. Great snapping.
felix34ever1 - Month ago
This helps so much with computer science, now I understand what's actually happening at the bits of the cpu
Arfnudaniack Blue
Arfnudaniack Blue - Month ago
And a system is only as good as the person in charge of designing it.
Isaac Clodfelter
Isaac Clodfelter - Month ago
Higher level programming languages are just the endless cycle of computer programmers programming programs to program their programs just a little better. I love it.
Raymond Mataka
Raymond Mataka - Month ago
Most indirect flex
Maghil vannan
Maghil vannan - Month ago
@Tom Scott can you do a video about how pipelining is done in a basic level
Forgan Mreeman
Forgan Mreeman - Month ago
if i’ve said it once i’ve said it 100x, programmers are actual aliens. or i’m an idiot. i had trouble keeping up with this very simple example. i failed two programming courses in a row while studying for my computer science degree. it made me drop out.
i’m just not a programmer. kudos to those who are. it’s an incredible feat
Luminescent Lion
Luminescent Lion - Month ago
Isnt the clock on the MoBo though, CPU just takes that and runs it through a multiplier to get its speed(in hertz), which it runs the instructions at.
burbon ­
burbon ­ - Month ago
these snaps are making my fingers hurt...
Martina Drums
Martina Drums - Month ago
All of that so people can watch porn.
Gerrit Zimmermann
Gerrit Zimmermann - Month ago
If all humans were snapping their fingers simultaneously, with both hands, it would still not be sufficient to drive that virtual CPU to the same speed a bog-standard multicore processor works at nowadays ...
Mitch Connor
Mitch Connor - Month ago
the finger snapping made me uncomfortable.
Qwerty-Space - Month ago
The original Roller Coaster Tycoon is a good example of a game written in Assembly!!
michael wittmann
michael wittmann - Month ago
Acheron Hades
Acheron Hades - Month ago
love that ublock origin in the dashlane ad!
Dave Thackeray
Dave Thackeray - Month ago
To demonstrate my abject stupidity I still don't understand how a basic computer works.
Gustav Krause
Gustav Krause - Month ago
did your finger actually hurt after recording this footage?
Edit: Also this sponsoring ist nice cause it's actually related to your content and you give a detailed explanation on password managers too, so props for that :)
Laurpud - Month ago
Sorry, I still don't get it. I guess I need it dumbed down even more
Mass Games
Mass Games - Month ago
4:45 snapping skills are a little scary at this point
DevinDTV - Month ago
If you want to learn more, check out Ben Eater's series on constructing an 8 bit CPU.
Chris Cerne
Chris Cerne - Month ago
Interesting video! I know this is an oversimplified example, but isn't the fetch -> decode -> execute process of a CPU done in one clock cycle? Fetch -> decode -> execute is carried over a series of logic gates that only depend on one clock cycle to process an instruction.
sawyer bergeron
sawyer bergeron - Month ago
If you get into it further it gets even cooler. Modern cpus take those instructions and execute them out of order if one needs to wait, they do those jump instructions before they know they actually need to to do work in advance, they do all three of those steps (fetch, decode, execute) at the same time for multiple instructions, and many don't even have a specific set of bits for each register: they just rename and move them around as time passes to allow that parallelism from earlier to work properly.
Lucas Dupuis
Lucas Dupuis - Month ago
I've watched this video three times in a row and my brain still refuses to understand most of it, am I small brain ?
SM23 - Month ago
Each one of his snaps were so impressive the shockwave came through my phone and ended the life of 10 of my brain cells
Kshitij Shah
Kshitij Shah - Month ago
People who unironically code in assembly for fun are masochists
6StringPassion - Month ago
Great video! Alan Turing deserves mention here.
GaMerZ - Month ago
RIP Tom Scott
Colin Cummings
Colin Cummings - Month ago
It's storing 3.47 terabytes of tentacle hentai, what's yours doing?
ASG_8 - Month ago
You just joined the Program Memory and the Data Memory... that's not how it usually works :(
max mustermann
max mustermann - Month ago
How does a computer determine a random value?
Sophie Bailey
Sophie Bailey - Month ago
The title makes it look like paranoia has set in for Tom
Inspector_ Alex
Inspector_ Alex - Month ago
This video teaches just enought to make someone feel like they've learned something about how CPUs work while actually teaching them nothing.
A better approach would be to show some of what actually happens during the Decode and Execute stages, without knowing this you dont really walk away with anything other than knowlege that there are a couple of registers and they do something, probably.
I understand that this is primarly entertainment, but this comes across as another "diet intoroductory computer video" and there are already far to many of those for anyone who cares to look. A bit more meat next time please
Photon Gaming
Photon Gaming - Month ago
what if dashlane has a data breach HMMMM
Omari R
Omari R - Month ago
Tom Scott, The David Attenborough of tech
shipper611 - Month ago
Wow! Thanks for this amazing video!
Martin Ninov
Martin Ninov - Month ago
If this proved interesting, you might wanna check out CrashCourse - they have a brilliant series on computers that builds up every single layer of abstraction that goes into making computers work - from semiconductors to pixels on a screen. Layers upon layers!
Next videos