This video was sponsored by Brilliant. To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/CoreDumped. You’ll also get 20% off an annual premium subscription.
Where are you going after you die? What happens next? Have you ever thought about that? Repent today and give your life to Jesus Christ to obtain eternal salvation. Tomorrow may be too late my brethen😢. Hebrews 9:27 says "And as it is appointed unto man once to die, but after that the judgement
i have been started watching your video recently and you know what your videos are great cuz for me they are easy to comprehend. i also had an humble request can you make some videos on computational structure, please!!!
I have always wondered what the actual difference between threads and cores are, and YOU are the first one to explain it in a way that can be perfectly understood. Your animation style is also really great.
Are you sure you are referring to the same thing? I've always wondered about hardware multi threading (as in intel's hyper threading) and initially thought this video is going to explain those, but it seems it's the OS concept of threads (which is also interesting). Or maybe I got it wrong, who knows.
@@f14v14nhyper threading is a marketing term. There are two cores who share some resources like main memory and cache. And hyper threading refers to sharing of seldomly used compute circuits like division, floating point coprocessor , and MMX . No registers are shared.
Thats cause in terms of hardware, threads is also language to say "concurrent threads processing capability". 1 word 2 meanings. So that my CPU has 8c16t means it has 8 physical cores and capability of doing 16 things at once. But in my OS probably there is over 1000 threads.
Another amazing video! I would suggest the following definition: "a thread is an execution context". I think that's a good way to think about threads because they provide everything needed to run the next instruction, like its own program counter, stack, and registers.
Besides the technical clarity of this video being outstanding, the audio quality of the narration is literally perfect. Would be interesting to see how this was produced.
that's the most beautiful explanation i've ever seen or heard: with its beauty in explaining complex notions in a simple yet vivid way - colourful, using extensive graphics and succinct; and, what's more, DETAILED(!), meaning FINE-GRAINED
This is the best video I've watched on this. This helped me gain a more intuitive understanding of threads vs processes, whereas a lot of other explanations confused me.
People really need to understand that videos like these are better learning tools than books or people explaining it to you with just words and PDF files on board screen.
Thank you so much for this video, that I have found absolutely accurate, and with excellent graphics. I can confirm that on Solaris (the UNIX flavour that used to run on SUN workstations), threads were based on lightweight processes. I also remember that prior to the Posix standard for threads, portability among different O.S.’s was very challenging. And I would also stress the fact that when it comes to threads, with great power come great responsibilities, especially when handling concurrent access to shared data structures, and more in general, thread synchronization. A whole field of study, in I.T. science, is dedicated to this, and one has to master it perfectly in order to build correct and robust multithreaded S/W.
EXCELLENT presentation. You did it basically exactly the way I would like to have it explained. Perfect, down to using different colors for different processes/threads, etc.
When deciding should I go with Threads or Process spawn for a project I remember reading that the difference between Threads and Processes is that Threads share the same memory while Processes not.
That's why the famous Philosopher around the table problem is so good. Try implementing the logic of the philosophers around the table sharing forks to take turns eating using both Threads and Processes and you will quickly understand the 'memory space' dillema. Once you finished the implementation try using 200 philosophers in each case and see how your computer reacts :)
I'm learning computer from the ground-up. Watched view videos from this channel about logic and processor, thanks for the videos.. Now im learning softwareside and now this video helped to get the concept
Great video ! I would recommend a small correction though. Around 14:30 you said that TEXT and DATA section are two regions that are never written too. This is mostly true, but remember that the data section is where static variables are stored. So if a Thread has to change a static variable it will write into the data section.
Your videos are fascinating. You made me interested in the work of operation systems. Schematics are great for explaining stuff like this. Keep the quality
Great video, never seen such precise, succinct and clear explanation on this topic. It shows how your understanding is deep and broad at same time. Thankyou so much.
I don't think there was really anything in this video that I didn't knew before. But it still helped me to put so many things together in my head and get a much better understanding. Thank you
God bless this guy!!! Thank you very much for creating such resourceful and easy to understand videos. I have binged all the videos in your channel in past few days!
Thank you for another great video! No one asked, but here’s another example of data parallelism and why it can be useful. You can parallelize the following operations on a sequence: • map • filter • reduce Additionally, you can use parallel sorting algorithms, but not every sorting algorithm is suitable. Only those that align with the “divide and conquer” strategy can be effectively parallelized. For example, merge sort consists of two main operations: 1. Sort: This has a time complexity of O(n * log n) 2. Merge: This has a time complexity of O(n) You can perform the sorting phase in parallel processes and then merge the results in the main process, as merging is relatively efficient with its linear complexity O(n) Cheers!
In one of my computer science classes (several years ago), my teacher told me that a process can be used to share memory resources and a thread to share computing resources. Great video !
bro.... your're broking the internet with these AWSOME AWESOEM CONTENTS !!!!!! 10++++++++++++++++++ i'm speechless for the quality and the effort profused !!!!!!!!!!!!!!
Will you be teaching anything about networking? Would really like to know the low levels of how data goes from someone's server to my computer. That is basically magic for me, how thousands of devices share the same fiber optic line and can communicate completely fine.
Only two devices sit on a Fiber (at the ends ). Manufacturing seems to have advanced to make the individual finer thinner . And diodes are packed more dense at the ISP side. Basically an (O)LED display for download and a camera for upload.
Bro cooks with every video he makes. one of the best channel out there. I'm cheering for u to continue. I believe that in a few years, your channel will become the ultimate compilation of everything there is to now about programming. Best of luck to u ❤
kind of reminds me of Erlang processes, which seems to be a more specific implementation for handling lightweight and fast message passing (such as handling real time), while OS threads are more suited for more general purpose applications that have concurrency needs Really don't know the specifics of it, but when running an OTP application, every OS thread is used to run the Erlang VM (BEAM), and just like an OS, every process is isolated until specified. Crashes and runtime errors are self-contained in the Erlang process and special processes can be used to automatically restart processes when they crash (called supervisors)
Last bit of threads executing the same piece of code clarifies a lot of confusion. Since it’s read-only and is fetched-decoded-executed. Brilliant explanation with careful wording. Love your videos.
Graduated from Uni and somehow threads were just glossed over. Though I've used them, I had never really taken the time to learn much about them until today. Thanks!
It's worth to know that in programming languages there's a concept of thread pools as an optimization method to avoid new thread spawning each time. And in Java there is a concept of virtual threads which are some kind of a wrapper on OS threads giving more efficiency
Awesome video I was also wondering if you are interested in making a video on the asynchonous programming, and how that works under the hood. For a long time I though the async keyword in javascript or python creates a new thread of execution, but I was wrong. Actually it's the event loop that manages the execution of these codes. I would like to explore this in much depth, but if you could make a video comparing this alongside the threads, it would be a huge help. Thanks for making this video and others in your channel, they are really in depth and informative.
Thanks for this excellent video on threads. When you mentioned them, it made me wonder how asynchronous functions work under the hood. Are you going to do a video on asynchronous functions?
Nice waiting for multi-core video, if we see in future video related to GPU that would be fantastic, how vertex and pixel shaders works and etc, that would be fantastic.
amazing and intense video just one detail i would like to point is that c and c++ are mostly considered mid-level languages since they can be written and understood by humans but they give you some of the power of booth high and low level languages. the video really anwered a lot of questions that i had in my mind thankss.
Modern languages makes it "easy" to multithread. In iOS, with Objective-c and earlier Swift versions, we needed to use the "Grand Central Dispatch" API to run code in a multithreaded way. It wasn't hard but sometimes, it could lead to messy code. In the newer swift versions, if we put any code in a "Task { code... }" block, it automatically creates threads in the background so it is very easy to create high performing, async, multihreaded, memory safe applications, everything is managed in the OS.
Before watching, I am gonna guess threading is important at least in part because there would be quite a bit of processor downtime/inefficiency if tasks were not sharing time on a core. That is the first thing that popped into my head, if a core was just in charge of one task then it’d be idling quite a bit waiting for things like memory to be retrieved or user input, etc. I may be misunderstanding the subject though because I don’t know hardware that well Edit: I was not wrong, but only because I was so vague in my prediction. What a clever explanation, now I have a better understanding when I am using threading in my programs, this will help me design better
At 3:10, whilst you do mention that each process traditionally has 1 program counter, the solution after a long explanation is to simply have multiple program counters, along with sharing of the rest of the resources. I think that could have been better explained because I was waiting for a much different approach to the problem, than a simple, "but to run multiple tasks in a process, OS' use a different approach than the traditional process model", but if it is not a different process model then it's not wholly correct to say that "in traditional process model, one process can only have one program counter" (something along those lines).
Could do another video on mutable shared state concurrency with threads, but Halloween was a month ago 😱. Great vid though 25 years working in the industry as a software engineer, and I still learn new details from these videos.
I would love to learn more about the mechanisms in hardware related to synchronization. I have coded in C++ and understand how to use a mutex, but understanding how it works in detail and how that relates to the hardware is a different matter
Woah man, this is peak content on youtube. Programming in python as a kid left me thinking that threads are free parallel execution (only somewhat correct) and used them for whatever I wanted without knowing what they are actually for (this caused problems). Now thanks to this video, I know how it is actually operated. And just as a sidenote, I actually found out that variables are stored in the thing programmers call the stack from when you brought it up in this video, im not in college yet and am trying to learn computer architecture so this entire video was huge for me, as with all your videos. Insanely great.
This video was sponsored by Brilliant.
To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/CoreDumped. You’ll also get 20% off an annual premium subscription.
Where are you going after you die?
What happens next? Have you ever thought about that?
Repent today and give your life to Jesus Christ to obtain eternal salvation. Tomorrow may be too late my brethen😢.
Hebrews 9:27 says "And as it is appointed unto man once to die, but after that the judgement
i have been started watching your video recently and you know what your videos are great cuz for me they are easy to comprehend. i also had an humble request can you make some videos on computational structure, please!!!
what program did u use to make video?
Brilliant? - lame
Man your videos are diamonds.. I am so blessed that i found you
Welcome aboard!
Same
@@CoreDumpped Where i Can find any course like this
utterly useless info with a robot voice, you're just his alt account i think
@@adamrushford nah, do your research man
I have always wondered what the actual difference between threads and cores are, and YOU are the first one to explain it in a way that can be perfectly understood. Your animation style is also really great.
Are you sure you are referring to the same thing? I've always wondered about hardware multi threading (as in intel's hyper threading) and initially thought this video is going to explain those, but it seems it's the OS concept of threads (which is also interesting).
Or maybe I got it wrong, who knows.
@@f14v14nhyper threading is a marketing term. There are two cores who share some resources like main memory and cache. And hyper threading refers to sharing of seldomly used compute circuits like division, floating point coprocessor , and MMX . No registers are shared.
Thats cause in terms of hardware, threads is also language to say "concurrent threads processing capability". 1 word 2 meanings. So that my CPU has 8c16t means it has 8 physical cores and capability of doing 16 things at once. But in my OS probably there is over 1000 threads.
@@by010 16 threads per core?
I understand, now!
This was awesome, eagerly waiting for more videos.
Thank you for explaining it in such detail while making it simple to visualise/understand 🙌
Dude i just went to your channel to see if the new threads video is out, and i see that it has been released 30 seconds ago :D
Perfect sync mate!
Another amazing video!
I would suggest the following definition: "a thread is an execution context".
I think that's a good way to think about threads because they provide everything needed to run the next instruction, like its own program counter, stack, and registers.
Where i Can find any course like this .
This is by far the best animation and explanation I have seen on UA-cam about Process vs Threads
Animation is amazing agreed!
The more you know and understand about how modern hardware and software works, the more unbelieveable it is.
BRO Just to late 2 hours ago i have operating system exam and the question is why we need threads on single core porcessors.
Bad timezone
@@tomasprochazka6198 absolutely
@@tomasprochazka6198 absolutely
Amazing video
Lame question. Define "need".
Thanks!
Where i Can find any course like this
Besides the technical clarity of this video being outstanding, the audio quality of the narration is literally perfect. Would be interesting to see how this was produced.
It’s text to speach (most likely ai enhanced) , not saying that this is sth bad though
right, sounds very much like ai but it’s pretty good in my opinion
that's the most beautiful explanation i've ever seen or heard: with its beauty in explaining complex notions in a simple yet vivid way - colourful, using extensive graphics and succinct; and, what's more, DETAILED(!), meaning FINE-GRAINED
My god the amount of information packed in 16 minutes is insane. Thank you for the work you do!
This is the best video I've watched on this. This helped me gain a more intuitive understanding of threads vs processes, whereas a lot of other explanations confused me.
I wish it was published when I was studying threads 😊
People really need to understand that videos like these are better learning tools than books or people explaining it to you with just words and PDF files on board screen.
Thank you so much for this video, that I have found absolutely accurate, and with excellent graphics.
I can confirm that on Solaris (the UNIX flavour that used to run on SUN workstations), threads were based on lightweight processes.
I also remember that prior to the Posix standard for threads, portability among different O.S.’s was very challenging.
And I would also stress the fact that when it comes to threads, with great power come great responsibilities, especially when handling concurrent access to shared data structures, and more in general, thread synchronization. A whole field of study, in I.T. science, is dedicated to this, and one has to master it perfectly in order to build correct and robust multithreaded S/W.
EXCELLENT presentation. You did it basically exactly the way I would like to have it explained. Perfect, down to using different colors for different processes/threads, etc.
make video on allocating memory on heap vs stack,
also about the virtual memory, segmentation and pages and how are they managed using tables and shit
Memory allocation videos are already on his channel
You mean if multiple threads share memory?
When deciding should I go with Threads or Process spawn for a project I remember reading that the difference between Threads and Processes is that Threads share the same memory while Processes not.
That's why the famous Philosopher around the table problem is so good. Try implementing the logic of the philosophers around the table sharing forks to take turns eating using both Threads and Processes and you will quickly understand the 'memory space' dillema.
Once you finished the implementation try using 200 philosophers in each case and see how your computer reacts :)
@@robuandrei5969 yeah that's something I should try implementing, but I got the issue small scale when I was poking into synchronization in Vulkan.
I'm learning computer from the ground-up. Watched view videos from this channel about logic and processor, thanks for the videos..
Now im learning softwareside and now this video helped to get the concept
The best thing is I found your channel. I never would have been learned about thread with such clarity. Thank you so much.❤
These videos are truly excellent and I'm amazed and grateful you still have more planned!
I really really loved this explanation. The visual way you explain it make it much easier to grasp. Thanks a lot for this!!!
Great video ! I would recommend a small correction though. Around 14:30 you said that TEXT and DATA section are two regions that are never written too. This is mostly true, but remember that the data section is where static variables are stored. So if a Thread has to change a static variable it will write into the data section.
+1 this. He probably meant CDATA (the constant data), but yes, DATA is 100% modifiable, and needs to be protected for multiple thread access
Static variables don't change
@@saleh8568 You are thinking of constant variables. Static variables are mutable.
Your videos are fascinating. You made me interested in the work of operation systems. Schematics are great for explaining stuff like this. Keep the quality
Great video, never seen such precise, succinct and clear explanation on this topic.
It shows how your understanding is deep and broad at same time.
Thankyou so much.
Best channel for PROgrammers
I don't think there was really anything in this video that I didn't knew before. But it still helped me to put so many things together in my head and get a much better understanding. Thank you
I thought the exact same thing.
Awesome Video as always!
Impressed by your Animations as they make it really easier to understand!
Thank You.
your video's always the best and easy to understand. I was struggling imagining all these stuffs during my computer science study
Please keep posting videos like these (related to OS and Computer Hardware related stuff). ❤
God bless this guy!!! Thank you very much for creating such resourceful and easy to understand videos. I have binged all the videos in your channel in past few days!
Thank you for another great video! No one asked, but here’s another example of data parallelism and why it can be useful.
You can parallelize the following operations on a sequence:
• map
• filter
• reduce
Additionally, you can use parallel sorting algorithms, but not every sorting algorithm is suitable. Only those that align with the “divide and conquer” strategy can be effectively parallelized.
For example, merge sort consists of two main operations:
1. Sort: This has a time complexity of O(n * log n)
2. Merge: This has a time complexity of O(n)
You can perform the sorting phase in parallel processes and then merge the results in the main process, as merging is relatively efficient with its linear complexity O(n)
Cheers!
In one of my computer science classes (several years ago), my teacher told me that a process can be used to share memory resources and a thread to share computing resources.
Great video !
Good Job on explaining, looking forward for more.
bro.... your're broking the internet with these AWSOME AWESOEM CONTENTS !!!!!! 10++++++++++++++++++ i'm speechless for the quality and the effort profused !!!!!!!!!!!!!!
I knew it most of the stuff except the text part in the process with how threads access them, now threads are mostly sorted in my mind thanks.
Oh we're getting spoiled now. The extra smooth 60fps is *chef's kiss*. Excellent video as always Jorge!
It is impossible to overstate how well done this video is. 👏🏻
Perfect explanation of threads vs processes!
I was waiting for your next video. Nice Work!
Will you be teaching anything about networking? Would really like to know the low levels of how data goes from someone's server to my computer.
That is basically magic for me, how thousands of devices share the same fiber optic line and can communicate completely fine.
Only two devices sit on a Fiber (at the ends ). Manufacturing seems to have advanced to make the individual finer thinner . And diodes are packed more dense at the ISP side. Basically an (O)LED display for download and a camera for upload.
In a word, which requires a bit of research: "Multiplexing".
the clearest explanation of threads I've ever heard, thank you!
Bro cooks with every video he makes. one of the best channel out there. I'm cheering for u to continue. I believe that in a few years, your channel will become the ultimate compilation of everything there is to now about programming. Best of luck to u ❤
I love that you show concrete examples it makes it so much easier to understand
Right! Examples are awesome and make it less abstract
You are amazing. Can explain these concepts so perfectly
kind of reminds me of Erlang processes, which seems to be a more specific implementation for handling lightweight and fast message passing (such as handling real time), while OS threads are more suited for more general purpose applications that have concurrency needs
Really don't know the specifics of it, but when running an OTP application, every OS thread is used to run the Erlang VM (BEAM), and just like an OS, every process is isolated until specified. Crashes and runtime errors are self-contained in the Erlang process and special processes can be used to automatically restart processes when they crash (called supervisors)
Last bit of threads executing the same piece of code clarifies a lot of confusion. Since it’s read-only and is fetched-decoded-executed.
Brilliant explanation with careful wording. Love your videos.
The prime of this channel never ends. Saludos de uruguay
Love it ! Make a series on it ❤, can you explain coroutines with your animations .
Perfect timing to watch during lunch
Just loved it .
Please make more video tutorials. And I am ready to watch a 10-12 hours course on this topics with actual coding demonstration
Man you're THE BEST! Much much appreciation! Thank you!
Great video, hats off to your efforts.
Sir, you deserve a medal for making Operating Systems and Computer Architecture cool.
Graduated from Uni and somehow threads were just glossed over. Though I've used them, I had never really taken the time to learn much about them until today. Thanks!
Your channel is ameazing!! Congratulations!
Your videos are absolutely brilliant, many thanks for the great work.
It's worth to know that in programming languages there's a concept of thread pools as an optimization method to avoid new thread spawning each time. And in Java there is a concept of virtual threads which are some kind of a wrapper on OS threads giving more efficiency
Awesome video
I was also wondering if you are interested in making a video on the asynchonous programming, and how that works under the hood. For a long time I though the async keyword in javascript or python creates a new thread of execution, but I was wrong. Actually it's the event loop that manages the execution of these codes.
I would like to explore this in much depth, but if you could make a video comparing this alongside the threads, it would be a huge help.
Thanks for making this video and others in your channel, they are really in depth and informative.
I will, but you guys need to wait because making these videos is time consuming!
Thanks for this excellent video on threads. When you mentioned them, it made me wonder how asynchronous functions work under the hood. Are you going to do a video on asynchronous functions?
These animations are awesome! Which programms/tools are you using for your videos?
It's been stated in previous videos that he is using PowerPoint.
bro this video so cool, pls make another for hardware threads.
My brain starts to grow again, thanks mate. Love you so much.
I have a test about this topic and the next video's tomorrow haha, pretty awesome video
Amazing video, great explanation!!
Great Animation! Thank You!
This series is great. Is there a plan to cover asynchronous runtimes in the future?
Nice waiting for multi-core video, if we see in future video related to GPU that would be fantastic, how vertex and pixel shaders works and etc, that would be fantastic.
this information is amazing!
thanks!
amazing and intense video just one detail i would like to point is that c and c++ are mostly considered mid-level languages since they can be written and understood by humans but they give you some of the power of booth high and low level languages.
the video really anwered a lot of questions that i had in my mind thankss.
Modern languages makes it "easy" to multithread. In iOS, with Objective-c and earlier Swift versions, we needed to use the "Grand Central Dispatch" API to run code in a multithreaded way. It wasn't hard but sometimes, it could lead to messy code. In the newer swift versions, if we put any code in a "Task { code... }" block, it automatically creates threads in the background so it is very easy to create high performing, async, multihreaded, memory safe applications, everything is managed in the OS.
I'm a Software Engineer with 10+ years of experience and I learned things. Great video!
Before watching, I am gonna guess threading is important at least in part because there would be quite a bit of processor downtime/inefficiency if tasks were not sharing time on a core. That is the first thing that popped into my head, if a core was just in charge of one task then it’d be idling quite a bit waiting for things like memory to be retrieved or user input, etc. I may be misunderstanding the subject though because I don’t know hardware that well
Edit: I was not wrong, but only because I was so vague in my prediction. What a clever explanation, now I have a better understanding when I am using threading in my programs, this will help me design better
At 3:10, whilst you do mention that each process traditionally has 1 program counter, the solution after a long explanation is to simply have multiple program counters, along with sharing of the rest of the resources. I think that could have been better explained because I was waiting for a much different approach to the problem, than a simple, "but to run multiple tasks in a process, OS' use a different approach than the traditional process model", but if it is not a different process model then it's not wholly correct to say that "in traditional process model, one process can only have one program counter" (something along those lines).
@CoreDumped Amazing video one of the best explanations of threads I have seen so far! It would be great if you can also cover the actor model as well
I can see that a lot of effort has been done on this video that even though thankfully I know this info I am still urged to watch it
With Virtual threads in Java 23, you can have millions of virtual threads in JVM on a platform thread, that means good resource utilization
Very nice video and explanation. When can we expect the next video?
Thank you CoreDumped, very cool!
This ought to be interesting when you start to get into the idea of mutexes, fences, barriers, etc.
awesome content.
btw, I can't tell if it's your narration or AI
this channel is pure gold
this is the kind of video you want to watch instead of playing in background
no pun intended
Could do another video on mutable shared state concurrency with threads, but Halloween was a month ago 😱.
Great vid though 25 years working in the industry as a software engineer, and I still learn new details from these videos.
Unbelievable that this amazing channel has only 160,000 subscribers!
I would love to learn more about the mechanisms in hardware related to synchronization. I have coded in C++ and understand how to use a mutex, but understanding how it works in detail and how that relates to the hardware is a different matter
One of the best channels I have come across so far..
Só much easier to understwnd now. Thanks for the vídeo !
As a self-taught guy constantly getting belittled, I enjoy learning from your channel as well as lowlevel.
Parallelism with multi cores would be really fascinating to watch. Great visual representation.
Great video, very well explained
This is the first time that i really understand what and why are Threads.
U got a sub and new fan🎁, loved the topic ❤️
Wonderful video. This kind of videos should be shown in CS classes.
Nice videos id love to see you explain how peripheral devices drivers etc and the internet works on the hardware level
Woah man, this is peak content on youtube. Programming in python as a kid left me thinking that threads are free parallel execution (only somewhat correct) and used them for whatever I wanted without knowing what they are actually for (this caused problems). Now thanks to this video, I know how it is actually operated. And just as a sidenote, I actually found out that variables are stored in the thing programmers call the stack from when you brought it up in this video, im not in college yet and am trying to learn computer architecture so this entire video was huge for me, as with all your videos. Insanely great.
Bro you deserve 1mil subs the content is so fire
This is incredible. Thank you very much!!!!!
Badly waiting for the NEXT One... with Multiple Core & Parallelism ❤️❤️