Abstract:To overcome the difficulty of analyzing and detecting the data race in multithread programs, a method based on Hidden Markov model is presented for the analysis of time sequences in multithread programs. The random variable uncertainty is used to depict the mutual influence in different multithread in time sequences, and the probability distribution for random variable uncertainty is analyzed as the outcome of multithread programs on the condition of data race. Hidden Markov model is constructed to appreciate the state for the thread running according to the observed values of the running threads. The Baum-Welch and forwarding algorithm are used to simulate the real running process of the programs in the influence of context. It is proved by experiments that HMM model can quickly and effectively reflect the time sequence of the multithread programs, which can be used to instruct the detecting process of multithread programs.