传统的多线程程序存在许多不确定性,导致编程困难,易出错.确定性并行编程模型是保证并行程序确定执行的有效途径之一.针对所提出的确定性消息传递多线程编程模型Det MP及它在确定性生产-消费虚拟内存模型SPMC上的实现,本文探索Det MP的可编程性和实现机制对性能的影响.包括:总结了用Det MP改写现有Pthreads多线程程序的方法,并在32核计算机上用7个MapReduce应用程序和1个流水线并行程序dedup对比改写前后的性能.实验表明用Det MP改写后的程序在多数情况下比原来的Pthreads程序有好的性能.为了分析这种性能差异是否因使用了SPMC虚拟内存模型而引起,本文进一步基于传统Pthreads共享内存来实现Det MP应用编程接口,并用所改写的应用程序集评测它们在Det MP的两种实现上运行的性能.实验表明,当CPU核数为16和32时,基于SPMC的Det MP实现在除Matrix Multiply和String Match外的6个程序上有更好的性能,最高甚至比基于Pthreads的实现快9.5倍;而在Matrix Multiply和String Match上或者核数低于16时,两种实现的性能相当.
Traditional multithreaded programs are intrinsic nondeterministic,which makes them tough to write and error-prone. Deter- ministic parallel programming model is an effective way to ensure parallel programs execute deterministically. We proposed DetMP, a deterministic message passing mulfithreaded programming model, and implemented it atop our proposed deterministic producer-con- sumer virtual memory model{ SPMC). In this paper, we study the programmability of DetMP and the impact on performance of its im- plementation mechanisms. We summarize a set of rules on how to rewrite a Pthreads program with DetMP, and use the rewritten DetMP version and the original Pthreads version of seven MapReduce programs as well as one pipelined parallel program { dedup ) to compare the performance difference on a 32-core machine. Evaluation results show that the rewritten programs always perform better than the original Pthreads ones. To further analyze whether the performance difference is caused by SPMC or not,the DetMP API is further implemented by using traditional shared-memory Pthreads library. Evaluation results show that all applications except for Matrix Multi- ply and String Match have better performance on DetMP implemented atop SPMC at 16 and 32 cores,obtaining up to 9. 5 times faster; and the performance of the two implementations is comparable for Matrix Multiply,String Match or other applications when the number of cores is lower than 16.