Journal of Computer Applications ›› 2021, Vol. 41 ›› Issue (6): 1597-1603.DOI: 10.11772/j.issn.1001-9081.2020121929

Special Issue: 2020年全国开放式分布与并行计算学术年会(DPCS 2020)

• National Open Distributed and Parallel Computing Conference 2020 (DPCS 2020) • Previous Articles     Next Articles

Intelligent recommendation method for lock mechanism in concurrent program

ZHANG Yang, DONG Shicheng   

  1. School of Information Science and Engineering, Hebei University of Science and Technology, Shijiazhuang Hebei 050018, China
  • Received:2020-12-10 Revised:2021-03-29 Online:2021-06-10 Published:2021-06-21
  • Supported by:
    This work is partially supported by the National Natural Science Foundation of China (61440012), the Key Project of Hebei Education Department Scientific Research Planning (ZD2019093), the Key Basic Project of Hebei Fundamental Research Planning (18960106D).


张杨, 董士程   

  1. 河北科技大学 信息科学与工程学院, 石家庄 050018
  • 通讯作者: 张杨
  • 作者简介:张杨(1980-),男,河北秦皇岛人,副教授,博士,CCF高级会员,主要研究方向:智能化软件、软件重构;董士程(1995-),男,山东济南人,硕士研究生,主要研究方向:智能化软件。
  • 基金资助:

Abstract: The choices of Java locks are faced by the developers during parallel programming. To solve the problem of how to choose the appropriate lock mechanism to improve the program performance, a recommendation method named LockRec for developers of concurrent program to choose lock mechanism was proposed. Firstly, the program static analysis technology was used to analyze the use of lock mechanism in concurrent programs and determine the program feature attributes that affect the program performance. Then, the improved random forest algorithm was used to build a recommendation model of lock mechanism, so as to help the developers to choose the lock among synchronization lock, re-entrant lock, read-write lock, and stamped lock. Four existing machine learning datasets were selected to experiment with LockRec. The average accuracy of the proposed LockRec is 95.1%. In addition, the real-world concurrent programs were used to analyze the recommendation results of LockRec. The experimental results show that LockRec can effectively improve the execution efficiency of concurrent programs.

Key words: concurrent program, lock mechanism, random forest, recommendation model, program performance

摘要: 软件开发人员在并发编程中面临着各种Java锁的选择。针对如何选择合适的锁机制进而提高程序性能的问题,提出了一种帮助并发程序开发人员选择锁机制的推荐方法LockRec。首先,采用程序静态分析技术,对并发程序中锁机制的使用进行分析并确定影响程序性能的程序特征属性;然后,使用改进的随机森林算法构建锁机制推荐模型,以帮助开发人员在同步锁、可重入锁、读写锁、邮戳锁这四种锁之中进行选择。分别选取了四种现有的机器学习数据集对LockRec进行了实验,所提方法的推荐准确率均值可达95.1%;此外使用真实并发程序对LockRec的推荐结果进行分析。实验结果表明LockRec可以有效提高并发程序的执行效率。

关键词: 并发程序, 锁机制, 随机森林, 推荐模型, 程序性能

CLC Number: