# US 8,578,105 B2 · Using type stability to facilitate contention management

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 8,578,105 B2
- Document ID: US8578105B2
- Status: Granted
- Kind: B2
- Application number: 13/196,569
- Filed: 2011-08-02
- Published: 2011-11-24
- Granted: 2013-11-05
- Earliest claimed: 2007-06-29
- Assignees: Microsoft Corporation
- Applicants: David Detlefs; Michael M. Magruder; John Joseph Duffy
- Inventors: David Detlefs; Michael M. Magruder; John Joseph Duffy
- Web page: https://patentgrep.com/patent/US8578105B2

## CPC

- G06F 9/467: {Transactional memory (G06F9/528 takes precedence)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Various technologies and techniques are disclosed for providing type stability techniques to enhance contention management. A reference counting mechanism is provided that enables transactions to safely examine states of other transactions. Contention management is facilitated using the reference counting mechanism. When a conflict is detected between two transactions, owning transaction information is obtained. A reference count of the owning transaction is incremented. The system ensures that the correct transaction was incremented. If the owning transaction is still a conflicting transaction, then a contention management decision is made to determine proper resolution. When the decision is made, the reference count on the owning transaction is decremented by the conflicting transaction. When each transaction completes, the reference counts it holds to itself is decremented. Data structures cannot be deallocated until their reference count is zero. Dedicated type-stable allocation pools can be reduced using an unstable attribute.

## Claims

### Claim 1

A method for reducing dedicated type-stable allocation pools using an unstable attribute, the method comprising:
providing a transactional memory mechanism enabling one of a plurality of transactions to safely examine a transaction data structure of another of the transactions in a way that does not allow the transaction data structure being examined to be deallocated while the examination is in process, if deallocated the transaction data structure is returned to a type-stable allocation pool of memory from which objects are allocated in such a way that once a block of memory is allocated to represent an object of a given type, that memory block is not re-used to represent some other type;
setting a thread unstable attribute for the transaction data structure before acquiring a pointer to the transaction data structure;
clearing the thread unstable attribute when the pointer to the transaction data structure is no longer needed; and
during a garbage collection pause, deleting objects in a type-stable allocation pool of memory if the thread unstable attribute is not set on any of the threads.

### Claim 2 (depends on 1)

The method of claim 1, wherein a reference counting mechanism maintains a respective reference count on the transaction data structure to track a number of transactions having an interest at a given moment.

### Claim 3 (depends on 2)

The method of claim 2, wherein the reference counting mechanism ensures that the transaction data structure cannot be deallocated until the respective reference count goes to zero.

### Claim 4

A computer-readable storage medium that is a memory device storing computer-executable instructions for controlling a computer system to perform a method comprising:
providing a transactional memory mechanism enabling one of a plurality of transactions to safely examine a transaction data structure of another of the transactions in a way that does not allow the transaction data structure being examined to be deallocated while the examination is in process, if deallocated the transaction data structure is returned to a type-stable allocation pool of memory from which objects are allocated in such a way that once a block of memory is allocated to represent an object of a given type, that memory block is not re-used to represent some other type;
setting a thread unstable attribute for the transaction data structure before acquiring a pointer to the transaction data structure;
clearing the thread unstable attribute when the pointer to the transaction data structure is no longer needed; and
during a garbage collection pause, deleting objects in a type-stable allocation pool of memory if the thread unstable attribute is not set on any of the threads.
