One of the most important applications of distributed systems is enabling resource sharing between systems. In such environments, if a sequence of procedures to control resource allocation is not possible to create a deadlock exists. Deadlock problem for a distributed database system that uses locking as a concurrency control algorithm, as there are inherent. The following new rule for the modeling of the proposed method using colored Petri nets is presented. In the model proposed the new rules for mapping TWFG with colored Petri nets for modeling the deadlocks detection and resolve. Colored Petri net is considered one of the most widely used formal methods capable of modeling a wide variety of distributed systems are concurrent. A lot of work being done to define the concurrency execution of transactions in Petri nets is that none of these methods of communication with how mapping TWFG with colored Petri nets for modeling the deadlocks detection and resolve.