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

6 779
50
 
Comments
Tom Scott
Tom Scott - 10 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 https://www.dashlane.com/tomscott
Oscar Green
Oscar Green - 8 months ago
Tom Scott I’ve been where you filmed on a school trial
A. S
A. S - 9 months ago
You should write a book
Jake the Wolfie
Jake the Wolfie - 9 months ago
So my phone has a core of just you clicking your fingers billion of times a second?
Sebastian Knight
Sebastian Knight - 9 months 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 - 9 months 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
vara vashtul
vara vashtul - Day ago
It's not super human, it's just practice. I don't let my computer auto fill anything so I have to remember my passwords.
Someone On The Internet
I still don't understand how adding and storing numbers makes things appear on my screen
MatT the Mega player //MatTmp
You probably want to check the pci express lanes of your cpu if you want to have to graphics cards and run them in SLI or that ninvidea link program but remember that is only on certain gpus
Genrotto
Genrotto - 9 days ago
Watched this in software class
Binging your channel tonight
Alpha Halcyon
Alpha Halcyon - 10 days ago
"If you take apart your computer you'll find at the heart of it a CPU"
Me on all fours with a tactical chainsaw and a machete: "Uh-uh right so far"
Rob Speed
Rob Speed - 10 days ago
"If I want to run it on a … Mac instead of a PC, I can compile it for that CPU instead."
Well I guess this will make more sense in the future after Macs switch to ARM.
Gautam Narayan
Gautam Narayan - 14 days ago
Sir... i really like the you have expained.....
Ivz
Ivz - 14 days ago
You got a very firm snap.
mahnoor khan
mahnoor khan - 14 days ago
Thanks a lot!
Prabhdeep Singh
Prabhdeep Singh - 15 days ago
Thanks Tom Scott. This was enlightening.
Arshia Mazumder
Arshia Mazumder - 17 days ago
I could listen to Tom snap his fingers all day like wow.
Harraz Masri
Harraz Masri - 22 days ago
now i can show off and surpass my seniors
Matas
Matas - 22 days ago
I'd love to hear you snapping those fingers every time your real PC's processor runs a cycle.
Johan Song
Johan Song - 25 days ago
this is so well explained and is so helpful for an intermediate undergrad programming student. I hope there would be more vids like this that explain computer basics!
Scias
Scias - 27 days ago
I'm more impressed with Chris Sawyer coding RollerCoaster Tycoon in Assembler :D
kranser
kranser - 29 days ago
Most languages add in exceptions when a number is too large to be stored - this is not in your original machine code, but would be added by the language when compiled.... so your program will not be exactly the same code when compiled, but almost!
Roman Vereb
Roman Vereb - Month ago
Flashbacks to TIS-100
Ryan King
Ryan King - Month ago
My computer doesn't load Escape From Tarkov fast enough so I get killed before I even spawn in
Nathan N
Nathan N - Month ago
1:24 all you need is 1 byte y, 1 byte x, 1 bit c, and, 1 bit z and you got the NES
Charles Mayberry
Charles Mayberry - Month ago
This was a fun video, however multi-threaded programming is a beast of a challenge, try creating a bunch of threads, have them increment the same variable, you'll lose tons of increments because if it fetches, then at any point changes threads before it stores in that 3 step process, it assumes the instruction set was complete, so it will pull it from memory again, and then increment.

you can lose anywhere from 30% to 50% of the increments in my experience. this is where thread protection and mutexes come in handy, but they are expensive, so if it's a non essential code block generally we accept out losses and run anyways. (poorly engineered thread protection is also a great way to have threading deadlocks)
Asura
Asura - Month ago
I wish I Watched this BEFORE my goddamn computer organisation and architecture exam
Icy Football
Icy Football - Month ago
Great channel
Joshua Brooks
Joshua Brooks - Month ago
My computer is actually downloading Japanese pornography. Question answered.
Mike McMullin
Mike McMullin - Month ago
IIRC from my days of learning machine language (Z*) CPU), actual instructions had a jiffy count that was total execution time when did that change?
Chris Pratt
Chris Pratt - Month ago
Simple, yet brilliant! Thank you.
Christoph Wolf
Christoph Wolf - Month ago
everybody knows you're wearing a toupet, tom...
John C
John C - Month ago
“It just reads interprets and executes really fast”
Ya but *HOW*!?
David Vitez
David Vitez - Month ago
This video was so well made!! This is such a clean and clear explanation and this is exactly how the simulated computer I built works.. The only thing you missed is that you were showing an assembly language on screen during your demonstration the entire time.
Xiellion
Xiellion - Month ago
Hey Tom, do you use dash lane? Or do you use something like keepass?
Dante Silva
Dante Silva - Month ago
Damn, if only I knew about this video to study for my hardware finals. I failed that class. Twice.
yg ff
yg ff - Month ago
Thank-you lovely video but I don't understand why is it "every ninth cycle" shouldn't it be every "twelveth cycle"??
Jibbity Jobbity
Jibbity Jobbity - Month ago
I remember sitting through hours of lectures being told this in university and he's got it in a 9 minute video.
Joojotherock
Joojotherock - 2 months ago
YOU ARE A BEAST!
Mel Clifford
Mel Clifford - 2 months ago
Yes - Assembler is hard to code. But if you want to send a spaceprobe 7 million kilometers in space and arrive within 100 km of the target location, you'll program it in Assembler. Because real programmers dont eat quiche.
Ken Smith
Ken Smith - Month ago
I don't find assembler hard to code.
ggzh a Argue With Everyone
Don't see why this would be necessary. You can use any language you can compile.
anurag gupta
anurag gupta - 2 months ago
my fingers are paining now
jimbobbyrnes
jimbobbyrnes - 2 months ago
the graphic reminds me of SHENZHEN I/O from Zachtronics.
SocThis
SocThis - 2 months ago
i wish i could snap my fingers like him. like dayum
Sam Gerendasy
Sam Gerendasy - 2 months ago
Hey Tom my computer froze can you snap your fingers a few more times?
bozimmerman
bozimmerman - 2 months ago
Here's a mind boggler: Prince of Persia was written when high level languages were commonplace, but they wrote it in assembly ANYWAY. The puzzle: why?
Styil
Styil - 2 months ago
bozimmerman efficiency probably. High level languages existed and were decent but unlike today when a compiler will probably optimize your code more than you actually writing assembly, compilers then didn’t know tips and tricks to squeeze out performance
Kishibe Rohan
Kishibe Rohan - 2 months ago
But how can the computer snap if it doesn't have fingers
lol lol
lol lol - 3 months ago
Tom Scott is secretly working for a CIA mass hypnosis project?
Fuzzy Tylerrr
Fuzzy Tylerrr - 3 months ago
This is the best comp sci video I’ve ever seen
baabaa9000
baabaa9000 - 3 months ago
If you want to see this in action, look up Human Resource Machine. It's on steam.
iikk_a
iikk_a - 3 months ago
”Higher level languages handle all the memory reading and writing for you”
*cries in c pointers*
Daner Jimenez
Daner Jimenez - Month ago
*crying for 2 months results in segfault*
KvaGram
KvaGram - 3 months ago
Wait a minute. If it does not matter when the memory is accessed, isn't "arbitrary", that is, the lack of a law, a better term to use than "random"?
Random would imply that a random piece of memory is accessed.

No wait, I think I just realized why.
Just try to imagine an alternate universe where it's called the AAM or double-a M.
MegaMGstudios
MegaMGstudios - 3 months ago
Your fingers must be so sore after this
zamistro
zamistro - 3 months ago
So, what is the blinky light thingy in the background?
aaa
aaa - 3 months ago
6:03 where is the data type mr. scott?
Unshelld Turtle
Unshelld Turtle - 3 months ago
Simpler than 5:54
var x = 1;
while(x++){}
ggzh a Argue With Everyone
This is not the same. x++ is maybe not always true. If it is signed you will run in a undefined behaviour. It is unsigned you will run in a situation where x becomes 0 again.
Eddie Viscasillas
Eddie Viscasillas - 3 months ago
Great video!
Karandeep Patti
Karandeep Patti - 3 months ago
Is this cycle only used for math problems or is used for all the instructions??
ggzh a Argue With Everyone
The only thing CPUs can do is math.
Styil
Styil - 2 months ago
Karandeep Patti everything
Ioni B.
Ioni B. - 4 months ago
For the video - great! It was very useful. For the sponsoring - not so much. I get the idea of all that security stuff, but what happens if you have to log in somewhere from someone else's computer/phone/any digital device. Then what? And imagine you can't download Dashlane. How are you meant to log in, especially if you need to do it quickly? I think that it is just stupid. If you have any computer knowledge - talking about people in general - you'd be sensible enough not to get hacked, and if somehow you do, all you need to do is reset your password and have two-way authentication.
KT P
KT P - 4 months ago
I had a exam yesterday on embedded systems, contained a couple of questions on the fetch decode execute cycle should have seen this earlier 😂
ggzh a Argue With Everyone
If you need that video for that, you don't know much about it.
MetalheadAndNerd
MetalheadAndNerd - 4 months ago
Binary bits are just a social construct.
Hoàng Trần Minh
Hoàng Trần Minh - 4 months ago
Shouldn't the jump instruction be set to jump 0 instead of jump 1? If you have another thread that is also modifying the value in mem address 6, this might cause a problem if you want both threads to run simultaneously.
Or am i overthinking this and the best way to program is to avoid race conditions altogether?
Imu Ias
Imu Ias - 4 months ago
I want more on microprocessor. 🙂🙂🙂
Eamonn
Eamonn - 5 months ago
Fantastic explanation. I wish this was around when I was trying to learn the same thing from a book for GCSE computing.
Thiefree
Thiefree - 5 months ago
I didn't expect to understand any of this, but you got me there. you're good at what you do!
Muneeb Anjum
Muneeb Anjum - 5 months ago
WOAHHHHH!!!! I understand the fetch decode execute cycle much much better now!!!
All my concepts relating to this topic are crystal clear...THANKS!!!
You deserve a sub!
Ethelana Talbot
Ethelana Talbot - 5 months ago
ah yes, infinite loops
notthere83
notthere83 - 5 months ago
Whoa, I did not know that about Prince of Persia. That's insane.
bananya
bananya - 5 months ago
I already know this because i do computer science xD
obito morgan
obito morgan - 5 months ago
i didnt know that u have a channel
catprog
catprog - 5 months ago
Magic cpu and ram.
How do you get the data from ram in one clock cycle. (normally one to set address and one to get data)
Standa Novák
Standa Novák - 5 months ago
Prince of persia made in assembly is impressive? Heck, RollerCoaster Tycoon was made in assembly!
I really like penguins
I really like penguins - 6 months ago
explained it better than my compsci teacher
Grapz224
Grapz224 - 6 months ago
By the way, if you are interested in learning what programming in Assembly is like... Check out EXAPUNKS, Shenzhen I/O, or TIS 100 on Steam. They're all Zachtronics Games about coding in *rudimentary* Assembly to create Viruses, Microcontrollers, or solve math problems respectively.
Mr_FJ
Mr_FJ - 6 months ago
RollerCoaster Tycoon 1 and 2 were coded in Assembly
MS Thalamus
MS Thalamus - 6 months ago
On of my CS assignements in college actually was to code something (very small) in binary. Gives one a great appreciation of what's happening under the hood!
NitSUj
NitSUj - 6 months ago
I've had to pause the video because you are driving me crazy with you know what..
spazda_mx5
spazda_mx5 - 6 months ago
What a bloody wonderful channel this is
Luca Goodoer
Luca Goodoer - 6 months ago
This video is finger clickin good
kericlapboards
kericlapboards - 6 months ago
1:18 "It doesn't matter when, or in what order, the memory is written"
If only.
Summ
Summ - 6 months ago
This helped me out more than my 2 years of computer science studies.
Good job, Tom.
Reuben M.D.
Reuben M.D. - 7 months ago
Me: What is 1+1 equal to?
Computer: ADD 7!
Nolan Beck
Nolan Beck - 7 months ago
ah getting some flashbacks to my Assembly class, I hate it.. thanks Tom!
tech kid
tech kid - 7 months ago
Tom Scott: lets not have it binary and keep it humanly readable
Me: binary is humanly readable!!
Laith Naseef
Laith Naseef - 7 months ago
no way
Mo Izak
Mo Izak - 7 months ago
thums up mentore
Next videos