God of Concurency..i have bene flowing you since my 2014 when you used to write blog post only...by going through your post i attend interview like a LION when they ask mutithreading qns..Thanks a Lot form 10+ yrs exp guy from BLR,India..
Jakob. Thanks for the videos. For multi-threading, collections, security and Generics, there isnt a better place and person than Jakob. The knowledge is deeper than the ocean itself.
This was the exact kind of explanation I was looking for. Thank god someone thought all this was worth explaining conceptually. You have my gratitude Mr. Jenkov!
Thank you for creating this educational video. I highly appreciate how detailed and interesting you explained the material. This is the best I've seen in this field. Thank you for your effort and time you've dedicated to creating this video
After many yrs working in Java I changed to Scala 7 yr ago but I think that every Scala dev should knows these contents and then start with the Futures and so on. great videos . :)
I do too. Actually, all these small details is why I stayed with Java and not switched to Scala or Kotlin. I feel like I have greater control in Java over performance sensitive stuff.
I have been following your blog since 2019 and till a day everytime I need brushup, your blog is my lifesaver! The way you have designed your blog is something extremely unique I have seen and even viewing the title of JENKOV takes my fear of multithreading away 🤗 Last time I had cracked crazy multithreading interviews in India & Canada based on your guidance and now this year I am working on hit USA job market! 😃 Kudos to your work!!! keep it up 👍
Thank you very much for your kind comment ! :-) I am happy that my tutorials - and now videos - have been helpful for you :-) ... and good luck in the US !! :-) I am trying to keep up the work, but it takes a lot of time to make the videos and tutorials to a high enough quality. But I get some new material out continuously :-)
Thank you so much for creating such wonderful video. Explained very well, thorough and detailed God Level !!!. Best video series I have ever watched on multithreading topic
Thanks :-) ... I am quite happy with the number of views so far :-) Yes, it's not like some of those big channels, but I am also not doing UA-cam as a job - just as a hobby. I like playing with new media and tech, and UA-cam keeps evolving, so it's interesting to be here just to see what it can do.
Hi Jakob! Your competence on java concurrency is so deep and valuable that you could definitely write a perfect book on the subject. I would really buy it in a snap😊
Thank you :-) ... There are definitely Java developers out there with a deeper understanding, such as Brian Goetz (author of Java Concurrency in Practice) and others ! I only supplement these experts - with perhaps a different way of presenting the same ideas :-)
Java Concurrency in Practice is definitely the bible. Unfortunately it's a bit older so the newer Java additions or virtual threads are not part of the book
@@JakobJenkov yeah, thank you. I now got a clear understanding only need abit of code to see how it's actually done. Also concepts like race conditions
Your website seems down. Could you please look into it and bring it up? It is very helpful to get quick refresher and examples in Java concurrency and multithreading. This playlist is also a huge help. 🙏
My new web server was unstable - and might still be. I am currently experimenting a bit to find out what the problem is. Hopefully I find the problem sooner or later !
Amazing video! Thanks for explaining! Its easy to understand.. Before, my mind cannot comprehend multithreading very well. But my brain understands your explanation. Thanks a lot, you are a very good teacher :)
IMO concurrency is a must to learn for any decent developer. I'm glad I learnt some basic multithreading in first year comp sci; it's such an interesting topic
I have been a fan since 2013. You are an incredible teacher and researcher. I like the diagrams in the video but I really wish there were a bit more visuals to keep the video interesting (a white board maybe). I hope you find the time to convert the tons of useful info you have on your website into more engrossing videos
Thank you very much! :-) ... yes, making videos "interesting" is harder than with text! I realize that sometimes it would be nice with nicer visuals, animations and even music etc. but it's hard to find a style where all the animations etc. do not become disturbing after a while!
Thanks Jakob! Just stopped by your video tutorials (have known your website since long time) and really like your video.. Looking forward to finish the entire playlist.. ✌😎👍
Hello Jakob, i have found your video's very helpful to understand the multi-threading, I request you to share a video where you show that how to resolve the blocked thread.
@@JakobJenkov @Jakob Jenkov I have a thread dump of an application, lets say 100 threads and out of 100 threads 97 threads running properly and 3 threads are in blocked state. As 3 threads are blocked due to this my application not working properly(request not get completed). I need to make these blocked threads to running state. so that 100 threads should be either in running or ready state but should not be in blocked state.
Thanks for great explanation. As I can see(in LinkedIn) you are based out of Copenhagen . Do you have any in-person classroom coaching or institute ? I would really love to attend if there is any such. :)
Hi Amit, no, unfortunately I don't have any in-person classes of any kind, right now. It requires a reasonable amount of space, and that's not cheap! I have been thinking about doing something online, though. But I am not yet sure what the form should be. Discord. StreamYard. Shows with guests. I don't know. Something like that :-)
I am a C++ developer who came to learn Java, I would like to add 1 point regarding IO utilization, the I/O is something managed by the OS and in fact it is also limited to hardware specially when dealing with networking, the network hardware cannot do multiple IO tasks at the same time but the OS manages this so that it appears like that, so for multiple threads doing multiple network operations it is not always faster because of hardware limitation, for example an Ethernet cable or USB 2.0 can only send data or receive data but not both (half duplex) for USB 3.0 > you can send and receive data at the same time (Full duplex), this topic is much deeper that just multiple threads doing multiple network operations.
The video never claims that two threads can do IO at the same time. The video claims, that when one thread is processing the data it just loaded via IO, another thread can do IO. That is something different than what you write.
@@JakobJenkov Now I am a bit confused. At 8:58 to 9:18, you claimed that two threads can do IO at the same time. This seems to contradict your recent statement that only one thread does IO while the other processes the data. Could you please clarify this point? I appreciate your help in understanding this better.
Great video! Is there and easy way how to explain difference in Java vs Python threding module? As Python thanks to GIL is single threaded what does it mean in comparison to the Java? In other words what is possible to achieve with java that is not possible with python in terms of multithreding? Thanks!
I'm making an app on android. When I turn the power on, the main code stays on a loop (as I designed it to do). This allows my app to run in the background without the use of services & multithreading. The problem is when I try to open the already running app, it won't open because the main operation is still looping. 1. Any idea how I would solve this without force stopping? Do I need to put all my workload on a thread separate from the thread with my exit conditions? 2. Because the app is already running, it won't open the ui which is where my exit conditions are? I'm a newb. Please help me.
Oooh... you are stepping into the complex world of concurrency :-) ... Yes, the simplest thing for you would be to split the logic of your app into two threads. The main thread that controls the UI should not loop. It should not block. Yes, it's better to have a thread in the background which communicates with the UI thread. Your background thread can run in a loop which checks a BlockingQueue for new "messages" (objects) from the UI thread to which it should respond. If the background thread needs to do other things in its loop than process the messages from the UI thread, then the background thread should not "block" when checking for messages in the BlockingQueue. If no messages are found, it should continue through the rest of that iteration of loop, and then loop to the next iteration of the loop, where it again checks for new messages etc.
Bro I just read all of your blogs on concurrency they are amazing but I had one general question: most of the topic are related to operating system subject and we use C language in Kernel while building OS then where are multithreading and concurrency in java used? in servers?
Multithreading in Java is often used in e.g. Java web servers - but also in other types of server software (e.g. a game server) . Multithreading can also be used inside Java GUI applications, e.g. inside a JavaFX application.
Well, I just added a video to it today :-) There are still topics to add to this playlist, but I will probably be making videos about other topics than Java Concurrency too, for a while.
Wow! Nice CPU! I'd like to have such a CPU :-D ... I think I have 4 cores / 8 threads in my ooold laptop, and 8 cores / 16 threads in my new work laptop. Yes, you *especially* need to use multithreading to use all those cores and threads! If you just use single-threading then you will only use one of the hardware threads, and the rest will be idle (=> being used for whatever else your computer is doing).
@@JakobJenkov Huge fan of you sir! So happy to get a reply from you. You certainly deserve that CPU, so you can make more awesome tutorials :-). Your tutorials made me meet several office deadlines, and get a raise. Thanks for the info on multithreading. I will then go through the Multithreading tutorials from your channel. It is my weak point in Java.
Hi Jakob one small doubt is that as you mentioned when io operations is done on one thread the other thread can use the cpu . Does IO operations use cpu or not ? , if they use cpu how come other thread use the cpu or if it doesn't use cpu then where are io operations done .
Down at the hardware level, IO operations typically use different hardware than the CPU. That is typically hardware such as the PCIe bus, SATA bus, the hard disk or network card, and then possibly the memory manager when data is copied from the network card or disk into memory (but I am not 100% sure about the last one). That means, that the CPU can be doing other things while the other hardware components serve the IO operations. Sometimes the CPU might be needed a bit for an IO operation down at the operating system level. For instance, it is the operating system that knows what type of file system you have on a harddisk. Thus, when you ask to load a file, the operating system need to translate that into IO operations on the disk. But during the disk IO operations the CPU can do something else.
At line no 6:48 I have doubt. Even if some thread wants to read data from disk for that operation also we want cpu time and thread to read execute that reading operation right? Then what is the use of switching CPU to another thread ?
A file read is not executed by the CPU but by the hard disk and memory management hardware. While this is going on, the CPU is idle, waiting for the data to appear in memory.
If I may ask , I was wondering that how does this switching between tasks reduces time because if there are 2 task and each one of task takes 1sec to execute.....then anyway to complete execution of both tasks will take 2 sec whether we switch between them too . Is it that if task 2 wants 500ms then it will be finished earlier but then again whole program will take the same time . Please help me this question .
Task switching only speeds up task execution if the task uses IO, where the CPU is idle while waiting to read or write data to disk or network. During that idle time the CPU can switch to other tasks instead of wasting that CPU time.
6:46 Why can't CPU invest those cycles into downloading the data faster. I understand it is dependant on several factors like network speed etc. but if possible, then could it be the case that full potential of the CPU is gonna be used to finish this one thread? Also, how do we understand about how does CPU decide when to switch processes and threads?
A CPU can only affect what is going on inside the computer. When downloading - the speed is determined by external factors such as network speed and the speed of routers in between your computer and the server you are downloading from - as well as the network speed and traffic load of the server you download from.
0% yapping
0% wasting time
0% advertising
100% pure knowledge
absolute chad
Thank you very much for your kind words ! :-)
bro goated bro what a beautiful video seriously!
God of Concurency..i have bene flowing you since my 2014 when you used to write blog post only...by going through your post i attend interview like a LION when they ask mutithreading qns..Thanks a Lot form 10+ yrs exp guy from BLR,India..
I am happy that my tutorials were helpful to you over the years!! :-)
Jakob. Thanks for the videos. For multi-threading, collections, security and Generics, there isnt a better place and person than Jakob. The knowledge is deeper than the ocean itself.
Thank you very much for your kind words!! :-)
This was the exact kind of explanation I was looking for. Thank god someone thought all this was worth explaining conceptually. You have my gratitude Mr. Jenkov!
You are welcome 😊
This playlist as well as whole channel is one of those treasures of youtube
agreed
Thanks a lot !! 😊
Thank you so much! What a great introduction. Now, it makes sense why several loops in run() sometimes overtake each other.
You are welcome ! ... I am happy that you find this video useful! :-)
Thank you for creating this educational video. I highly appreciate how detailed and interesting you explained the material. This is the best I've seen in this field. Thank you for your effort and time you've dedicated to creating this video
Thank you very much for your kind words ! :-)
read your blogs few months ago, today found your youtube channel what a awesome day . thanks for tutorials man
You are welcome! :-)
After many yrs working in Java I changed to Scala 7 yr ago but I think that every Scala dev should knows these contents and then start with the Futures and so on. great videos . :)
I do too. Actually, all these small details is why I stayed with Java and not switched to Scala or Kotlin. I feel like I have greater control in Java over performance sensitive stuff.
I have been following your blog since 2019 and till a day everytime I need brushup, your blog is my lifesaver! The way you have designed your blog is something extremely unique I have seen and even viewing the title of JENKOV takes my fear of multithreading away 🤗 Last time I had cracked crazy multithreading interviews in India & Canada based on your guidance and now this year I am working on hit USA job market! 😃 Kudos to your work!!! keep it up 👍
Thank you very much for your kind comment ! :-) I am happy that my tutorials - and now videos - have been helpful for you :-) ... and good luck in the US !! :-)
I am trying to keep up the work, but it takes a lot of time to make the videos and tutorials to a high enough quality. But I get some new material out continuously :-)
I can't understand exactly the concept of Concurrency and Multithreading for a year. Luckily, I saw your video. Thank you so much
Great! Glad it helped ! :-)
Thanks,best intro video i have found so far,and is more exhaustive than most sources.
And the overall format of you video is so good,thanks.
Than you very much !! 😊😊😊
This is academically rigorous, industrially competitive and very helptul tutorial
Thank you very much !! 😊😊😊
Thank you so much for creating such wonderful video. Explained very well, thorough and detailed God Level !!!. Best video series I have ever watched on multithreading topic
Thank you very much! :-) ... I am happy the video series is helpful! :-)
Thanks Jakob for this video, it cleared my concurrency visualisation and dots are better connected now.
Onto the next dot now.
Stay Awesome!
You are welcome! :-)
Undeserved small number of views. Your videos are excellent! Thx.
Thanks :-) ... I am quite happy with the number of views so far :-) Yes, it's not like some of those big channels, but I am also not doing UA-cam as a job - just as a hobby. I like playing with new media and tech, and UA-cam keeps evolving, so it's interesting to be here just to see what it can do.
Hands down the best free resource for learning Java concurrency!!
Thank you very much !! 😊
One more video coming out soon in the playlist !! 😊
Hi Jakob! Your competence on java concurrency is so deep and valuable that you could definitely write a perfect book on the subject. I would really buy it in a snap😊
Thank you :-) ... There are definitely Java developers out there with a deeper understanding, such as Brian Goetz (author of Java Concurrency in Practice) and others !
I only supplement these experts - with perhaps a different way of presenting the same ideas :-)
Java Concurrency in Practice is definitely the bible. Unfortunately it's a bit older so the newer Java additions or virtual threads are not part of the book
Love your concept explanation :) I hope you will continue to help us like this. Thanks
Thanks ! :-) ... I have planned a good list of videos more - on Java Concurrency.
Done thanks!
Concurrency vs parallelism
OS context switching vs actually running tasks on different cores
This is the best tutorial I have ever seen about multithreading and a far better any udemy courses. Thanks a lot bro!
You are welcome ! ... and thank you for your praise ! :-)
Bible of Java Concurrency !!!
Thanks for the efforts !!!
You are welcome! :-)
Great teaching skills! Clear, concise, and engaging :)
Thanks a lot ! :-)
Great explanation, the best video I have ever seen for concurrency
Thank you ! :-)
Best explanation of multithreading on the internet
Thank you very much ! Glad you liked it ! :-)
@@JakobJenkov yeah, thank you. I now got a clear understanding only need abit of code to see how it's actually done. Also concepts like race conditions
Your website seems down. Could you please look into it and bring it up? It is very helpful to get quick refresher and examples in Java concurrency and multithreading. This playlist is also a huge help. 🙏
My new web server was unstable - and might still be. I am currently experimenting a bit to find out what the problem is. Hopefully I find the problem sooner or later !
Amazing video! Thanks for explaining! Its easy to understand.. Before, my mind cannot comprehend multithreading very well. But my brain understands your explanation. Thanks a lot, you are a very good teacher :)
You are welcome! ... I am happy my tutorials are helpful for you! ... and thank you for taking the time to tell me! :-)
Very good explanation :)
Every Java Developer should watch it before writing yourself as a developer in Resume...!!
Thank you! :-) ... watch the whole playlist too! (see description below the video) :-)
Incredible explanation. Instant sub!
Thanks ! :-)
IMO concurrency is a must to learn for any decent developer. I'm glad I learnt some basic multithreading in first year comp sci; it's such an interesting topic
It most definitely is - and with the soon-to-come GPU programming APIs for Java, parallelism in Java is about to go to a whole new level :-)
Thank you so much for making this gold content available. God bless you!
You are welcome :-)
Really nice explanation and video
Thanks ! :-)
Thank you sir I really appreciate it.After watching these videos ,it literally clarified my doubts a way better.😊
Great! Glad to hear it ! :-)
thanks Jakob. wonderfully explained. you've got a new sub.❤
Great ! Thanks ! :-)
Thanks Jakob for such a nice explanation.
I have been a fan since 2013. You are an incredible teacher and researcher. I like the diagrams in the video but I really wish there were a bit more visuals to keep the video interesting (a white board maybe). I hope you find the time to convert the tons of useful info you have on your website into more engrossing videos
Thank you very much! :-) ... yes, making videos "interesting" is harder than with text! I realize that sometimes it would be nice with nicer visuals, animations and even music etc. but it's hard to find a style where all the animations etc. do not become disturbing after a while!
@@JakobJenkov Try motion canvas or manima !!
Wonderful videos..clear explanations of complex topics. Helped me a lot in clearing my basic concepts
Great to hear! :-)
Thanks Jakob! Just stopped by your video tutorials (have known your website since long time) and really like your video.. Looking forward to finish the entire playlist.. ✌😎👍
Thanks - next planned video is also going to be in this playlist :-)
@@JakobJenkov can u please come up with concurrent collections video playlist.. Thanks again
Awesome! Your tutorials are extremely useful and easy to understand! Thank you very much.
You are most welcome!
Awesome tutorial ! The best one I've seen !
Thank you very much! :-)
HiJakob, I am waiting for your other videos on concurrency i have watched your three videos. Your explanation and tutorial are very helpful.
Great - I have more videos about Java Concurrency coming soon! :-)
Thank you so much for your video. It was easy to understand your explanation. Good job!
Great ! - glad it was helpful!
Hello Jakob,
i have found your video's very helpful to understand the multi-threading, I request you to share a video where you show that how to resolve the blocked thread.
Thank you ! ... What exactly do you mean by "resolve the blocked thread" ?
@@JakobJenkov
@Jakob Jenkov
I have a thread dump of an application, lets say 100 threads and out of 100 threads 97 threads running properly and 3 threads are in blocked state.
As 3 threads are blocked due to this my application not working properly(request not get completed).
I need to make these blocked threads to running state. so that 100 threads should be either in running or ready state but should not be in blocked state.
legend, thanks for putting this out
You are welcome! :-)
You are amazing, what an explanation. Well done.
Thank you very much for your kind words :-) I am glad my video helped you!
What a wonderful explanation, big thanks 😊
You're very welcome! :-)
Thanks for great explanation. As I can see(in LinkedIn) you are based out of Copenhagen . Do you have any in-person classroom coaching or institute ? I would really love to attend if there is any such. :)
Hi Amit, no, unfortunately I don't have any in-person classes of any kind, right now. It requires a reasonable amount of space, and that's not cheap!
I have been thinking about doing something online, though. But I am not yet sure what the form should be. Discord. StreamYard. Shows with guests. I don't know. Something like that :-)
Nice video. Thanks a bunch for it (:
You are welcome ! Glad you liked it! :-) Did you watch the whole Java Concurrency playlist?
You're a lifesaver!
Great, thanks :-)
Great explanation!
Thanks a lot! :-)
Hi Jakob, nice one..keep it up and also have been visiting your website as well. Good Stuff.
Thanks! :-) ... I will try keep it up :-)
Great lesson ! 🤝
Thanks! 😃
Thanks a lot, pretty decent explanation.
Thanks :-)
one of best content really
Thank you! :-)
I love your contents very much!
Thank you - very much :-)
great explanation.
Thanks :-)
Thank you. very helpful indeed
Thanks! Glad its helpful! :-)
great explanation.. thank you !
Thanks! :-)
I am a C++ developer who came to learn Java, I would like to add 1 point regarding IO utilization, the I/O is something managed by the OS and in fact it is also limited to hardware specially when dealing with networking, the network hardware cannot do multiple IO tasks at the same time but the OS manages this so that it appears like that, so for multiple threads doing multiple network operations it is not always faster because of hardware limitation, for example an Ethernet cable or USB 2.0 can only send data or receive data but not both (half duplex) for USB 3.0 > you can send and receive data at the same time (Full duplex), this topic is much deeper that just multiple threads doing multiple network operations.
The video never claims that two threads can do IO at the same time. The video claims, that when one thread is processing the data it just loaded via IO, another thread can do IO. That is something different than what you write.
8:58 to 9:18 - you mentioned that two threads can do IO at the same time
@@JakobJenkov Now I am a bit confused. At 8:58 to 9:18, you claimed that two threads can do IO at the same time. This seems to contradict your recent statement that only one thread does IO while the other processes the data. Could you please clarify this point? I appreciate your help in understanding this better.
clear explanation. Thank you
You are welcome! :-)
Awesome! Big help, thank you
You are welcome - glad you liked it! :-)
Amazing content and explanations !!!
I am happy you feel like that :-) ... it takes some energy to produce this content, so I am always happy when viewers get value out of it :-)
great lesson
Thank you :-)
Very good video, thank you!
Glad you liked it!
Clear explanation
Thanks 😊
what a great tutorial!
Thank you :-)
Very helpful, Thank u :)
You are welcome :-)
At the end of the video you talked a little bit about "No shared mutable state concurrency", Is multi-processing one type of that?
I am not sure what the exact definition of "multi-processing" is.
Great video! Is there and easy way how to explain difference in Java vs Python threding module? As Python thanks to GIL is single threaded what does it mean in comparison to the Java? In other words what is possible to achieve with java that is not possible with python in terms of multithreding? Thanks!
Hi Matus, I don't know Python well enough at this point to say what the difference between Java threads and Python threads are, unfortunately.
thats easy to undestand now let me check out how to code using concurrency
Thank you 😊
thanks a lot for your generosity sir :)
You are welcome! :-)
I'm making an app on android. When I turn the power on, the main code stays on a loop (as I designed it to do). This allows my app to run in the background without the use of services & multithreading. The problem is when I try to open the already running app, it won't open because the main operation is still looping. 1. Any idea how I would solve this without force stopping? Do I need to put all my workload on a thread separate from the thread with my exit conditions? 2. Because the app is already running, it won't open the ui which is where my exit conditions are? I'm a newb. Please help me.
Oooh... you are stepping into the complex world of concurrency :-) ... Yes, the simplest thing for you would be to split the logic of your app into two threads. The main thread that controls the UI should not loop. It should not block. Yes, it's better to have a thread in the background which communicates with the UI thread. Your background thread can run in a loop which checks a BlockingQueue for new "messages" (objects) from the UI thread to which it should respond. If the background thread needs to do other things in its loop than process the messages from the UI thread, then the background thread should not "block" when checking for messages in the BlockingQueue. If no messages are found, it should continue through the rest of that iteration of loop, and then loop to the next iteration of the loop, where it again checks for new messages etc.
Bro I just read all of your blogs on concurrency they are amazing but I had one general question: most of the topic are related to operating system subject and we use C language in Kernel while building OS then where are multithreading and concurrency in java used? in servers?
Multithreading in Java is often used in e.g. Java web servers - but also in other types of server software (e.g. a game server) .
Multithreading can also be used inside Java GUI applications, e.g. inside a JavaFX application.
You are amazing
Thank you 😁
Great, thanks!
You are welcome :-)
Thx sir, is this playlist completed??
Well, I just added a video to it today :-) There are still topics to add to this playlist, but I will probably be making videos about other topics than Java Concurrency too, for a while.
I have bought amd threadripper 32 core 64 thread cpu. Do i still need to use mutithreading for efficiency?
Wow! Nice CPU! I'd like to have such a CPU :-D ... I think I have 4 cores / 8 threads in my ooold laptop, and 8 cores / 16 threads in my new work laptop.
Yes, you *especially* need to use multithreading to use all those cores and threads! If you just use single-threading then you will only use one of the hardware threads, and the rest will be idle (=> being used for whatever else your computer is doing).
@@JakobJenkov Huge fan of you sir! So happy to get a reply from you.
You certainly deserve that CPU, so you can make more awesome tutorials :-). Your tutorials made me meet several office deadlines, and get a raise.
Thanks for the info on multithreading. I will then go through the Multithreading tutorials from your channel. It is my weak point in Java.
I'm a bit confused. Multithreading is application's multitasking, or something like this?
You could say that - but there are (or can be) some subtle differences. Threads may share memory. OS processes (tasks) usually don't.
@@JakobJenkov Thank you Jenkov)
Great videos❤️
Thank you very much! :-)
Hi Jakob one small doubt is that as you mentioned when io operations is done on one thread the other thread can use the cpu . Does IO operations use cpu or not ? , if they use cpu how come other thread use the cpu or if it doesn't use cpu then where are io operations done .
Down at the hardware level, IO operations typically use different hardware than the CPU. That is typically hardware such as the PCIe bus, SATA bus, the hard disk or network card, and then possibly the memory manager when data is copied from the network card or disk into memory (but I am not 100% sure about the last one). That means, that the CPU can be doing other things while the other hardware components serve the IO operations. Sometimes the CPU might be needed a bit for an IO operation down at the operating system level. For instance, it is the operating system that knows what type of file system you have on a harddisk. Thus, when you ask to load a file, the operating system need to translate that into IO operations on the disk. But during the disk IO operations the CPU can do something else.
Thanks!, Good content!
You are welcome! Great to hear! Thanks! :-)
Jkob Jenkov is Legend
Thanks :-)
At line no 6:48 I have doubt.
Even if some thread wants to read data from disk for that operation also we want cpu time and thread to read execute that reading operation right? Then what is the use of switching CPU to another thread ?
A file read is not executed by the CPU but by the hard disk and memory management hardware. While this is going on, the CPU is idle, waiting for the data to appear in memory.
If I may ask , I was wondering that how does this switching between tasks reduces time because if there are 2 task and each one of task takes 1sec to execute.....then anyway to complete execution of both tasks will take 2 sec whether we switch between them too .
Is it that if task 2 wants 500ms then it will be finished earlier but then again whole program will take the same time . Please help me this question .
Task switching only speeds up task execution if the task uses IO, where the CPU is idle while waiting to read or write data to disk or network. During that idle time the CPU can switch to other tasks instead of wasting that CPU time.
@@JakobJenkovthanks
6:46 Why can't CPU invest those cycles into downloading the data faster. I understand it is dependant on several factors like network speed etc. but if possible, then could it be the case that full potential of the CPU is gonna be used to finish this one thread?
Also, how do we understand about how does CPU decide when to switch processes and threads?
A CPU can only affect what is going on inside the computer. When downloading - the speed is determined by external factors such as network speed and the speed of routers in between your computer and the server you are downloading from - as well as the network speed and traffic load of the server you download from.
Very good!
Thanks! :-)
Is this playlist in order?
As close to "in order" as I have been able to make it. But - some of the topics are independent, so you can watch them out of order.
@@JakobJenkov Thank you sir, 😁
Thanks mannn❤️
You are welcome :-)
Finally!
Been waiting for Java Concurrency videos?
you're really great thank u very much
Thank you very much ! :-)
thank's...
You are most welcome :-)
Continue to make video turorialsssssss
:-D ... I will try 😉
God bless you ✝️
Thank you :-)
Introduction for guys who have no programming experience.
Yup 😊
AWESOME VIDEO!
Thank you ! 😊😊
SO GOOD!
Thanks 😁
Great explanation!
Thanks! Glad you liked it! :-)