At present,parallel computer architecture goes mainstream along with the rapid development of computer technology.Multithread programming emerges as the times require in order to give full play to parallel computer architecture.But it costs programmer a lot of time and efforts during programming and debugging stage due to the run-time non-determinism of multithreaded program,which seriously impedes the development of multithread programming technology.Therefore,research on the concurrency bug detection as well as efficient and fast program replay is significant to the progress of multithread programming technology.In recent years,study on the non-determinacy of concurrent programs attracted numerous scholars in colleges,universities and research institutions both from home and abroad and it enjoys many achievements.Here are the main aspects in existing research work: Make the concurrent program executed deterministically through the design and implementation of parallel programming languages or extending existing programming languages;Reenact an earlier program execution in terms of result and execution sequence by adopting deterministic replay;Realize deterministic execution of concurrent program with the support of hardware by adding extra hardware to computer or improving existing computer architecture.The thesis presents a concurrent detection algorithm for atomicity violation based on thread communication invariants to detect atomicity violation,which is the major factor leading to indeterminacy in execution of multithreaded program.First,it extracts the initial traces of the program and removes redundancy with Pin,a binary instrumentation tool,and classifies the traces with Hash table,which is based on unordered map.Second,it marks the thread communication with the thread communication invariants got from stack and realize concurrency of the algorithm using multiprocess programming technology.Finally,efficiency and validity of the detection algorithm have already been compared and analyzed through experiments.This paper also implements deterministic replay system,besides bug detection,based on thread switch point to address the problem where it is difficult for multithreaded program to reenact its earlier execution in terms of execution sequence and result.The system can effectively avoid bugs in conjunction with the bug detection algorithm. |