Atomicity violation is one of common concurrency bugs in multi-threaded software development. Traditional static analysis means has the possibility of false alarm,and the dynamic means has the problem of low running efficiency due to too little information to be used. In light of the above problems,we design a new algorithm,it is based on dynamic method,and discriminates by calculating the lock information and according to this information whether or not the atomicity violations would possibly occur, and reduce the backtracking numbers and running times of the program based on it. Through the tests on a series of open source programs,the experimental data proves that this method can greatly improve the efficiency of atomicity violation detection.