吉林大学学报(信息科学版) ›› 2015, Vol. 33 ›› Issue (1): 105-110.

• 论文 • 上一篇    

基于多线程归并排序算法设计

孙琳琳1, 侯秀萍1, 朱波1, 孙士明1, 高灿2   

  1. 1. 长春工业大学 计算机科学与工程学院, 长春 130012; 2. 苏州大学 附属第一医院, 江苏 苏州 215006
  • 收稿日期:2014-04-09 出版日期:2015-01-24 发布日期:2015-03-20
  • 作者简介:孙琳琳(1989—), 女, 吉林四平人, 长春工业大学硕士研究生, 主要从事软件测试研究, (Tel)86-18943626350(E-mail)ccutlinlin@126.com;通讯作者: 侯秀萍(1964—), 女, 长春人, 长春工业大学教授, 硕士生导师, 主要从事软件测试研究,(Tel)86-18643194774(E-mail)houxiuping@mail.ccut.edu.cn。
  • 基金资助:

    国家科技部863高技术基金资助项目(2011AA040602)

Merge Sort Algorithm Design Based on Multi-Thread

SUN Linlin1, HOU Xiuping1, ZHU Bo1, SUN Shiming1, GAO Can2   

  1. 1. School of Computer Science and Engineering, Changchun University of Technology, Changchun 130012, China;2. The First Affiliated Hospital, Sooc
    how University, Suzhou 215006, China
  • Received:2014-04-09 Online:2015-01-24 Published:2015-03-20

摘要:

为解决传统递归方式的归并排序算法串行执行效率低的问题, 使用数据依赖关系分析方法对归并排序算法进行并行性分析。通过分析发现算法本身具有并行的特征, 在多核处理器下使用OpenMp编译制导语句对算法进行直接并行化处理。在数据量较大的情况下, 为了使算法执行的速度更快, 在多核处理器系统中设置多个线程, 并将序列分成多个组, 每个线程操作一组数据, 最后对多个局部有序的结果进行逐一合并。实验验证结果表明, 该并行化算法可使执行速度提高50%以上。

关键词: 归并排序, 多核多线程, OpenMp编译制导语句, 数据依赖关系, 并行化

Abstract:

In order to solve the traditional recursively merge sort algorithm serial execution efficiency of general problems, we used data dependence analysis methods on recursive merge sort algorithm parallelism analysis. The analysis shows that the algorithm itself has the characteristics of parallel, and multi-core processors can be used to compile OpenMp direct guidance statement on parallel processing algorithms. In case of large amount of data, use multiple threads in a multi processor system, divide the sequence into several groups and set each thread operation of a group of data in order to make the algorithm performs faster. Finally, the research merged a plurality of partial results which were ordered. Experiment result shows that this method of parallel algorithm can improve the speed of execution of the algorithm.

Key words: merge sort, multicore and multithread, OpenMp, data dependence, parallelization

中图分类号: 

  • TP39