A deadlock detection algorithm utilizing a transaction-wait-for (TWF) graph is presented. It is a fully distributed algorithm which allows multiple outstanding requests. The proposed algorithm can achieve improved overall performance, using multiple disjoint controllers coupled with the two phase property, while maintaining the simplicity of centralized schemes. The detection step is divided into two phases. Phase 1 analyzes the conditions of the system of interacting transactions, invoking phase 2 only if conditions are possible for deadlocks to occur. The proposed algorithm can be used in distributed database systems as well as in transaction-processing systems.