同步开销是影响并行程序性能的一个重要方面,如果同步操作出现在循环中,将会使这种影响进一步扩大.为了降低循环中同步操作的开销,本文提出一种利用即时编译器外提Java程序中循环内同步操作的优化算法,并在实际的Java虚拟机中实现.该算法在保证程序语义不变的前提下,大量减少运行时实际执行的同步操作数量,降低同步开销,并能保证外提变换后同步代码块不会太大而降低程序的并发度.实验结果表明该算法能提高程序的整体性能,并且不降低程序的可扩放性.
Synchronization overhead is an important aspect influencing performance. If synchronization operations are in loops, the influence to performance will be enlarged. To reduce the overhead of synchronization operations in loops, an algorithm on hoisting sy chronization operations from loops with Just-in-time Compiler for Java is put forward and implemented in an existing Java Virtual Ma- chine. The algorithm can greatly decrease synchronization operations at run-time so that the synchronization overhead is reduced, and can ensure the concurrency of the program not be reduced without changing the semantics of the program. The experiment results show that the algorithm can improve the whole performance and not reduce the scalability.