Abstract:DTD (distributed termination detection) is an important problem in the field of distributed algorithm research. If the termination of a computation can not be detected, the algorithm will lose its realistic significance. The credit-recovery algorithm proposed by Mattern is message optimal, but it is limited to centralized computation. In this paper, this algorithm is improved to be available in decentralized computation, which makes it more applicable to distributed environment.