Java Concurrency and Multithreading - Introduction

Поділитися
Вставка
  • Опубліковано 2 лис 2024

КОМЕНТАРІ • 210

  • @karaczan5839
    @karaczan5839 7 місяців тому +57

    0% yapping
    0% wasting time
    0% advertising
    100% pure knowledge
    absolute chad

    • @JakobJenkov
      @JakobJenkov  7 місяців тому +5

      Thank you very much for your kind words ! :-)

    • @omkarshendge5438
      @omkarshendge5438 2 місяці тому

      bro goated bro what a beautiful video seriously!

  • @shubhamagarwal1434
    @shubhamagarwal1434 5 місяців тому +9

    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..

    • @JakobJenkov
      @JakobJenkov  5 місяців тому +1

      I am happy that my tutorials were helpful to you over the years!! :-)

  • @AshishRajput-fh4bh
    @AshishRajput-fh4bh Місяць тому +4

    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.

    • @JakobJenkov
      @JakobJenkov  Місяць тому

      Thank you very much for your kind words!! :-)

  • @abishekraju4521
    @abishekraju4521 3 місяці тому +5

    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!

  • @rsenytsya
    @rsenytsya 4 місяці тому +2

    This playlist as well as whole channel is one of those treasures of youtube

  • @charlesxavierhorne2855
    @charlesxavierhorne2855 Місяць тому +2

    Thank you so much! What a great introduction. Now, it makes sense why several loops in run() sometimes overtake each other.

    • @JakobJenkov
      @JakobJenkov  Місяць тому

      You are welcome ! ... I am happy that you find this video useful! :-)

  • @andrewkang6200
    @andrewkang6200 9 місяців тому +6

    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

    • @JakobJenkov
      @JakobJenkov  9 місяців тому

      Thank you very much for your kind words ! :-)

  • @abhaythakur8572
    @abhaythakur8572 3 роки тому +5

    read your blogs few months ago, today found your youtube channel what a awesome day . thanks for tutorials man

  • @genhub9288
    @genhub9288 3 роки тому +2

    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 . :)

    • @JakobJenkov
      @JakobJenkov  3 роки тому +1

      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.

  • @priyankawagh5217
    @priyankawagh5217 3 місяці тому

    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 👍

    • @JakobJenkov
      @JakobJenkov  3 місяці тому

      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 :-)

  • @hesona9759
    @hesona9759 Рік тому +1

    I can't understand exactly the concept of Concurrency and Multithreading for a year. Luckily, I saw your video. Thank you so much

  • @boltez6507
    @boltez6507 5 місяців тому +2

    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.

    • @JakobJenkov
      @JakobJenkov  5 місяців тому

      Than you very much !! 😊😊😊

  • @kfg645
    @kfg645 6 місяців тому +5

    This is academically rigorous, industrially competitive and very helptul tutorial

    • @JakobJenkov
      @JakobJenkov  6 місяців тому +1

      Thank you very much !! 😊😊😊

  • @subinos
    @subinos 3 місяці тому +1

    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

    • @JakobJenkov
      @JakobJenkov  3 місяці тому

      Thank you very much! :-) ... I am happy the video series is helpful! :-)

  • @dhananjaychoudhary7836
    @dhananjaychoudhary7836 7 місяців тому +1

    Thanks Jakob for this video, it cleared my concurrency visualisation and dots are better connected now.
    Onto the next dot now.
    Stay Awesome!

  • @hstanciu
    @hstanciu 3 роки тому +5

    Undeserved small number of views. Your videos are excellent! Thx.

    • @JakobJenkov
      @JakobJenkov  3 роки тому +3

      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.

  • @garimadhanania1853
    @garimadhanania1853 6 місяців тому +1

    Hands down the best free resource for learning Java concurrency!!

    • @JakobJenkov
      @JakobJenkov  6 місяців тому +1

      Thank you very much !! 😊
      One more video coming out soon in the playlist !! 😊

  • @FABGIO1
    @FABGIO1 Рік тому +6

    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😊

    • @JakobJenkov
      @JakobJenkov  Рік тому +1

      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 :-)

    • @JerreMuesli
      @JerreMuesli Рік тому +1

      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

  • @vaibhav4973
    @vaibhav4973 4 роки тому +25

    Love your concept explanation :) I hope you will continue to help us like this. Thanks

    • @JakobJenkov
      @JakobJenkov  4 роки тому

      Thanks ! :-) ... I have planned a good list of videos more - on Java Concurrency.

  • @mostinho7
    @mostinho7 3 роки тому +10

    Done thanks!
    Concurrency vs parallelism
    OS context switching vs actually running tasks on different cores

  • @sharipovsunnatillo2772
    @sharipovsunnatillo2772 10 місяців тому

    This is the best tutorial I have ever seen about multithreading and a far better any udemy courses. Thanks a lot bro!

    • @JakobJenkov
      @JakobJenkov  10 місяців тому

      You are welcome ! ... and thank you for your praise ! :-)

  • @narendrayadav71
    @narendrayadav71 4 місяці тому +1

    Bible of Java Concurrency !!!
    Thanks for the efforts !!!

  • @ericfricke4512
    @ericfricke4512 3 роки тому +23

    Great teaching skills! Clear, concise, and engaging :)

  • @mithunkarthik5551
    @mithunkarthik5551 Рік тому +1

    Great explanation, the best video I have ever seen for concurrency

  • @KiprutoR
    @KiprutoR 3 роки тому +1

    Best explanation of multithreading on the internet

    • @JakobJenkov
      @JakobJenkov  3 роки тому

      Thank you very much ! Glad you liked it ! :-)

    • @KiprutoR
      @KiprutoR 3 роки тому

      @@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

  • @maywilliams82
    @maywilliams82 11 місяців тому +1

    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. 🙏

    • @JakobJenkov
      @JakobJenkov  11 місяців тому

      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 !

  • @kurisuta1305
    @kurisuta1305 Рік тому

    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 :)

    • @JakobJenkov
      @JakobJenkov  Рік тому

      You are welcome! ... I am happy my tutorials are helpful for you! ... and thank you for taking the time to tell me! :-)

  • @pramodparmar445
    @pramodparmar445 Рік тому

    Very good explanation :)
    Every Java Developer should watch it before writing yourself as a developer in Resume...!!

    • @JakobJenkov
      @JakobJenkov  Рік тому

      Thank you! :-) ... watch the whole playlist too! (see description below the video) :-)

  • @PbPomper
    @PbPomper 2 місяці тому +1

    Incredible explanation. Instant sub!

  • @krishnakarthik4752
    @krishnakarthik4752 Рік тому +1

    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

    • @JakobJenkov
      @JakobJenkov  11 місяців тому

      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 :-)

  • @Rohitbhole1
    @Rohitbhole1 2 роки тому +1

    Thank you so much for making this gold content available. God bless you!

  • @hamdamboyurunov6034
    @hamdamboyurunov6034 Рік тому +1

    Really nice explanation and video

  • @maturiarun3267
    @maturiarun3267 Рік тому +1

    Thank you sir I really appreciate it.After watching these videos ,it literally clarified my doubts a way better.😊

    • @JakobJenkov
      @JakobJenkov  11 місяців тому

      Great! Glad to hear it ! :-)

  • @MohitKhare
    @MohitKhare Рік тому +1

    thanks Jakob. wonderfully explained. you've got a new sub.❤

  • @VikramSingh-wy5mn
    @VikramSingh-wy5mn 6 місяців тому +1

    Thanks Jakob for such a nice explanation.

  • @cdgtopnp
    @cdgtopnp 3 роки тому +3

    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

    • @JakobJenkov
      @JakobJenkov  3 роки тому

      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!

    • @mayankpant5376
      @mayankpant5376 Рік тому

      ​@@JakobJenkov Try motion canvas or manima !!

  • @abhishekanand3842
    @abhishekanand3842 3 роки тому +3

    Wonderful videos..clear explanations of complex topics. Helped me a lot in clearing my basic concepts

  • @sair2917
    @sair2917 4 роки тому +1

    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.. ✌😎👍

    • @JakobJenkov
      @JakobJenkov  4 роки тому +1

      Thanks - next planned video is also going to be in this playlist :-)

    • @sair2917
      @sair2917 4 роки тому

      @@JakobJenkov can u please come up with concurrent collections video playlist.. Thanks again

  • @Дмитрий-х2й5р
    @Дмитрий-х2й5р 3 роки тому +5

    Awesome! Your tutorials are extremely useful and easy to understand! Thank you very much.

  • @romanburenko7593
    @romanburenko7593 2 роки тому +1

    Awesome tutorial ! The best one I've seen !

  • @rahulchauhan-sg3yb
    @rahulchauhan-sg3yb 4 роки тому +2

    HiJakob, I am waiting for your other videos on concurrency i have watched your three videos. Your explanation and tutorial are very helpful.

    • @JakobJenkov
      @JakobJenkov  4 роки тому +2

      Great - I have more videos about Java Concurrency coming soon! :-)

  • @oleksii_shtanko
    @oleksii_shtanko 3 роки тому +1

    Thank you so much for your video. It was easy to understand your explanation. Good job!

    • @JakobJenkov
      @JakobJenkov  3 роки тому

      Great ! - glad it was helpful!

  • @tanvirpathan8993
    @tanvirpathan8993 3 роки тому +2

    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
      @JakobJenkov  3 роки тому

      Thank you ! ... What exactly do you mean by "resolve the blocked thread" ?

    • @tanvirpathan8993
      @tanvirpathan8993 3 роки тому

      @@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.

  • @SoeaOu
    @SoeaOu 3 роки тому +1

    legend, thanks for putting this out

  • @vsingh-26
    @vsingh-26 3 роки тому +2

    You are amazing, what an explanation. Well done.

    • @JakobJenkov
      @JakobJenkov  3 роки тому

      Thank you very much for your kind words :-) I am glad my video helped you!

  • @lool7922
    @lool7922 3 роки тому +1

    What a wonderful explanation, big thanks 😊

  • @AMITTIWARI-re9sg
    @AMITTIWARI-re9sg Рік тому +1

    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. :)

    • @JakobJenkov
      @JakobJenkov  Рік тому

      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 :-)

  • @uditmahajan555
    @uditmahajan555 4 роки тому +3

    Nice video. Thanks a bunch for it (:

    • @JakobJenkov
      @JakobJenkov  4 роки тому

      You are welcome ! Glad you liked it! :-) Did you watch the whole Java Concurrency playlist?

  • @17a.studio
    @17a.studio 3 роки тому +2

    You're a lifesaver!

  • @KratosProton
    @KratosProton Рік тому +1

    Great explanation!

  • @priyankjoshi3018
    @priyankjoshi3018 3 роки тому

    Hi Jakob, nice one..keep it up and also have been visiting your website as well. Good Stuff.

    • @JakobJenkov
      @JakobJenkov  3 роки тому

      Thanks! :-) ... I will try keep it up :-)

  • @taoma9293
    @taoma9293 9 місяців тому +1

    Great lesson ! 🤝

  • @fisnikmiftari9611
    @fisnikmiftari9611 4 роки тому +4

    Thanks a lot, pretty decent explanation.

  • @salahayman3513
    @salahayman3513 2 роки тому +1

    one of best content really

  • @huynhtrung6338
    @huynhtrung6338 2 роки тому +1

    I love your contents very much!

  • @sreenathmca
    @sreenathmca 4 роки тому +5

    great explanation.

  • @SouthernSeneca
    @SouthernSeneca Місяць тому +1

    Thank you. very helpful indeed

    • @JakobJenkov
      @JakobJenkov  Місяць тому

      Thanks! Glad its helpful! :-)

  • @yaqinup
    @yaqinup 4 роки тому +4

    great explanation.. thank you !

  • @ahmadalastal5303
    @ahmadalastal5303 Рік тому +2

    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.

    • @JakobJenkov
      @JakobJenkov  Рік тому +1

      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.

    • @bittupaul9455
      @bittupaul9455 11 місяців тому +1

      8:58 to 9:18 - you mentioned that two threads can do IO at the same time

    • @hamsterhaunter5718
      @hamsterhaunter5718 4 місяці тому

      @@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.

  • @weaammohamed8992
    @weaammohamed8992 Рік тому +1

    clear explanation. Thank you

  • @suprecam9880
    @suprecam9880 3 роки тому +1

    Awesome! Big help, thank you

    • @JakobJenkov
      @JakobJenkov  3 роки тому

      You are welcome - glad you liked it! :-)

  • @sangeeta338
    @sangeeta338 Рік тому

    Amazing content and explanations !!!

    • @JakobJenkov
      @JakobJenkov  Рік тому

      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 :-)

  • @aaryabhatia2478
    @aaryabhatia2478 3 роки тому +2

    great lesson

  • @alessandroporfirio1910
    @alessandroporfirio1910 3 роки тому +1

    Very good video, thank you!

  • @tomok284
    @tomok284 2 роки тому +1

    Clear explanation

  • @alexandrprodan8794
    @alexandrprodan8794 2 роки тому +1

    what a great tutorial!

  • @VishalSharma-lo5ol
    @VishalSharma-lo5ol 4 роки тому +3

    Very helpful, Thank u :)

  • @andrewsoares8941
    @andrewsoares8941 Рік тому

    At the end of the video you talked a little bit about "No shared mutable state concurrency", Is multi-processing one type of that?

    • @JakobJenkov
      @JakobJenkov  Рік тому

      I am not sure what the exact definition of "multi-processing" is.

  • @matus6681
    @matus6681 3 роки тому +2

    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!

    • @JakobJenkov
      @JakobJenkov  3 роки тому

      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.

  • @anthonysouza-pl5pm
    @anthonysouza-pl5pm 8 місяців тому +1

    thats easy to undestand now let me check out how to code using concurrency

  • @mouradlaraba
    @mouradlaraba 3 роки тому +1

    thanks a lot for your generosity sir :)

  • @seriousskateboarding9938
    @seriousskateboarding9938 3 роки тому +1

    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.

    • @JakobJenkov
      @JakobJenkov  3 роки тому

      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.

  • @jay-rathod-01
    @jay-rathod-01 3 роки тому +1

    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?

    • @JakobJenkov
      @JakobJenkov  3 роки тому +1

      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.

  • @كلشيءمفيد
    @كلشيءمفيد Рік тому +1

    You are amazing

  • @mukhtarbimurat5106
    @mukhtarbimurat5106 Рік тому +1

    Great, thanks!

  • @raghavsharma4195
    @raghavsharma4195 3 роки тому +1

    Thx sir, is this playlist completed??

    • @JakobJenkov
      @JakobJenkov  3 роки тому +1

      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.

  • @dragonceo5911
    @dragonceo5911 3 роки тому +1

    I have bought amd threadripper 32 core 64 thread cpu. Do i still need to use mutithreading for efficiency?

    • @JakobJenkov
      @JakobJenkov  3 роки тому

      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).

    • @dragonceo5911
      @dragonceo5911 3 роки тому

      @@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.

  • @xsendilien9551
    @xsendilien9551 4 роки тому +3

    I'm a bit confused. Multithreading is application's multitasking, or something like this?

    • @JakobJenkov
      @JakobJenkov  4 роки тому +2

      You could say that - but there are (or can be) some subtle differences. Threads may share memory. OS processes (tasks) usually don't.

    • @xsendilien9551
      @xsendilien9551 4 роки тому

      @@JakobJenkov Thank you Jenkov)

  • @lifesport1380
    @lifesport1380 3 роки тому +1

    Great videos❤️

  • @kruthiksai2372
    @kruthiksai2372 2 роки тому +1

    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 .

    • @JakobJenkov
      @JakobJenkov  2 роки тому

      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.

  • @basudapalapur2969
    @basudapalapur2969 3 роки тому +1

    Thanks!, Good content!

    • @JakobJenkov
      @JakobJenkov  3 роки тому

      You are welcome! Great to hear! Thanks! :-)

  • @youssoufcameroon2565
    @youssoufcameroon2565 2 роки тому

    Jkob Jenkov is Legend

  • @nandhakishore6548
    @nandhakishore6548 Рік тому

    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 ?

    • @JakobJenkov
      @JakobJenkov  Рік тому

      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.

  • @mahek2001
    @mahek2001 Рік тому

    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 .

    • @JakobJenkov
      @JakobJenkov  Рік тому +2

      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.

    • @anlackermann590
      @anlackermann590 Рік тому

      ​@@JakobJenkovthanks

  • @chitranshsaxena59
    @chitranshsaxena59 2 роки тому

    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?

    • @JakobJenkov
      @JakobJenkov  2 роки тому

      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.

  • @Das.Kleine.Krokodil
    @Das.Kleine.Krokodil Рік тому

    Very good!

  • @jericho7989
    @jericho7989 2 роки тому +1

    Is this playlist in order?

    • @JakobJenkov
      @JakobJenkov  2 роки тому +2

      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.

    • @jericho7989
      @jericho7989 2 роки тому

      @@JakobJenkov Thank you sir, 😁

  • @Gohel95
    @Gohel95 3 роки тому +2

    Thanks mannn❤️

  • @tianyangren
    @tianyangren 4 роки тому +1

    Finally!

    • @JakobJenkov
      @JakobJenkov  4 роки тому +3

      Been waiting for Java Concurrency videos?

  • @abdulmajeedghandy5407
    @abdulmajeedghandy5407 3 роки тому

    you're really great thank u very much

  • @minasalah8210
    @minasalah8210 3 роки тому +1

    thank's...

  • @arjaymarigondon1485
    @arjaymarigondon1485 3 роки тому +1

    Continue to make video turorialsssssss

  • @shanthishanthi7078
    @shanthishanthi7078 4 місяці тому +1

    God bless you ✝️

  • @romulusbucur1237
    @romulusbucur1237 2 роки тому +1

    Introduction for guys who have no programming experience.

  • @markomilinkovic179
    @markomilinkovic179 5 місяців тому +1

    AWESOME VIDEO!

  • @markomilinkovic179
    @markomilinkovic179 5 місяців тому +1

    SO GOOD!

  • @chong9082
    @chong9082 3 роки тому +1

    Great explanation!

    • @JakobJenkov
      @JakobJenkov  3 роки тому

      Thanks! Glad you liked it! :-)