摘要
软件开发人员在并发编程中面临着各种Java锁的选择。针对如何选择合适的锁机制进而提高程序性能的问题,提出了一种帮助并发程序开发人员选择锁机制的推荐方法 Lock Rec。首先,采用程序静态分析技术,对并发程序中锁机制的使用进行分析并确定影响程序性能的程序特征属性;然后,使用改进的随机森林算法构建锁机制推荐模型,以帮助开发人员在同步锁、可重入锁、读写锁、邮戳锁这四种锁之中进行选择。分别选取了四种现有的机器学习数据集对Lock Rec进行了实验,所提方法的推荐准确率均值可达95.1%;此外使用真实并发程序对Lock Rec的推荐结果进行分析。实验结果表明Lock Rec可以有效提高并发程序的执行效率。
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.
作者
张杨
董士程
ZHANG Yang;DONG Shicheng(School of Information Science and Engineering,Hebei University of Science and Technology,Shijiazhuang Hebei 050018,China)
出处
《计算机应用》
CSCD
北大核心
2021年第6期1597-1603,共7页
journal of Computer Applications
基金
国家自然科学基金资助项目(61440012)
河北省教育厅科学研究计划重点项目(ZD2019093)
河北省基础研究计划重点基础专项(18960106D)。
关键词
并发程序
锁机制
随机森林
推荐模型
程序性能
concurrent program
lock mechanism
random forest
recommendation model
program performance