Review: fork-join decomposition.
回顾:fork - join分解。
Listing 1. Merge-sort using the fork-join library.
清单1.使用fork - join库进行合并排序。
In this regard, JPFF can be viewed as an extended, distributed fork-join framework.
从这个角度来讲,我们可以把JPPF看作一个扩展的、分布式的fork - join框架。
It's easy to express such problems using fork-join, as you saw in the previous installment.
用fork - join可以很容易地表示这类问题,正如您在上一期中看到的那样。
The fork-join framework reduces contention for the work queue by using a technique known as work stealing.
fork - join框架通过一种称作工作窃取(work stealing)的技术减少了工作队列的争用情况。
The pattern in Figure 14 presents the correct way to model parallel branching by using a matching fork-join pair.
图14中的模式展示了使用匹配的 fork-join 对建立并行分支模型的正确方法。
Furthermore, computing the right multiplicities can be challenging in models with more complex fork-join structures.
而且,在一个使用更复杂的fork - join结构的模型中,要计算出正确的增殖次数也并非易事。
Each of these problems can be easily parallelized using divide-and-conquer, and can be easily represented as fork-join tasks.
其中的每个问题都可以用divide - and - conquer轻松地并行化,并能轻松地表示为fork - join任务。
Listing 2 shows an example of a problem that is suitable to a fork-join solution: searching a large array for its maximal element.
清单2显示了一个适合使用fork - join解决方案的问题示例:在大型数组中搜索其中的最大元素。
You then use the description to actually execute the array operations (which USES the fork-join framework under the hood) in parallel.
然后用该描述并行地执行数组操作(幕后使用的是fork - join框架)。
The principal benefit of using the fork-join technique is that it affords a portable means of coding algorithms for parallel execution.
使用fork-join技术的主要好处是,它提供了一种编写并行执行的算法的简便方法。
For most runs, the number of threads in the fork-join pool was equal to the number of hardware threads (cores times threads-per-core) available.
对于大多数运行,fork - join池中的线程数量与可用的硬件线程(内核数乘以每个内核中的线程数)相等。
The fork-join framework supports several styles of ForkJoinTasks, including those that require explicit completions and those executing cyclically.
fork - join框架支持几种风格的ForkJoinTasks,包括那些需要显式完成的,以及需要循环执行的。
Using conventional thread pools to implement fork-join is also challenging because fork-join tasks spend much of their lives waiting for other tasks.
使用传统的线程池来实现fork-join也具有挑战性,因为 fork-join任务将线程生命周期的大部分时间花费在等待其他任务上。
Of course, this is a very simple example, but the fork-join technique is suitable for a wide variety of searching, sorting, and data analysis problems.
虽然这个示例非常简单,但是fork - join技术可用于各种各样的搜索、排序和数据分析问题。
To assess the effectiveness of ParallelArray, I wrote a simple, unscientific program that runs the query for various sizes of array and fork-join pools.
为了评估ParallelArray的效率,我编写了一个简单的程序,针对各种大小的数组和fork-join池运行查询。
The fork-join approach offers a portable means of expressing a parallelizable algorithm without knowing in advance how much parallelism the target system will offer.
fork-join方法提供了一种表示可并行化算法的简单方式,而不用提前了解目标系统将提供多大程度的并行性。
This kind of parallel decomposition is often called fork-join because executing a task forks (starts) multiple subtasks and then joins (waits for completion) with them.
这种并行分解方法常常称作fork-join,因为执行一个任务将首先分解(fork)为多个子任务,然后再合并(join)(完成后)。
For sorting and searching problems, the fork-join library gives you an even easier means of expressing parallelizable operations on data sets: the ParallelArray classes.
对于排序和搜索问题,fork - join库提供了一种表示可以并行化的数据集操作的非常简单的途径:parallelarray类。
This is typical of fork-join problem implementations because the process of recursively dividing the problem will create a potentially large number of new Problem objects.
这在fork-join问题实现中很常见,因为递归分解问题的过程将会创建大量的新Problem对象。
The creeks Rattlesnake, Butler, Lolo, Rock and Deep shimmer and surge; the Blackfoot and the Bitterroot rivers join the Clark Fork just outside of town.
响尾蛇、管家、罗罗、岩石和深水这几条溪闪亮而汹涌;黑足和比特鲁特和刚好在城外汇入克拉克•福克河。
The steps branch out using a fork, and come back together using a join.
步骤使用分叉分出,并使用联合返回。
We'll fork left when the others fork right. We won't join the group tonight for the second five-course meal of the day.
晚上团体要吃今天第二顿的五道菜大餐,我们就不参加了。
Similarly, every fork should eventually be followed by a matching join, which combines all the paths starting from the fork.
同理,每个fork最终也都应跟随一个匹配的join,并由后者组合从 fork开始的所有路径。
To use fork/join directly, you must either use the runForkJoin() method with a task closure or a task class that subclasses AbstractForkJoinWorker.
要直接使用fork/join,您必须使用带有一个任务闭包的runForkJoin()方法或一个将AbstractForkJoinWorker分为子类的任务类。
Revisiting the example from Listing 6, notice that max() is a method already provided on parallel collections, so there is no need to define and invoke a fork/join task directly, as in Listing 7
再看一下清单6中的示例,注意到,max()是一个已经在并行集合中提供的方法,因此没有必要直接定义和调用fork/join任务,如清单 7 所示
The TaskBarrier class mentioned above was used by the fork/join framework to manage the boundaries between the various tasks, and merge their results; in other words: to join the tasks.
前面提到的TaskBarrier类被fork/join框架用来管理不同任务的边界,并合并运行结果,换句话说就是连接任务。
Decision and merge are always mapped to several input and output criteria-one for each branch, while fork and join correspond to a single output and input criterion, respectively.
Decision和merge始终映射到多个输入和输出条件,每个分支对应一个条件,而fork和join则分别对应于一个输出和输入条件。
We used a fork and join and placed additional copies of the tasks between them.
我们使用了一个fork和一个join,并将任务的其他副本置于两者之间。
A could bypass the fork and join, but it still needs to enter and leave the process fragment in the upper branch of the fork.
A可以绕过fork和join,但它仍然需要进入和离开 fork 的靠上那条分支中的流程片断。
应用推荐