Thread Congestion in Java

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

КОМЕНТАРІ • 46

  • @mathiassintal2237
    @mathiassintal2237 2 роки тому +13

    I watched all of your videos in this playlist and almost everything is very simple explained and easily understandable. Thank you so much for the high quality content and your very good teaching!
    Much love, I really appreciate your work!

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

      You are welcome! Glad it was helpful and easy to understand! I put a lot of effort into making the topics easy to understand, so I am always happy whenever a person experience that it was :-)

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

    Thank you for all the effort you put in Jakob!

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

      You are welcome! And thank you for telling me! :-)

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

    Done thanks great video
    Thread congestion due to lock contention, as you increase consumer threads throughout will increase but eventually decrease due to congestion
    Solution give each thread its own data structure or use lock free DS

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

      When 2 threads each increment the same counter 1 million times - then the final total number of increments will be 2 million - but only the last thread to reach 1 million increments will see the final total of 2 million increments when it checks the total (after making its own 1 million increments).

  • @ДмитрийСимон-й9н
    @ДмитрийСимон-й9н 7 місяців тому +1

    Thank you! Was very helpful! Does keepRunning need to be atomic?

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

    Thank you for great explanation and adding illustrations to your videos it really helps to understand!

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

      You are welcome! :-) I am happy you liked them!

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

    Hi Jakob, I watched all your videos in this playlist and it really helped me as someone new to Java. These must have taken a lot of time. Thank you for making these! And let us know if you plan on opening a Patreon again.

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

      Hi Grace, thank you for letting me know! :-) I did have a Patreon account at some point, but only 2 people ever signed up, and they didn't remain signed up for long, so I ended up shutting it down. Developers are notorious for expecting everything "for free" ;-)

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

    also a tip: it would have been good to see the time difference in performance for the 2 examples discussed, that way we can say that the 1st example takes more time to consume because of the blocking

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

    Nice tutorial, thanks. Please upload atleast one video per week.

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

      Thanks! ... I wish I had the time to upload tutorials that often - but unfortunately I don't :-/

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

    you don't actually need to synchronize the local variable in main method. In JMM, if thread A run action a before it starts the Thread B while b is the first action in Thread B, then the hb(a, b)

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

      A call to start() on a thread happens-before any actions in the started thread.

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

    question: lets say there are two cores and one thread running on each core, so basically 2 threads running in parallel
    lets say there are two tasks in the blocking queue
    if thread1 and thread2 parallelly try to access the queue to pick up the tasks, one of them gets blocked and say thread1 is able to pick up task1, now only when thread1 has stopped accessing the queue can thread2 read task2 from the queue? Both it could happent that thread1 started executing task1 and just after that thread2 picked and started executing task2, and now both threads are running parallelly?
    Long story short, the blocking is only for accessing the queue to pick up tasks and not to execute the tasks themselves right?

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

      Yes, the BlockingQueue only guards access to the queue itself. It does not affect what the threads do with the objects taken from the queue.

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

    Спасибо!

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

      Hi Rhemaxus, thank you for the tip ! :-) ... I did not realize there was a tip attached to this comment until today!
      Thanks again! :-)

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

    Thank you very much for this amazing tutorial and l learned lot from this. Also, It's easily understandable.♥

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

      Thank you! I am happy to hear that! :-)

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

    great tutorials thank you!

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

    Thank you very much!

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

    Very good tutorial, really appreciated it.

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

    Why did you mention that you have added synchronized keyword during starting of threads in line 17-22, for visibility issues? I have gone through the video but could not understand the reference here? Thank you in advance.

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

      That is a reference to other videos in that playlist. The issue of "thread visibility" is covered in other videos in this playlist.

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

    Thank you very much! Really great video.

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

      Thanks ! Glad you liked it! :-)

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

    Great Thanks for this tutorial, really helpful.

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

    Your java se tutorial site is not working, could you please make it up and running

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

      The old server has become unstable. I have been in the process of moving to cloud infrastructure, so going forward it should all get much more stable over time!

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

      @@JakobJenkov i can't beleive that my role model and (guru like) good soul is replying to me! Thank you for your time.
      I want guidance from you, on how to proceed after completing java se tutorial. I wanted to become a good java developer!
      Shall i start studying spring tutorial or jsp, servlets and ejb?
      Im learning a little bit of basics of python since i heard that there is jython (java + python)
      If you could help me by giving a road map to become a good developer, it would be a great support for me to get a job.
      Please help me to learn development, so that i can reduce burden of my family especially i wanna pay back my mother who supported me in my tough times!

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

      @@JakobJenkov is there any cloud infrastructure that is free to learn/use for learning java development?

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

    Hi. Your website is down, just sayin

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

      Had unstable server, and DNS issues lately...

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

    Where can we find the source code

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

      On GitHub - here:
      github.com/jjenkov/java-examples/tree/main/src/main/java/com/jenkov/java/concurrency/threadcongestion

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

    Thanks for your job. I'd like a video
    about ForkJoinPool... If you want ideas 💡

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

      Feedback and ideas are always welcome! :-) I've had some months with too many other things going on - so not enough time to make videos. But I think I will get some done again soon. Got a mixed bag of topics I have material enough to make videos about. Regarding the ForkAndJoinPool - I actually have a textual tutorial on my tutorial website you can start with (until I get around to making a video):
      jenkov.com/tutorials/java-util-concurrent/java-fork-and-join-forkjoinpool.html

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

    Next Project Loom?

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

      Project Loom is not yet finalized, as far as I know.