Java Concurrency and Multithreading - Introduction

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ส.ค. 2024

ความคิดเห็น • 200

  • @karaczan5839
    @karaczan5839 5 หลายเดือนก่อน +34

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

    • @JakobJenkov
      @JakobJenkov  4 หลายเดือนก่อน +3

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

  • @shubhamagarwal1434
    @shubhamagarwal1434 3 หลายเดือนก่อน +6

    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  3 หลายเดือนก่อน +1

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

  • @abishekraju4521
    @abishekraju4521 หลายเดือนก่อน +3

    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!

    • @JakobJenkov
      @JakobJenkov  หลายเดือนก่อน

      You are welcome 😊

  • @rsenytsya
    @rsenytsya 2 หลายเดือนก่อน +1

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

  • @kfg645
    @kfg645 3 หลายเดือนก่อน +5

    This is academically rigorous, industrially competitive and very helptul tutorial

    • @JakobJenkov
      @JakobJenkov  3 หลายเดือนก่อน +1

      Thank you very much !! 😊😊😊

  • @andrewkang6200
    @andrewkang6200 6 หลายเดือนก่อน +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  6 หลายเดือนก่อน

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

  • @boltez6507
    @boltez6507 3 หลายเดือนก่อน +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  3 หลายเดือนก่อน

      Than you very much !! 😊😊😊

  • @abhaythakur8572
    @abhaythakur8572 3 ปีที่แล้ว +5

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

    • @JakobJenkov
      @JakobJenkov  3 ปีที่แล้ว +2

      You are welcome! :-)

  • @priyankawagh5217
    @priyankawagh5217 หลายเดือนก่อน

    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  หลายเดือนก่อน

      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 10 หลายเดือนก่อน +1

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

    • @JakobJenkov
      @JakobJenkov  10 หลายเดือนก่อน

      Great! Glad it helped ! :-)

  • @subinos
    @subinos 25 วันที่ผ่านมา +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  25 วันที่ผ่านมา

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

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

  • @garimadhanania1853
    @garimadhanania1853 4 หลายเดือนก่อน +1

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

    • @JakobJenkov
      @JakobJenkov  4 หลายเดือนก่อน +1

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

  • @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 TH-cam as a job - just as a hobby. I like playing with new media and tech, and TH-cam keeps evolving, so it's interesting to be here just to see what it can do.

  • @dhananjaychoudhary7836
    @dhananjaychoudhary7836 5 หลายเดือนก่อน +1

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

    • @JakobJenkov
      @JakobJenkov  5 หลายเดือนก่อน

      You are welcome! :-)

  • @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 11 หลายเดือนก่อน +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

  • @narendrayadav71
    @narendrayadav71 หลายเดือนก่อน +1

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

    • @JakobJenkov
      @JakobJenkov  หลายเดือนก่อน

      You are welcome! :-)

  • @sharipovsunnatillo2772
    @sharipovsunnatillo2772 8 หลายเดือนก่อน

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

    • @JakobJenkov
      @JakobJenkov  7 หลายเดือนก่อน

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

  • @vaibhav4973
    @vaibhav4973 3 ปีที่แล้ว +25

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

    • @JakobJenkov
      @JakobJenkov  3 ปีที่แล้ว

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

  • @ericfricke4512
    @ericfricke4512 3 ปีที่แล้ว +23

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

  • @mostinho7
    @mostinho7 3 ปีที่แล้ว +10

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

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

  • @Rohitbhole1
    @Rohitbhole1 2 ปีที่แล้ว +1

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

  • @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! :-)

  • @VikramSingh-wy5mn
    @VikramSingh-wy5mn 4 หลายเดือนก่อน +1

    Thanks Jakob for such a nice explanation.

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

  • @maturiarun3267
    @maturiarun3267 9 หลายเดือนก่อน +1

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

    • @JakobJenkov
      @JakobJenkov  9 หลายเดือนก่อน

      Great! Glad to hear it ! :-)

  • @MohitKhare
    @MohitKhare ปีที่แล้ว +1

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

  • @maywilliams82
    @maywilliams82 9 หลายเดือนก่อน +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  9 หลายเดือนก่อน

      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 !

  • @romanburenko7593
    @romanburenko7593 2 ปีที่แล้ว +1

    Awesome tutorial ! The best one I've seen !

    • @JakobJenkov
      @JakobJenkov  2 ปีที่แล้ว

      Thank you very much! :-)

  • @abhishekanand3842
    @abhishekanand3842 3 ปีที่แล้ว +3

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

  • @user-em8ns3nw7n
    @user-em8ns3nw7n 3 ปีที่แล้ว +5

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

    • @JakobJenkov
      @JakobJenkov  3 ปีที่แล้ว

      You are most welcome!

  • @SoeaOu
    @SoeaOu 3 ปีที่แล้ว +1

    legend, thanks for putting this out

    • @JakobJenkov
      @JakobJenkov  3 ปีที่แล้ว

      You are welcome! :-)

  • @sair2917
    @sair2917 3 ปีที่แล้ว +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  3 ปีที่แล้ว +1

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

    • @sair2917
      @sair2917 3 ปีที่แล้ว

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

  • @17a.studio
    @17a.studio 3 ปีที่แล้ว +2

    You're a lifesaver!

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

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

  • @lool7922
    @lool7922 3 ปีที่แล้ว +1

    What a wonderful explanation, big thanks 😊

    • @JakobJenkov
      @JakobJenkov  3 ปีที่แล้ว

      You're very welcome! :-)

  • @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! :-)

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

  • @sreenathmca
    @sreenathmca 4 ปีที่แล้ว +5

    great explanation.

  • @fisnikmiftari9611
    @fisnikmiftari9611 3 ปีที่แล้ว +4

    Thanks a lot, pretty decent explanation.

  • @hamdamboyurunov6034
    @hamdamboyurunov6034 10 หลายเดือนก่อน +1

    Really nice explanation and video

    • @JakobJenkov
      @JakobJenkov  10 หลายเดือนก่อน

      Thanks ! :-)

  • @uditmahajan555
    @uditmahajan555 3 ปีที่แล้ว +3

    Nice video. Thanks a bunch for it (:

    • @JakobJenkov
      @JakobJenkov  3 ปีที่แล้ว

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

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

  • @taoma9293
    @taoma9293 7 หลายเดือนก่อน +1

    Great lesson ! 🤝

    • @JakobJenkov
      @JakobJenkov  7 หลายเดือนก่อน

      Thanks! 😃

  • @yaqinup
    @yaqinup 4 ปีที่แล้ว +4

    great explanation.. thank you !

  • @salahayman3513
    @salahayman3513 2 ปีที่แล้ว +1

    one of best content really

  • @aaryabhatia2478
    @aaryabhatia2478 3 ปีที่แล้ว +2

    great lesson

  • @tomok284
    @tomok284 ปีที่แล้ว +1

    Clear explanation

  • @huynhtrung6338
    @huynhtrung6338 2 ปีที่แล้ว +1

    I love your contents very much!

    • @JakobJenkov
      @JakobJenkov  2 ปีที่แล้ว +1

      Thank you - very much :-)

  • @KratosProton
    @KratosProton ปีที่แล้ว +1

    Great explanation!

  • @anthonysouza-pl5pm
    @anthonysouza-pl5pm 6 หลายเดือนก่อน +1

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

    • @JakobJenkov
      @JakobJenkov  6 หลายเดือนก่อน

      Thank you 😊

  • @mukhtarbimurat5106
    @mukhtarbimurat5106 ปีที่แล้ว +1

    Great, thanks!

  • @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! :-)

  • @ahmadalastal5303
    @ahmadalastal5303 10 หลายเดือนก่อน +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  10 หลายเดือนก่อน +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 9 หลายเดือนก่อน +1

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

    • @hamsterhaunter5718
      @hamsterhaunter5718 2 หลายเดือนก่อน

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

  • @alexandrprodan8794
    @alexandrprodan8794 2 ปีที่แล้ว +1

    what a great tutorial!

  • @alessandroporfirio1910
    @alessandroporfirio1910 3 ปีที่แล้ว +1

    Very good video, thank you!

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

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

  • @VishalSharma-lo5ol
    @VishalSharma-lo5ol 4 ปีที่แล้ว +3

    Very helpful, Thank u :)

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

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

  • @كلشيءمفيد
    @كلشيءمفيد 11 หลายเดือนก่อน +1

    You are amazing

    • @JakobJenkov
      @JakobJenkov  11 หลายเดือนก่อน

      Thank you 😁

  • @xsendilien9551
    @xsendilien9551 3 ปีที่แล้ว +3

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

    • @JakobJenkov
      @JakobJenkov  3 ปีที่แล้ว +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 3 ปีที่แล้ว

      @@JakobJenkov Thank you Jenkov)

  • @mouradlaraba
    @mouradlaraba 3 ปีที่แล้ว +1

    thanks a lot for your generosity sir :)

    • @JakobJenkov
      @JakobJenkov  3 ปีที่แล้ว

      You are welcome! :-)

  • @youssoufcameroon2565
    @youssoufcameroon2565 2 ปีที่แล้ว

    Jkob Jenkov is Legend

  • @basudapalapur2969
    @basudapalapur2969 3 ปีที่แล้ว +1

    Thanks!, Good content!

    • @JakobJenkov
      @JakobJenkov  3 ปีที่แล้ว

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

  • @Das.Kleine.Krokodil
    @Das.Kleine.Krokodil ปีที่แล้ว

    Very good!

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

  • @lifesport1380
    @lifesport1380 2 ปีที่แล้ว +1

    Great videos❤️

    • @JakobJenkov
      @JakobJenkov  2 ปีที่แล้ว +1

      Thank you very much! :-)

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

  • @andrewsoares8941
    @andrewsoares8941 11 หลายเดือนก่อน

    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  10 หลายเดือนก่อน

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

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

  • @tianyangren
    @tianyangren 4 ปีที่แล้ว +1

    Finally!

    • @JakobJenkov
      @JakobJenkov  4 ปีที่แล้ว +3

      Been waiting for Java Concurrency videos?

  • @Gohel95
    @Gohel95 3 ปีที่แล้ว +2

    Thanks mannn❤️

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

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

  • @abdulmajeedghandy5407
    @abdulmajeedghandy5407 3 ปีที่แล้ว

    you're really great thank u very much

    • @JakobJenkov
      @JakobJenkov  3 ปีที่แล้ว

      Thank you very much ! :-)

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

  • @minasalah8210
    @minasalah8210 3 ปีที่แล้ว +1

    thank's...

    • @JakobJenkov
      @JakobJenkov  3 ปีที่แล้ว +1

      You are most welcome :-)

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

  • @markomilinkovic179
    @markomilinkovic179 3 หลายเดือนก่อน +1

    AWESOME VIDEO!

    • @JakobJenkov
      @JakobJenkov  3 หลายเดือนก่อน

      Thank you ! 😊😊

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

  • @shanthishanthi7078
    @shanthishanthi7078 หลายเดือนก่อน +1

    God bless you ✝️

    • @JakobJenkov
      @JakobJenkov  หลายเดือนก่อน

      Thank you :-)

  • @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, 😁

  • @arjaymarigondon1485
    @arjaymarigondon1485 3 ปีที่แล้ว +1

    Continue to make video turorialsssssss

    • @JakobJenkov
      @JakobJenkov  3 ปีที่แล้ว

      :-D ... I will try 😉

  • @romulusbucur1237
    @romulusbucur1237 ปีที่แล้ว +1

    Introduction for guys who have no programming experience.

  • @markomilinkovic179
    @markomilinkovic179 3 หลายเดือนก่อน +1

    SO GOOD!

    • @JakobJenkov
      @JakobJenkov  3 หลายเดือนก่อน

      Thanks 😁

  • @krishnakarthik4752
    @krishnakarthik4752 9 หลายเดือนก่อน +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  9 หลายเดือนก่อน

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

  • @chong9082
    @chong9082 3 ปีที่แล้ว +1

    Great explanation!

    • @JakobJenkov
      @JakobJenkov  3 ปีที่แล้ว

      Thanks! Glad you liked it! :-)