Abstract:To improve the correctness of data race detection, an approach to detect the data races based on the context-sensitive analysis in multithreaded programs was proposed. Firstly, control flow analysis was used to construct context-sensitive call graphs, and then escape analysis was employed to find thread-escaped objects. Secondly, context-sensitive alias analysis was conducted to reduce false positives and false negatives. Finally, the happens-before analysis was performed to remove false positives caused by ignoring thread interactions. A data race detection tool ConRacer was implemented by the WALA framework based on this approach and compared it to existing tools SRD and RVPredict. The experimental results show that ConRacer is the most precise tool compared with SRD and RVPredict and it can not only detect data races but also reduce false positives and false negatives effectively. ConRacer improves detection accuracy by combining context-sensitive with static detection methods, which helps find concurrent errors and optimize software performance.