The Central Processing Unit (CPU): Crash Course Computer Science #7
ฝัง
- เผยแพร่เมื่อ 9 ก.พ. 2025
- Today we’re going to build the ticking heart of every computer - the Central Processing Unit or CPU. The CPU’s job is to execute the programs we know and love - you know like GTA V, Slack... and Power Point. To make our CPU we’ll bring in our ALU and RAM we made in the previous two episodes and then with the help of Carrie Anne’s wonderful dictation (slowly) step through some clock cycles. WARNING: this is probably the most complicated episode in this series, we watched this a few times over ourselves, but don't worry at about .03Hz we think you can keep up.
Produced in collaboration with PBS Digital Studios: / pbsdigitalstudios
Want to know more about Carrie Anne?
about.me/carri...
Want to find Crash Course elsewhere on the internet?
Facebook - / youtubecrashc. .
Twitter - / thecrashcourse
Tumblr - / thecrashcourse
Support Crash Course on Patreon: / crashcourse
CC Kids: / crashcoursekids
Want to find Crash Course elsewhere on the internet?
Facebook - / youtubecrashc. .
Twitter - / thecrashcourse
Tumblr - / thecrashcourse
Support Crash Course on Patreon: / crashcourse
CC Kids: / crashcoursekids
Learning it now must be difficult, but people who originally came up with these ideas must have been brilliant
Most look brilliant when standing on the shoulders of giants, my friend. But I still agree, brilliant.
I guess what I mean to get at is that you, too, may be just as brilliant if you can stand on the shoulders of these giants.
Stay Classy!
I can't imagine. I remember coding in assembly long ago which was similar to what this video was about. After writing thousands of thousand lines of code, it started to look far too complex. I was thinking to myself if anyone saw this, some may think a genius wrote it. Lol
Brilliant is not even close enough to describe these people... These people were beyond geniuses! Just the sheer complexity and the whole concept itself!
Actually, no one really did. We already had mathematical concepts for these things. For example, when people invented the binary system, they already have boolean algebra to help them create these things.
Yeap. These people didn't actually came up on these idea on the get go. It's from stacking knowledge little by little. As what Carrie mentioned before, it's like a Russian roulette.
Computer Science is just a field of abstractions.
Starting from the lowest level, which is Physics, Mathematics, properties of Electrons, and Atoms,
physical properties of silicon, semi-conductors,
to hardware architecture, different Electronic components, and units, and how they are synchronized,
to machine code instructions, to assembly language, to compilers, and programming languages, to
what you see on your screen.
It's amazing, how Humans have made this device, just by understanding the Mathematics, and Physics of Atoms and electrons.
I salute all those geniuses who have made this modern world possible with their great minds.
Sunny shah well said!
u should really salute allen turning bless his soul
I think you misspelled "Electrical Engineering" is just a field of abstractions.
thanks
we made these rocks do math and play games
This is the single best series on computer science on TH-cam.
this is the best computer science series ever bro. I have a degree in this and I'm like "actually 🤔" the whole fxcking time...makes you wonder what answers I wrote down in my test scripts right? I'll cut the wonder, I wrote what's in the text book
every time they go up a level of abstraction, i forgot everything before it
Yeah, it would be fun to rewatch these in reverse at the end.
i think that's why those levels are there, so you don't have to keep the entire huge system in your head and replace it with a "black box" (given that you've got the understanding of how it works)
Hahaha, likewise :-D
Take notes
+Humanity 3.0 That's a good idea. I might just watch them in reverse once I finish this playlist.
I'm so grateful these videos are in 10-12 minute segments. Anything longer and I think my head would explode.
It really makes you wonder how effective 90 minute class lectures are (they aren't)! :p
@@aeresesdori7804 they are, if there teacher is good, I have an amazing teacher who teaches us basic electrical engineering and will go on to teach circuits and electronic devices in future semesters who's simply amazing and I don't have to study at home because what he says juts sticks in my brain
I watch them over breakfast and I find it the perfect amount of time to comfortably eat a bowl of cereal & drink a cup of coffee.
First (mind)meal of the day 🧠🥣☕
I have a computer science degree, and I've been programming since the 90s, and I am learning *SO* *MUCH*! This show is fantastic. Thank you!
I'm hoping to persuade my Mum to watch this show. She programmed computers with punch cards in the 60s, but always asks me how computers can do such fancy things these days. I've tried telling her it's just doing the same thing, but faster and at a larger scale, but I can't explain it as expertly as Carrie Anne.
but what? don't leave us hanging
wholesome
i really hope she has watched it
that's damn cool. we (our generation) could experience the same thing with our kids if humanity makes the necessary jumps to commercial quantum computing.
@@JITCompilation When you think about it, Quantum computing is another level of abstraction but the other way. Our computer absolute base level is the limitations of physics, maths, electrons, material science and more. By introducing quantum physics, the entire system is designed on an entirely new basis like super-relativity and such.
Quantum computing is completely different and far more powerful than digital computing at the lowest state of abstraction - instead of 1 & 0 binary, it will use the 3D orientation of sub-atomic particles, which at the lowest stage of quantum computing is 6 different states, and that's just insanity.
Don't give up, guys. According to what she said at the beginning of the video, there is no harder class on the whole series.
Thank you so much for this computer science course! It helped me so much :)
If you'se didn't quite understand this video, I recommend watching Tom Scott's "The Fetch-Execute Cycle: What's Your Computer Actually Doing?"
I'm taking a CPU architecture class and it's actually impressive how you managed to simplify instructions so much! Well done!
It blows my mind. People who invented these components are a true genius.
Gosh, this was a difficult one. I will have to watch a few more times to really understand it.
Martin Jepsen one of the most important skills in programming...actually in a lot of tasks, is noticing you are confused. It requires both humility to accept that you've missed something and self-confidence that you can understand it.
Hubris leads to slapdash work and crushing self-doubt leads to giving up or not exploring a possibility.
As they said, this is the most complicated part of CS. In fact, the vast majority of the time you'll never use this knowledge.
@martin I think about how the CPU actually does its job roughly 0% of the time I write a script/program.
If you want a reasonably cool example of deeper layers of computation/assembly, play TIS-100 or its "sequel", Shenzen I/O.
Watch Ben Eater's series on how to build a computer on a breadboard. He explains it so well and walks you through everything starting with first principles. He's still uploading the final few parts of the series, but it's REALLY worth a watch if you want to understand this stuff.
This is probably the most challenging crash course series I've watched and I'm so grateful for that! The layers of abstraction are a bit tricky to keep up with, but I feel like I'm learning so much...
Is there a uni course that would also teach this kind of thing? I'd like to take up one as an elective, I think!
brain.exe is not responding...
I lost my IQ's.
Lol 😂
😂
Buffer overflow error. Rebooting in safe mode.
same
I love how you don't start with everything abstracted you explain in detail then abstract to explain other things, helps a ton. I hate not understanding how things were abstracted, I like understanding how things work
Love this series ❤️
This is amazingly done, even though I continue to feel stupid watching it and will need to rewatch multiple times at least.
^^
Is a principle of Crash Course, its quick and the idea is that you pause, go back and re-watch. There is an old video in wich John (or Hank) address it.
john11719 Don't feel bad! Even as a professional programmer, I found it mind bogglingly tricky to wrap my mind around haha
That's normal, I had a whole class semester about digital logic for my computer science curriculum. Even at that, I didnt understand it much. This helps to see the big picture, I should have seen this before starting that class
You feel stupid watching it because it's not amazingly well done. It's naturally confusing and her diction and pacing doesn't help explain it. Bad speaker/teacher
Hats off to the makers for making all this stuff so easy and concise. During undergrad, I studied all this stuff but never got such physical realization and satisfaction. And thank God everything is available for free; no subscription, no charges.
Keep up the good work :)
Whenever Carrie Anne does this "level of abstraction", it brings me a thought. It's amazing how most of us ignore the fact that our beautiful computers are built up of so many tiny components, yet we foresee things over many levels of abstractions. When I watch this over TH-cam, there are thousands of tiny transistors performing in fractions of a second in an orchestra. Thanks Carrie for reminding us everything! We love you...
I see, many people saying they can't understand these videos. This is normal, because these videos are not for general computer users. These videos can be hard and complicated for you. I am a computer engineering student and i can understand everything in the videos. Thanks CrashCourse and CarrieAnnePhilbin :)
About to finish a computer organization course right now in college, and the past three videos have taught me more than the entire class combined. Thank you so, so much crash course!
I've liked all the series of Crash Course but this is particularly great. I've been doing stuff with computers since the early 80s and this is the best concise explanation of how the fundamental hardware works that I've seen.
On my 5th watch of the video, never before have I been so excited to hear "Yep, a new level of abstraction."
"Code" by Charles Petzold is a super-enjoyable read that walks the reader through all this at a more digestible pace. Can't recommend it highly enough.
Just making sure it's the right book, but its "Code: The hidden language of computer hardware and software", right?
@@JITCompilation I think so
Joe Joe yes
@@AndrewReifel okay, just got it! Excited to do some summer reading.
Once again, this series is excellent. Thank you and very well done!
+
Robyn Wyrick 😛
I remember programming in assembly a few months ago. this is basically the same!
because CPU didn't change the way they work :p they are still instruction based, but because programing got too complex and talking to other programs and OS is a pain in it, people don't use assembly anymore (on PC, since in embedded devices you can still find assebly programing), rether it is generated by other programs
Yup. Assembly is literally just writing out CPU instructions. It's one of the lowest levels of abstraction in programming. IIRC the only level lower is just straight up writing opcode in binary.
If Minecraft were written in Assembly it'd run ~50x faster... Though mods would be basically impossible to code into it.
Now I see why we use flush !!!
I remember this stuff from my college days. Good times! Which instruction set did you use, CISC or RISC?
I was thinking the same. I remember writing codes in assembly and using the compiler with TI-83 calculator over 15 years ago.
Carrie, you are a genius to have put this complicated process into such a simple and understandable manner.
The background is so mesmerizing, you can see so much work has gone into making it alive with tons of awesome stuff
I've done some pointless and arbitrarily approximate math... and I've calculated that Carrie Anne would take about 24 and a half years to render a single Half-Life 2 frame.
(assuming that circa 2004 CPUs that could run HL2 were clocked at about 1 GHz and GPUs at about 400 MHz, like the famous Radeon 9600, as both are very important for a game; that is **cringing at this** a total of 1.400.000.000 cycles per second, and if that hardware could run HL2 at 60 fps, that means it takes ~23.3 million cycles to render a frame, and if Carrie Anne has a clock rate of 0.03 Hz, divided up it's (I kid you not) 777.777.777 seconds, which is 24 years and about 7-8 months)
TheBurek thank you for this
TheBurek im not even going to try to understand that
Oh, you're very welcome :) I'm just now seeing people actually liked and responded to my dumb comment.
so you're saying carrie anne can run half life two?
Sure, if you're patient enough. Here's some more pointless math for you - by the rate we calculated above, it would take more than 88 thousand years to go through the intro cutscene and get to the interactive part (which is almost exactly one minute long in normal real-time).
Am I the only one who didn't understand anything but still had fun watching this?
I dont usually pause at the little animations in the intro but as this is my hobby and hopefully my career in a few years I wanted to read all the text bubbles haha
Brings back a lot of old memories doing assembly language programming on a Z80 back in the late 1970s.
Great Series for any computer science enthusiast. The lady is so clear in concepts and explaining stuff. The series is for all the age groups. Thanks for such a smooth explanation.
This was really really good!
I studied a bit of assembly but never really understood why things were the way they were.
Now it makes a lot of sense!
Best channel on youTube I have ever seen
Oh my god this series is amazing!
This video brought all the conglomerate parts of a cpu + ram seamlessly together. It was a bit of a review for me but extremely well packaged into one video. And I'm also glad you mentioned the negative drawbacks of overclocking, and the advantages to under-clocking. Thanks
This series is fantastic! Best crash course series in a while!
I've not done some of this in around 20yrs and I jumped into this CC at this episode-yet I'm with you,I understand-your a good teacher,thanks!
Now I have a presentation to give tomorrow, but I just need to watch this or... well... you know...
bah, I don't need an excuse. Crash course, thank you for giving me a nerdy excuse to escape my studies for a brief while 😄
Honestly have always liked crash course, but this is my favorite series by far! Please Keep this one going as long as possible
these computer science videos literally saved my AP computer science grade thank you so much oh my god
There was once a new little restaurant opened by a highly motivated fledgeling chef near the place I live and he made the most amazing sandwiches. I regret not visiting that place often and not promoting it enough, because soon the restaurant shut. (obviously due to multiple reasons and not my inaction). Well, since then I make it a point to comment/promote things I think are surely precious to the world. This video is one such. The effort to abstract is amazing. To those who're finding it difficult, I only urge you to build some base and get here, and you'll find this a dream! The presenter and her humour/script are brilliant!
Teachers tried to explain the fetch execute cycle in secondary school, in Junior College, diploma in computer engineering and a higher national diploma. In total 8 years and ONLY today did I actually understand the process. Although you do need to watch the other videos in the series to understand what the levels of abstraction contain in them, teachers and lectures, should check this out.
Well done! That was easily the most simplest and easy to follow description of how the CPU works I've ever seen!
I'm taking Computer Organization right now! I literally built a CPU like this last week!
nnnice!
Sahil Acharya 😛
so i have a question
the instruction (load A , load B , ......) are all hardwired in the cpu
is that right ???
SE RI OU SL Y W OW !! I have to commend Carrie Ann's exceptionally clear diction, and the graphics makers' consistency and skill in syncing up to the talk. I could watch this at 1.5 speed not missing a beat, and I'm not even a native english speaker. Thank you for making these valuable lessons available for free!
This is actually amazing review material for my Computer Architecture class at the University haha. We pretty much covered all of this just in a bit more detail :)
This is what being taught in class. Yet the way Crash Course presents the whole thing is way clear and understandable!
So Carrie Ann cannot run Half-Life 2?
Sordatos Have you tried overclocking it?
Probably can't even run Solitaire at 2160p 144fps and at maximum antialiasing.
Through brute force emulation? No.
That said, there are some crazy tricks that are possible that makes running a good facsimile feasible.
Probably she can run it. but she runs it inside her mind.
Can Carrie Anne add up the number of seconds it will take to reach the Half-Life 3 release?
Loving these videos! I learned more here watching 7 episodes than what I learned in a whole semester. Also, a lot of the stuff I was confused about or wasn't covered has been explained. Thank you!
Cannot wait until this channel does algorithms and data structures
This is the best layman's explanation of the CPU clock and it's purpose that I've seen.
I hope they do a crash course on Geology and Music Theory
Fire Bucket No.
SansyBoy why not
Music Theory yes
I'll third Music Theory!
YES THEORY PLEASE
this is probably the best explanation of how CPU's work i've ever seen. very interesting. thank you :)
The moment when you learned more about CPUs by watching this video than in your computer science lectures.
This video answered all the questions I had for years in less than 12 minutes ,It's just an unbelievable work . GJ Crash Course, You guys just changed my life.
Really loving this series! Great job once again
looking back on this video this is extremely simplified ,but it was a good video for someone who is just learning about how computers work and really helped me understand core concepts for the first time.
My brain just overclocked😭😭😭
I graduated CS 8 years ago. I wish I watched this earlier. It is simply amazing!!
click settings, playback settings, 0.75x
click subtitles, english.
Done, now you can watch it :)
I had Computer Architecture 1 last semester where we had to know how a single cycle, multi cycle and pipelined MIPS would work BY HEART (my favourite questions were the ones where they gave us the value of the control signals and we had to figure out what operation was being made and in which phase (if it wasn't single cycle) we were in)
the way you've made such a complex thing so simple is truly beautiful
best crash course series
I don't know why, whenever you say a new level of abstraction, it brings a smile on my face. :)
BEST. VIDEO. EVER.
whoever came up with all this is just beyond amazing... i mean just... the ramifications and everything just blow my mind
Really excellent quality! Great work, I learned a lot
Been checking for this all day and how perfect for it to come out right after my CS class.
Can y'all do a Meta Crash Course, where you teach an intro to teaching, script writing, filming, and editing for youtube?
+1
TH-cam has a creator's academy at no cost.
Humanity 3.0 more perspectives from different sources can be helpful, they should still do it imo
+1 great idea
Sometimes the best learning comes from actual first-hand experience.
Many successful TH-camrs today did not start out already successful, some had failures before becoming successful. Learning from mistakes is one of the best kinds of learning.
This applies to real life as well, from relationships to career building.
I'm a computer engineering senior at university and this video explained microcontrollers/microprocessors/CPUs better than any of my classes.
Wait, we're done with Hardware now? oh man, I thought we'd have more details with decoders and multiplexers
Yeah, personally, I need the individual pieces that make up the different parts. For instance, the multiplexer was brought in without us being told what logic gates go into it, if any!
Granted, I'm sure that they had to skip over that because of time :/
Multiplexers and demultiplexers are just fancy applications of AND gates.
A multiplexer is just Output = (A and Select) OR (B and not Select)
A demultiplexer is O1 = Input and Select, O2 = Input and not Select
For more branches, you just need to test more select bits, and for wider words, you just need to duplicate to circuit for each bit.
Thanks, nemitis.
I just subscribed.
That was really amazing, I finally get it now. I've got a bachelor's degree in physics, (well, nearly) and after completing electronics and signal processing, I grasped the idea of logic gates and boolean algrebra (doing algebra in the weird field of F_2 really helped a ton aswell). But I wasn't really sure how on earth that could translate into a CPU.
This video helped out incredibly well with basically filling in the gaps in logic that lingered. Really appreciate the speed at which you go through things. I can just pause if I need to think or write something down, but it's impossible to speed the video up when you give us too much time to process things which only a small portion of the viewers might need in that particular sentence
I didn't get the calculation of Carrie Anne's clock speed at 8:50. Shouldn't it be equal to number_of_instructions/time_to_carry_out_instructions? Which gives:
4 instructions/(6 min * 60 sec/min) = 0.0111 instructions/sec
rather than 0.03?
These went from explaining, to executing, without explaining what you’re executing. For example - What is “13”? What is “15”? What LEVEL of information are we talking about in the first half of this video? Turning on a program? Or just barely telling the on switch to wake up, for a program? We’re talking about what volume of real-world information? What amount of information is a “value” of information? Loving these videos overall, just wish for some perspective for those of us for whom this is still entirely new.
So much better than my professor. Bravo. I love how simple and straightforward this material is. There are more details, but the core understanding is here.
Learning visually with animations are so effective than scanning a book. Thanks Crashcourse, you have helped me solve this problem. I am eternally grateful.
If Crash Course does not adds a counter to the "next level of abstraction" animation by the end of the course I'm gonna be so disappointed.
Best general CS course I’ve found on TH-cam. Amazing!
I really love this series. It inspired me to build my own calculator within Minecraft, just with the help of logic gates (so far it can only do 6-bit additions and decoding onto a decimal display).
How do modern computers handle decoding binary to decimal numbers? While building my own display i realized that for higher bit numbers e.g. 64-bit systems it must become quite complicated.
Yeah... it's one of those things you take for granted, untill you need to implement it yourself :) You'd need to do number system conversion, kinda like you would do yourself on paper. For converting binary number X to decimal, you can do X mod 10 (remainder of division by 10) and that would give you last (least significant) digit. Then you do integer divide by 10, effectively removing the last digit from number, ie. 123 / 10 = 12 (remainder 3). Repeat until you've reached zero, and print all the remainders in reverse order.
Thanks for the answer.
Sounds much simpler than converting every single of the 2^64 possible inputs with logic gates. But first I must build a substratcor so i can then use it for divisions -.-...
My game is lagging already, I might have to change to a proper programm or get myself some real electronics.
Hexadecimal is a good compromise, because 1 hex digit is always exactly 4 binary digits, so you can convert every 4 bits into one hexa digit with relatively simple logic. That's why it's so popular in computer science, it "aligns" much better to binary numbers than our base 10 numbers.
This video about your crash course in computer science has been my favorite so far. It was very well illustrated and very well explained. Great job, Carrie Anne and Crash Course! Keep up the amazing work!
That phase was so fetch!
I see what you did there...
Great! I really liked how Carie Ann lead us through the CPU cycle. This was very clear and easy enough to follow. I work with Computers since the early 90s and i work as an software developer since 2000 but i learned a lot in this course so far.
Playspeed : 0.75x 😬
wow this is exactly the kind of series that i was looking for a two years back..sadly i had to google everything and piece the information together..but still this series is filling some gaps in my understanding...cant thank enough
So god damn interesting
Word.
Eric Pham 😛
Watching this as a refresher, because I wanted to write my own emulator. Turned out to be the greatest explanation I ever had! 👍
Do you have any course work or other materials that might help me understand this better? This is hard to take in with one 12 minute video. Love Crash Course!
I'm pretty sure khan academy has stuff on computer science
See Ben Eater's channel (the breadboard computer series). He walks you through building a PC on a breadboard from first principles and he's really good at explaining it all.
Nand2Tetris nand2tetris.org/
Get a copy of _Code: The Hidden Language of Computer Hardware and Software_. The author takes his time so slowly build up starting from very very simple ideas.
You guys are awesome, this is easily the best channel on youtube.
I'm not paid or anything, but to anyone that has fun with those curcuits and likes puzzle-type games, I can recommend the game "Shenzen I/O". :)
It's pretty much based oncombining basic computing or input / output components and programming them with basic computing commands to solve a puzzle..
I'm actually having a course about embedded system design this year, programmation of ARM based Systems, I never did such thing before and I have to tell you that your videos help me so much understanding the basics better! So thank you so much :D
8:51 If we have 4 cycles/6min it's 1cycle/90s. Shouldn't it be 0,01 Hz?
yeah thats what really confused me too. I dont know where she comes up with this 0,03 hz
I have such high respect for the creators of computers. My god, when i learnt physics, i just learned how to calculate, to apply the knowledge is mind blowing.
Please help me! Look at 3:15. With 8 bits we could have access to 256 registers in ram. But now. Since we're using 4 bits on opcode and 4 for the address. The maximum we can address to is the first 16 registers in RAM. Modern 32-bit pc can have access to all 2^32 registers (4 GB), But using this method, it would not be able to. I need to know how to have full access to all registers!
maklas when the computer boots, some code is loaded into ram and the CPU's registers, then it starts executing that code to load your operating system and start Firefox, etc... Most CPU's support an instruction which says "load the memory at the address found in register A into register B". So for 32 bit computers with, say, 32 registers, you only need 5 bits to reference each register, rather than all 4GB of RAM.
Because it does not have to be implemented exactly that way. The bit-ness of a CPU doesn't tell you anything about the instruction size, just the size of operands the ALU can work with in a single operation and usually at the same time the width of the memory bus.
Steven Thomas. And what about variables that are stored in the back of the ram? let's say I have a variable "a" stored in the last address of the 4 GB RAM. how can I execute command load a?
I was caught up in these Crash Course Computer Science series. Using Java I created virtual RAM and CPU for 16 bit computer and started to code in machine language for that CPU. My problem is I either use more than 16 bits to make room for opcode or I just cant access all of the 64kb that 16 bit computer is suppose to access.
x86 instruction set, for example, has instructions ranging from 1 to 6 bytes. They don't need to be register-sized, nor all the same length. If you need them to be the same length, or just shorter in general, then you can set up some sort of segmentation, where you set a kind of "bookmark" in 64k increments with one 16 bit value (you'd have an instruction and/or a register just for manipulating that value), and then with another 16 bit value you say which byte you want, relative to that mark. That scheme would give you access to 4 GB of RAM. Since memory usage is usually clustered together, you wouldn't need to change that "bookmark" (segment register) often, most of the time you'd just play around in that one 64k chunk (segment), like it's the only memory you have, then you'd move over to another chunk, etc. You could scale this down a bit if you really want all your instructions to be 16 bit (fit in both the opcode and an address).
you could also design your instructions to only fetch 32 bit lines and no smaller. your data would have to stored at addresses that are multiples of four bytes (4×8=32), which means the last two bits of the addresses you can fetch would always be 00. the instruction therefore wouldn't need to specify those two bits, they would be implied, saving two whole bits! yay :)
Almost skipped this episode, but decided to rewatch 100 times. Pretty cool stuff. Been using computers since I can remember and it's awesome knowing the inner workings of a CPU or RAM chip. Pretty sure I know what a ROM chip does now. Thank you Carry One, I mean Carrie Ann and the PBS team for making this happen. :)
The heart? wouldn't the CPU be the brain actually? the heart would be more like... the PSU?
Thank you!
No
What a beautiful crash course. Each teaching is just so perfectly packed into 10 minutes videos.
Can she run Crysis?
This is the best visual representation of the unfathomable concepts in EECS. I really understood it.
Can I attack during the fetch phase?
just wanted to say im really enjoying this series! so interesting and insightful! loving Kary-Anne!!
I've found that i've had to watch the videos multiple times to really understand it, but every time it was very enjoyable! looking forward to learning more!