# US 2013/0254775 A1 · Efficient lock hand-off in a symmetric multiprocessing system

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

- Number: US 2013/0254775 A1
- Document ID: US20130254775A1
- Status: Published application
- Kind: A1
- Application number: 13/426,293
- Filed: 2012-03-21
- Published: 2013-09-26
- Earliest claimed: 2012-03-21
- Assignees: International Business Machines Corporation
- Inventors: Dirk Michel; Bret R. Olszewski; Basu Vaidyanathan
- Web page: https://patentgrep.com/patent/US20130254775A1

## CPC

- G06F 9/52: Program synchronisation; Mutual exclusion, e.g. by means of semaphores
- G06F 9/526: {Mutual exclusion algorithms}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Provided are techniques for providing a first lock, corresponding to a resource, in a memory that is global to a plurality of processor; spinning, by a first thread running on a first processor of the processors, at a low hardware-thread priority on the first lock such that the first processor does not yield processor cycles to a hypervisor; spinning, by a second thread running on a second processor, on a second lock in a memory local to the second processor such that the second processor is configured to yield processor cycles to the hypervisor; acquiring the lock and the corresponding resource by the first thread; and, in response to the acquiring of the lock by the first thread, spinning, by the second thread, at the low hardware-thread priority on the first lock rather than the second lock such that the second processor does not yield processor cycles to the hypervisor.

## Claims

### Claim 1

A method, comprising:
acquiring, by a first thread running on a first processor of a plurality of processors in a multiprocessor system, a first lock corresponding to a resource, wherein the first lock is global with respect to the plurality of processors;
spinning, by a second thread running on a second processor of the plurality of processors, at a low hardware-thread priority on the first lock such that the second processor does not yield processor cycles to a hypervisor;
spinning, by a third thread running on a third processor of the plurality of processors, on a second lock in a memory local to the third processor such that the third processor is configured to yield processor cycles to the hypervisor;
acquiring the first lock and the corresponding resource by the second thread; and
in response to the acquiring of the first lock by the second thread, spinning, by the third thread, at the low hardware-thread priority on the first lock rather than the second lock such that the third processor does not yield processor cycles to the hypervisor.

### Claim 2 (depends on 1)

The method of claim 1, wherein the second lock is a per-cpu bit associated with the third processor.

### Claim 3 (depends on 1)

The method of claim 1, further comprising, in response to the acquiring of the first lock by the second thread, notifying the third processor of the acquiring.

### Claim 4 (depends on 1)

The method of claim 1, further comprising, in response to the acquiring of the first lock by the second thread, utilizing the resource by the second thread.

### Claim 5 (depends on 1)

The method of claim 1, further comprising:
spinning, by a fourth thread running on a fourth processor of the plurality of processors, on a third lock in a memory local to the forth processor such that the fourth processor is configured to yield processor cycles to the hypervisor; and
in response to the acquiring of the first lock by the second thread and a subsequent acquiring of the first lock by the third thread, spinning, by the fourth thread, at the low hardware-thread priority on the first lock rather than third lock such that the fourth processor does not yield processor cycles to the hypervisor.

### Claim 6 (depends on 5)

The method of claim 5, wherein the third lock is a per-cpu bit associated with the fourth processor.

### Claim 7 (depends on 5)

The method of claim 5, further comprising, in response to the acquiring of the first lock by the third thread, notifying the fourth processor of the acquiring.

### Claim 8

An apparatus, comprising:
a plurality of processors in a multiprocessor system;
a first lock accessible by each processor of the plurality of processors;
a computer-readable storage medium; and
logic, stored on the computer-readable storage medium, and executed on the plurality of processors, for:
acquiring, by a first thread running on a first processor of a plurality of processors, the first lock corresponding to a resource;
spinning, by a second thread running on a second processor of the plurality of processors, at a low hardware-thread priority on the first lock such that the second processor does not yield processor cycles to a hypervisor;
spinning, by a third thread running on a third processor of the plurality of processors, on a second lock in a memory local to the third processor such that the third processor is configured to yield processor cycles to the hypervisor;
acquiring the first lock and the corresponding resource by the second thread; and
in response to the acquiring of the first lock by the second thread, spinning, by the third thread, at the low hardware-thread priority on the first lock rather than the second lock such that the third processor does not yield processor cycles to the hypervisor.

### Claim 9 (depends on 8)

The apparatus of claim 8, wherein the second lock is a per-cpu bit associated with the third processor.

### Claim 10 (depends on 8)

The apparatus of claim 8, the logic further comprising logic for, in response to the acquiring of the first lock by the second thread, notifying the third processor of the acquiring.

### Claim 11 (depends on 8)

The apparatus of claim 8, the logic further comprising logic for, in response to the acquiring of the first lock by the second thread, utilizing the resource by the second thread.

### Claim 12 (depends on 8)

The apparatus of claim 8, the logic further comprising logic for:
spinning, by a fourth thread running on a fourth processor of the plurality of processors, on a third lock in a memory local to the forth processor such that the fourth processor is configured to yield processor cycles to the hypervisor; and
in response to the acquiring of the first lock by the second thread and a subsequent acquiring of the first lock by the third thread, spinning, by the fourth thread, at the low hardware-thread priority on the first lock rather than third lock such that the fourth processor does not yield processor cycles to the hypervisor.

### Claim 13 (depends on 12)

The apparatus of claim 12, wherein the third lock is a per-cpu bit associated with the fourth processor.

### Claim 14 (depends on 12)

The apparatus of claim 12, the logic further comprising logic for, in response to the acquiring of the first lock by the third thread, notifying the fourth processor of the acquiring.

### Claim 15

A computer programming product, comprising:
a computer-readable storage medium; and
logic, stored on the computer-readable storage medium, and executed on a plurality of processors of a multiprocessor system, for:
acquiring, by a first thread running on a first processor of a plurality of processors, a first lock corresponding to a resource, wherein the first lock is global with respect to the plurality of processors;
spinning, by a second thread running on a second processor of the plurality of processors, at a low hardware-thread priority on the first lock such that the second processor does not yield processor cycles to a hypervisor;
spinning, by a third thread running on a third processor of the plurality of processors, on a second lock in a memory local to the third processor such that the third processor is configured to yield processor cycles to the hypervisor;
acquiring the first lock and the corresponding resource by the second thread; and
in response to the acquiring of the first lock by the second thread, spinning, by the third thread, at the low hardware-thread priority on the first lock rather than the second lock such that the third processor does not yield processor cycles to the hypervisor.

### Claim 16 (depends on 15)

The computer programming product of claim 15, wherein the second lock is a per-cpu bit associated with the third processor.

### Claim 17 (depends on 15)

The computer programming product of claim 15, the logic further comprising logic for, in response to the acquiring of the first lock by the second thread, notifying the third processor of the acquiring.

### Claim 18 (depends on 15)

The computer programming product of claim 15, the logic further comprising logic for, in response to the acquiring of the first lock by the second thread, utilizing the resource by the second thread.

### Claim 19 (depends on 15)

The computer programming product of claim 15, the logic further comprising logic for:
spinning, by a fourth thread running on a fourth processor of the plurality of processors, on a third lock in a memory local to the forth processor such that the fourth processor is configured to yield processor cycles to the hypervisor; and
in response to the acquiring of the first lock by the second thread and a subsequent acquiring of the first lock by the third thread, spinning, by the fourth thread, at the low hardware-thread priority on the first lock rather than third lock such that the fourth processor does not yield processor cycles to the hypervisor.

### Claim 20 (depends on 19)

The computer programming product of claim 19, wherein the third lock is a per-cpu bit associated with the fourth processor.
