Research Article

Deco: A Decentralized, Cooperative Atomic Commit Protocol

Algorithm 2

Behavior of a participant.
Token handling by , .
starts the transaction.
/* Transaction is finished All OR_F in dblist and OD_F are turned on. */
Void run() {
 On recovery do {
  Restore the TDS of unfinished transactions from stable storage;
  For each TDS, Start Proceed_Trans_Thread(TDS);
 } /*recovery end*/
 While (True) {
  Block to accept a token;
  Put token into queue of related TDS;
  Signal or start related Proceed_Trans_Thread(TDS)
 } /*while (true) end */
}
Void Proceed_Trans_Thread(TDS) {
 Retrieve queue and from TDS;
 While (Transaction not finished) {
  While queue is empty {
   Setup a rec_timer, sleep until receive a signal or timer expires;
   If awake due to rec_timer expiration, then Call forward ( );
  }
  While queue is not empty {
   get from queue and Merge to ;
  }
 Call forward ( );
 According the rules of the protocol described in Section 3.1
     evaluate decision and start to process related job;
 }//while
}