The invention relates to a reachable graph deadlock detection and solution method based on a petri network, which comprises the following steps of: 1, constructing a petri net corresponding to a codeto be detected, and constructing a reachable tree of the petri net; 2, constructing a reachable graph according to the constructed reachable tree; 3, judging whether leaf nodes exist in the reachablegraph, if yes, judging that the to-be-detected code has deadlock, turning to the next step, and if not, judging that the to-be-detected code does not have deadlock; 4, constructing a fault tree corresponding to the petri network, and obtaining a minimum cut set through fault diagnosis; and 5, judging according to the minimum cut set and the reachability graph to obtain a fault position, and improving the petri network and the to-be-detected code according to the fault position. According to the method, the activity of the system is judged through the reachability graph of the Petri net, the problem points causing inactivity of the Petri net are determined by combining the reachability graph and fault diagnosis positioning, and the deadlock problem can be effectively solved through improvement of directed arcs of the problem points.