# US 2006/0070076 A1 · Detecting lock acquisition hierarchy violations in multithreaded programs

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

- Number: US 2006/0070076 A1
- Document ID: US20060070076A1
- Status: Published application
- Kind: A1
- Application number: 10/955,605
- Filed: 2004-09-29
- Published: 2006-03-30
- Earliest claimed: 2004-09-29
- Assignees: Intel Corporation
- Inventors: Zhiqiang Ma
- Web page: https://patentgrep.com/patent/US20060070076A1

## CPC

- G06F 9/524: {Deadlock detection or avoidance}
- G06F 11/366: {using diagnostics (G06F11/0703 takes precedence)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method, apparatus, and system are provided for monitoring resource operations and detecting lock acquisition hierarchy violations in multithreaded programs. In one embodiment, a lock acquisition hierarchy graph is constructed to facilitate monitoring of resource operations performed by each of a plurality of threads of a multithreaded program. The resource operations performed by each thread are monitored by a monitor. Any violation in the hierarchy is detected by a detector, which is triggered with an occurrence of a change in the graph.

## Claims

### Claim 1

A method, comprising:
constructing a lock acquisition hierarchy graph to facilitate monitoring of resource operations corresponding to each of a plurality of threads of a multithreaded program;
monitoring the resource operations being performed in accordance with a hierarchy; and
detecting a violation in the hierarchy, wherein the detecting of the violation is triggered with an occurrence of a change in the graph.

### Claim 2 (depends on 1)

The method of claim 1, further comprising reporting the violation to a user.

### Claim 3 (depends on 1)

The method of claim 1, wherein the resource operations comprise one or more of the following: resource acquisition operations and resource release operations.

### Claim 4 (depends on 1)

The method of claim 1, further comprising maintaining a thread descriptor corresponding to each of the plurality of threads.

### Claim 5 (depends on 1)

The method of claim 1, wherein the graph comprises one or more lock acquisition nodes, each node representing one or more resources acquired by each thread of the plurality of threads.

### Claim 6 (depends on 1)

The method of claim 1, wherein the change in the graph comprises creating a new node in the graph, and adding the new node to the graph, the new node having a parent node.

### Claim 7 (depends on 1)

The method of claim 1, wherein the detecting of the violation comprises seeking one or more cycles satisfying a set of conditions in the graph, the set of conditions includes a plurality of conditions relating to activities of the nodes and the new node in the graph, wherein the violation is detected if the set of conditions is satisfied, and the violation is not detected if one or more of the set of conditions is not satisfied.

### Claim 8

A system, comprising:
a monitor to
construct a lock acquisition hierarchy graph to facilitate monitoring of resource operations corresponding to each of a plurality of threads of a multithreaded program, and
monitor the resource operations being performed in accordance with a hierarchy; and
a detector to detect a violation in the hierarchy, wherein the detecting of the violation is triggered with an occurrence of a change in the graph.

### Claim 9 (depends on 8)

The system of claim 8, wherein the detector is further to report the violation to a user.

### Claim 10 (depends on 8)

The system of claim 8, wherein the resource operations comprise one or more of the following: resource acquisition operations and resource release operations.

### Claim 11 (depends on 8)

The system of claim 8, wherein the monitor is further to maintain a thread descriptor corresponding to each of the plurality of threads.

### Claim 12 (depends on 8)

The system of claim 8, wherein the graph comprises one or more lock acquisition nodes, each node representing one or more resources acquired by each thread of the plurality of threads.

### Claim 13 (depends on 8)

The system of claim 8, wherein the change in the graph comprises creating a new node in the graph, and adding the new node to the graph, the new node having a parent node.

### Claim 14 (depends on 8)

The system of claim 8, wherein the detecting of the violation comprises seeking one or more cycles satisfying a set of conditions in the graph, the set of conditions includes a plurality of conditions relating to activities of the nodes and the new node in the graph, wherein the violation is detected if the set of conditions is satisfied, and the violation is not detected if one or more of the set of conditions is not satisfied.

### Claim 15

An apparatus, comprising
a processor; and
a storage medium coupled with the processor, the storage device having stored thereon data representing sets of instructions, the sets of instructions which, when executed by the processor, cause the processor to:
construct a lock acquisition hierarchy graph to facilitate monitoring of resource operations corresponding to each of a plurality of threads of a multithreaded program,
monitor the resource operations being performed in accordance with a hierarchy, and
detect a violation in the hierarchy, wherein the detecting of the violation is triggered with an occurrence of a change in the graph.

### Claim 16 (depends on 15)

The apparatus of claim 15, wherein the processor is further to report the violation to a user.

### Claim 17 (depends on 15)

The apparatus of claim 15, wherein the resource operations comprise one or more of the following: resource acquisition operations and resource release operations.

### Claim 18 (depends on 15)

The apparatus of claim 15, the processor is further to maintain a thread descriptor corresponding to each of the plurality of threads.

### Claim 19 (depends on 15)

The apparatus of claim 15, wherein the graph comprises one or more lock acquisition nodes, each node representing one or more resources acquired by each thread of the plurality of threads.

### Claim 20 (depends on 15)

The apparatus of claim 15, wherein the change in the graph comprises creating a new node in the graph, and adding the new node to the graph, the new node having a parent node.

### Claim 21 (depends on 15)

The apparatus of claim 15, wherein the detecting of the violation comprises seeking one or more cycles satisfying a set of conditions in the graph, the set of conditions includes a plurality of conditions relating to activities of the nodes and the new node in the graph, wherein the violation is detected if the set of conditions is satisfied, and the violation is not detected if one or more of the set of conditions is not satisfied.

### Claim 22

A machine-readable medium having stored thereon data representing sets of instructions which, when executed by a machine, cause the machine to:
construct a lock acquisition hierarchy graph to facilitate monitoring of resource operations corresponding to each of a plurality of threads of a multithreaded program;
monitor the resource operations being performed in accordance with a hierarchy; and
detect a violation in the hierarchy, wherein the detecting of the violation is triggered with an occurrence of a change in the graph.

### Claim 23 (depends on 22)

The machine-readable medium of claim 22, wherein the sets of instructions which, when executed by the machine, further cause the machine to report the violation to a user.

### Claim 24 (depends on 22)

The machine-readable medium of claim 22, wherein the resource operations comprise one or more of the following: resource acquisition operations and resource release operations.

### Claim 25 (depends on 22)

The machine-readable medium of claim 22, wherein the sets of instructions which, when executed by the machine, further cause the machine to maintain a thread descriptor corresponding to each of the plurality of threads.

### Claim 26 (depends on 22)

The machine-readable medium of claim 22, wherein the graph comprises one or more lock acquisition nodes, each node representing one or more resources acquired by each thread of the plurality of threads.

### Claim 27 (depends on 22)

The machine-readable medium of claim 22, wherein the change in the graph comprises creating a new node in the graph, and adding the new node to the graph, the new node having a parent node.

### Claim 28 (depends on 22)

The machine-readable medium of claim 22, wherein the detecting of the violation comprises seeking one or more cycles satisfying a set of conditions in the graph, the set of conditions includes a plurality of conditions relating to activities of the nodes and the new node in the graph, wherein the violation is detected if the set of conditions is satisfied, and the violation is not detected if one or more of the set of conditions is not satisfied.
