Java ForkJoinPool

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.ค. 2024
  • The Java ForkJoinPool helps you break down large tasks into smaller subtasks which can be executed in parallel using all, or some, of the CPU cores available in your computer. The Java ForkJoinPool thus helps you implement a fork and join type of work break down and parallelism.
    The Java ForkJoinPool implements a work stealing algorithm which further helps utilize the CPU cores in your computer more efficiently. This work stealing algorithm is also explained in this Java ForkJoinPool tutorial.
    Chapters:
    0:00 Java ForkJoinPool introduction
    1:18 Dividing tasks into subtasks
    1:59 Fork and join process
    3:48 Work stealing
    7:27 Creating a ForkJoinPool code example
    9:16 Submitting actions and tasks to a ForkJoinPool
    10:56 RecursiveAction vs. RecursiveTask
    11:55 RecursiveAction implementation example
    18:28 RecursiveTask implementation example
    22:32 Additional ForkJoinPool methods
    X (Twitter): @jjenkov
    LinkedIn: / jakob-jenkov-4a3a8
    Java ForkJoinPool tutorial - text:
    jenkov.com/tutorials/java-uti...
    Java Concurrency tutorial - text:
    jenkov.com/tutorials/java-con...
    Java Concurrency video playlist:
    • Java Concurrency and M...
    Java Code Examples GitHub Repository:
    github.com/jjenkov/java-examples
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @qurdedu4032
    @qurdedu4032 2 หลายเดือนก่อน +9

    Jakob, you are purely a Legend. thanks a lot for the great explanations.

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

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

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

    Lengend Jakob thanks for your explaination on java topics with deep insight

  • @zeinabrahmani-tn8rq
    @zeinabrahmani-tn8rq หลายเดือนก่อน +1

    I've watched all of your videos on Concurrency and Multithreading, and they were incredibly informative. Thank you!

    • @JakobJenkov
      @JakobJenkov  27 วันที่ผ่านมา +1

      Thank you very much !!
      I am happy you found them useful ! 😊

  • @TECH_KG
    @TECH_KG 8 วันที่ผ่านมา +1

    Thanks for this amazing playlist and clear explanations. Learned a lot from this!!!

    • @JakobJenkov
      @JakobJenkov  31 นาทีที่ผ่านมา

      You are very welcome! :-)

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

    you make Java so much more interest! thank you!

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

      Thanks a lot for your kind words !! 😊 ... and you are welcome !! 😊

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

    Excellent tutorial, thank you very much!

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

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

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

    as always, you're the best.
    thank you very much ^^

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

      Thank you very much :-)

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

    Thanks for the brilliant video, as always, clear and concise. I am still curious how does the async IO, CPU sharing look like. In the examples all the tasks were completed e2e. Is there a correct way of using IO, to make sure it's FJP compliant?

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

      There is no special way of using IO required. If you use blocking IO from within an ForkJoinPool, the thread will be blocked until the IO call finishes. The ForkJoinPool might start up extra threads in that case, but I don't actually know.

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

      @@JakobJenkov Thanks for the reply. I'll do some reasearch, as you point our yourself, there should be a way to get multiple tasks to share the same CPU.

  • @user-bi1lk3ub8h
    @user-bi1lk3ub8h 2 หลายเดือนก่อน +3

    if Java was the Kingdom Jakob would be the King

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

      I am probably more of an ambassador ;-)

  • @avalagum7957
    @avalagum7957 6 วันที่ผ่านมา

    At 4:30, I thought that there was a single queue holding tasks. The executor choose a free thread to execute the next task in that single queue. In what executor, do we have a queue of tasks for each thread?

    • @JakobJenkov
      @JakobJenkov  31 นาทีที่ผ่านมา

      Some ExecutorService implementations have a single queue holding tasks internally. But the ForkJoinPool uses multiple queues.

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

    should I learn operating system before learning java thread ?

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

      No, that should not be necessary :-)

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

    Best videos I've seen. I'm wondering why so low views !?

    • @JakobJenkov
      @JakobJenkov  27 วันที่ผ่านมา

      Thank you !!
      You will have to ask TH-cam about the views... who knows how the TH-cam algorithms actually work... 🤷‍♂️