针对目前对于Fork/Join框架应用和性能分析的相关工作还不多的现状,以JGF基准测试程序套件为基础,对其中的series、crypt、sparsematmuh和sot等程序使用Fork/Join框架进行重构,并以series程序为例,详细地说明了重构的过程。在实验中,首先,测试了每个程序在不同阈值下使用Fork/Join框架分别递归1、2、3次执行程序的时间,进而选择相对较好的阈值;然后,对每个程序使用Fork/Join框架和使用Thread的执行时间进行了对比;此外,测试了重构后的程序在执行过程中任务窃取的情况。实验结果表明,Fork/Join框架执行时间与多线程执行时间相比,平均降低了14.2%;对于series程序,当数据大小为sizeC且线程个数为2时,Fork/Join框架执行时间比多线程执行时间降低高达40%,可见,在多核处理器平台上应用Fork/Join框架比使用多线程将获得更好的性能。
There are few works performed on the application and analysis of the Fork/Join framework at present. This paper refactored several benchmarks, including series, crypt, sparsematmult and sor, in the Java Grande Forum (JGF) benchmark suite by using Fork/Join framework. Taking the series benchmark as an example, detailed refactoring process was presented. In the experimentation, the execution time of each benchmark was evaluated with different threshold, and the execution time of Fork/Join framework was compared with that of multi-threaded version. Furthermore, the number of work- stealing operations was presented. The experimental results show that the execution time using Fork/Join framework can reduce 14.2% on average than that using multi-thread. When evaluating the series benchmark with data size sizeC and two threads, the execution time of Fork/Join framework is 40% lower than that with multi-thread. Programs using the Fork/Join framework can get better performance than that using multi-thread.