Transactions are ACID (atomic, consistent, isolated, durable) modules of execution. They complement COM's program module structure. The Microsoft Distributed Transaction Coordinator (MS DTC) provides a transaction manager for each computer that manages transactions at that computer. Applications call the transaction manager to begin a transaction. BeginTransaction returns a transaction object. The application includes the transaction object with requests to resource managers. When a resource manager first begins working on a transaction, it enlists in the transaction. When the application has made a consistent transformation of the state, it asks the transaction manager to commit the transaction with the Commit transaction method. If the application cannot complete the transaction, the application program aborts it by using the Abort transaction method. If the application fails or a participating resource manager fails, then MS DTC aborts the transaction.
MS DTC uses a two-phase commit algorithm in which (1) the transaction manager requests each enlisted resource manager to prepare to commit, and (2) if all successfully prepare, then the transaction manager broadcasts the commit decision. If any resource manager cannot prepare, the transaction manager broadcasts an abort decision to everyone involved in the transaction. While a resource manager is prepared, it is in doubt about whether the transaction committed or aborted. The transaction manager keeps a sequential log so that its commit or abort decisions will be durable. If a resource manager or transaction manager fails, they reconcile in-doubt transactions when they reconnect.
For distributed transactions, each computer has a local transaction manager. When a transaction works at multiple computers, the transaction managers track incoming and outgoing transactions. Each transaction manager performs all the enlistment, prepare, commit, and abort calls for local resource managers (those on that computer). When committing a transaction distributed among several computers, the transaction manager sends prepare, commit, and abort messages to all its outgoing transaction managers. When a transaction manager is in doubt about a distributed transaction, the transaction manager queries the incoming transaction manager. The root transaction manager is never in doubt. If an in-doubt transaction persists for too long, the system operator can force the transaction to commit or abort.