Java Multithreading--Forkjoinpool Branch/merge framework work stealing

Source: Internet
Author: User

Fork/join framework: is to be a large task, when necessary, to split (fork) into a number of small tasks (split to No re-disassembly), and then the results of a small task operations to Join summary.

The difference between the fork/join frame and the thread pool

  1. Work-stealing mode (work-stealing): When a new task is performed, it can split it into smaller tasks, add small tasks to the thread queue, and then steal one from the queue of a random thread and put it in its own queue.
  2. The advantages of the Fork/join framework in relation to the general thread pool implementations are in the way that the tasks contained therein are handled. In a generic thread pool, a thread is waiting if a task that is being performed by a thread cannot continue to run for some reason. In the Fork/join framework implementation, a sub-problem cannot continue to run because it waits for the completion of another sub-problem. The thread that handles the sub-problem is actively looking for other sub-problems that are not yet running. This approach reduces thread latency and improves performance.

Java Multithreading--Forkjoinpool Branch/merge framework work stealing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.