US007991967B2 (12) Ulllted States Patent (10) Patent No.: US 7,991,967 B2 Detlefs et al. (45) Date of Patent: Aug. 2, 2011 (54) USING TYPE STABILITY TO FACILITATE 5/1[=11_1eYTY Ti aloir et a . CONTENTION MANAGEMENT 2004/0103123 Al gt, 5/2004 Bradshaw ttttttttttttttttttt H 707/202 2004/0215880 A1 10/2004 Chilimbi et al. (75) Tnventorsi Davld Detlefs, Westford, MA (US); 2006/0085489 A1 4/2006 Tomic et £11. Michael M. Magruder, Samrnamish, 2006/0112248 A1 5/2006 Meiri et al. . 2006/0190504 A1 8/2006 Pruet xi mg)’ John Joseph Duffy’ Remon’ 2006/0218206 A1 9/2006 Bourbormais et al. (U ) 2006/0218561 A1* 9/2006 Moir et al. .................. .. 719/316 2007/0198781 A1* 8/2007 Dice et al. 711/145 (73) Assignee: Microsoft Corporation, Redmond, WA 2007/0239943 A1* 10/2007 Dice et al. ................... .. 711/147 (US) OTHER PUBLICATIONS ( * ) Notice: Subject t0 any disclaimer, the term Ofthis Costich Oliver, “Transaction Processing Using an Untrusted patent is extended er adjusted under 3 5 Scheduler in a Multilevel Database with Replicated Architecture”, U.S.C. l54(b) by 661 days. pp. 1-17. Dekeyser, et al., “Conflict Scheduling of Transactions on XML (21) App1_ NO_; 11/824,353 Documents”, Date: 2004, vol. 27, http://portal.acm.org/citation. cfm?id:1012305. (22) Filed; Jun_ 29, 2007 Yeo, et al., “Linear Orderability of Transactions in Mobile Environment with Heterogeneous Databases”, pp. 1-30. (65) Prior Publication Data (Continued) US 2009/0006405 A1 Jan. 1,2009 P _ E _ Y _ C rimary xaminer i aima ampos (51) Int. Cl. G06F 12/00 (2006.01) (57) ABSTRACT G06F 13/00 (2006-01) Various technologies and techniques are disclosed for providG06F 13/28 (2006-01) ing type stability techniques to enhance contention manageG06F 7/00 (2006-01) ment. A reference counting mechanism is provided that G06F 17/30 (200601) enables transactions to safely examine states of other trans(52) U.S. Cl. ...... .. 711/150; 711/151; 711/152; 711/153; actions. Contention management is facilitated using the ref711/170; 711/171; 711/172; 711/173; 707/756; erence counting mechanism. When a conflict is detected 707/791 between two transactions, owmng transaction information is (58) Field of Classification Search ...................... .. None obtained. A reference count of the owning transaction is See appljcatjgn file fer Qgmplete Search hj5tQ1'y_ incremented. The system ensures that the correct transaction was incremented. If the owning transaction is still a conflict(56) References Cited ing transaction, then a contention management decision is made to determine proper resolution. When the decision is U-S PATENT DOCUMENTS made, the reference count on the owmng transaction is dec5,241,675 A 3/1993 gheth er 31, remented by the conflicting transaction. When each transac5,335,343 A 3/1994 I-=1mP$011 et fl1~ tion completes, the reference counts it holds to itself is dec5,701,480 A 12/1997 Ra? remented. Data structures carmot be deallocated until their 6,513,100 Bl * 1/2003 Cllft ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~- 711/154 referenee eeunt is Zere Dedieated t e_Stab1e atteeatien 6,754,737 B2 6/2004 Heynemann et £11. 5 YT’ _ 6,785,779 B2 3/2004 Berg et at pools can be reduced using an unstable attribute. 7,089,253 B2 8/2006 Hinshaw et al. 7,236,974 B2 6/2007 Bhattacharjee et al. 15 Claims, 10 Drawing Sheets sen \ """"""" "iEXii'§}§é¥i5ifi “““““““ " iiiiiiiiii ?;§ii§;;e¥ieii"£ ““““““““ * E2 1 E I