Java 7:Fork / Join框架 [英] Java 7: Fork/Join Framework

查看:126
本文介绍了Java 7:Fork / Join框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能解释一下Fork / Join是什么吗?

Can someone explain what Fork/Join is?

推荐答案

Fork Join是一个新的框架,它有一个更易于使用的API对于并行,分而治之的算法。

Fork Join is a new framework that has an easier to use API for a parallel, divide and conquer algorithm.

假设你有一个长期运行的任务,对于这个实例,它有一个复杂的算法。您可能希望分叉大型任务,现在可以处理这两项任务。现在让我们说这两个任务仍然太大,你可以将每个任务分成两个任务(此时有四个)。

Say you have a long running task that, for this instance, has a complicated algorithm. You would want to fork the large tasks and now work on those two tasks. Now lets say that that those two tasks are still too big, you would fork each into two tasks (at this point there are four).

你会继续这个任务直到每个任务的大小可以接受并调用算法。重要的是要知道每个任务的调用是并行完成的。当任务完成后,它将与分叉的其他任务结合并合并结果。

You would continue this until each task is at an acceptable size and invoke the algorithm. It is important to know the invocation of each task is done in parallel. When the task is completed it is joined with the other task it was forked with and consolidate the results.

这将继续,直到所有任务都已加入并返回一个任务。

This will continue until all tasks have been joined and one task is returned.

这篇关于Java 7:Fork / Join框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆