2017  Kodetalk | Feedback | Privacy Policy | Terms | About

Fork/Join Framework in Java

I come to know about Java added a new feature Fork and Join from version 7 on wards. And It is designed for work that can be broken into smaller pieces recursively. Can some one explain me about basic principles,behavior and the benefit to use Fork/Join in our real time applications?


Basically the Fork-Join breaks the task at hand into mini-tasksuntil the mini-task is simple enough that it can be solved without further breakups. ItÂ’s like a divide-and-conquer algorithm. One important concept to note in this framework is that ideally no worker thread is idle. They implement a work-stealing algorithmin that idle workers steal the work from those workers who are busy.

To know more about this please see the blog http://howtodoinjava.com/2014/05/27/forkjoin-framework-tutorial-forkjoinpool-example/

Or else you can find the complete details from https://docs.oracle.com/javase/tutorial/essential/concurrency/forkjoin.html

Which help you to understand more on parallel processing of the task inside a method or function.

Answer is