# US 2020/0401463 A1 · Self-managed lock access

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

- Number: US 2020/0401463 A1
- Document ID: US20200401463A1
- Status: Published application
- Kind: A1
- Application number: 16/449,629
- Filed: 2019-06-24
- Published: 2020-12-24
- Earliest claimed: 2019-06-24
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Simon Weishaupt; Bernd Nerz; Wolfgang Fischer
- Web page: https://patentgrep.com/patent/US20200401463A1

## CPC

- G06F 9/526: {Mutual exclusion algorithms}
- G06F 9/468: {Specific access rights for resources, e.g. using capability register}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

An approach for providing exclusive access to a resource shared by a plurality of processes in a computer system. The approach includes a computer processor retrieving a process identifier for a first process attempting to access the resource, where the process identifier is uniquely assigned to each process of the plurality of processes requiring the resource with the computer system. The approach includes the computer processor using the process identifier for the first process and a mutual exclusion object that includes a lock position allowing exclusive access to the resource and a wait position for a next process to attain the lock position to provide exclusive access to the resource.

## Claims

### Claim 1

A computer-implemented method for providing exclusive access to a resource shared by a plurality of processes in a computer system, the computer-implemented method comprising the steps of:
retrieving, by one or more computer processors, a process identifier for a first process attempting to access the resource, wherein the process identifier is uniquely assigned to each process of the plurality of processes requiring the resource in the computer system; and
using, by one or more computer processors, at least, the process identifier for the first process and a mutual exclusion object to provide exclusive access to the resource, wherein the mutual exclusion object includes a lock position allowing exclusive access to the resource and a wait position for a next process to attain the lock position.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein using, at least, the process identifier and the mutual exclusion object to provide exclusive access to the resource comprises:
determining, by one or more computer processors, whether the lock position in the mutual exclusion object is occupied by a process identifier of a second process, wherein the second process is executing the resource; and
responsive to determining that the lock position is occupied by the process identifier of the second process executing the resource, determining, by one or more computer processors, whether a process identifier for a third process is in the wait position in the mutual exclusion object.

### Claim 3 (depends on 2)

The computer-implemented method of claim 2, further comprising:
responsive to determining that the process identifier for the third process is not in the wait position in the mutual exclusion object, moving, by one or more processors, the process identifier of the first process into the wait position of the mutual exclusion object.

### Claim 4 (depends on 2)

The computer-implemented method of claim 2, further comprising:
responsive to determining that the process identifier for the third process is in the wait position in the mutual exclusion object, determining, by one or more computer processors, whether the process identifier for the third process in the wait position in the mutual exclusion object has a higher priority than the process identifier of the first process attempting to access the resource, wherein the determining includes using an algorithm.

### Claim 5 (depends on 4)

The computer-implemented method of claim 4, wherein using the algorithm to determine whether the process identifier for the third process in the wait position in the mutual exclusion object has a higher priority than the process identifier of the first process attempting to access the resource includes utilizing the process identifier for the first process attempting to access the resource, the process identifier for the second process in the lock position of the mutual exclusion object executing the resource, and the process identifier for the third process in the wait position of the mutual exclusion object.

### Claim 6 (depends on 4)

The computer-implemented method of claim 4, wherein responsive to determining the process identifier of the third process in the wait position in the mutual exclusion object does not have the higher priority than the process identifier of the first process attempting to access the resource; and
replacing, by one or more processors, the process identifier of the third process in the wait position of the mutual exclusion object with the process identifier of the first process attempting to access the resource.

### Claim 7 (depends on 4)

The computer-implemented method of claim 4, further comprises:
acquiring, by one or more computer processors, the lock position in the mutual exclusion object when the second process completes execution of the resource and moves the process identifier of the first process into the lock position of the mutual exclusion object;
executing, by one or more computer processors, the resource by the first process in the lock position of the mutual exclusion object;
completing, by one or more computer processors, execution of the resource by the first process in the lock position of the mutual exclusion object; and
releasing, by one or more computer processors, the lock position of the mutual exclusion object; and
moving, by one or more computer processors, the process identifier of the third process in the wait position of the mutual exclusion object into the lock position of the mutual exclusion object, wherein the releasing the lock position and the moving the process identifier of the third process into the lock position of the mutual exclusion object occurs atomically.

### Claim 8 (depends on 4)

The computer-implemented method of claim 4, wherein using the algorithm comprises:
utilizing, by one or more computer processors, an unsigned integer for of each resultant of two subtractions to determine whether the process identifier for the third process in the wait position in the mutual exclusion object has a higher priority than the process identifier of the first process attempting to access the resource, and wherein the two subtractions include a first subtraction of a sequence identifier of the process identifier of the second process executing the resource from a sequence identifier of the process identifier of the first process attempting to access the resource and a second subtraction of a sequence identifier of the process identifier of the second process in the lock position from a sequence identifier of the process identifier of the third process in the wait position in the mutual exclusion object; and
determining, by one or more computer processors, whether the unsigned integer of the resultant of the first subtraction is less than the unsigned integer of the resultant of the second subtraction in order to determine that the process identifier of the first process attempting to access the resource has the higher priority than the process identifier of the third process in the wait position.

### Claim 9 (depends on 6)

The computer-implemented method of claim 6, further comprises:
releasing, by one or more computer processors, the wait position of the mutual exclusion object when by the first process leaves to execute another function;
determining, by one or more computer processors, that the process identifier of the first process still has the higher priority than the third process in the wait position of the mutual exclusion object, wherein the second process is still executing the resource after the first process returns to re-attempt to access the resource; and
replacing, by one or more processors, the process identifier of the third process in the wait position of the mutual exclusion object with the process identifier of the first process re-attempting to access the resource.

### Claim 10

A computer program product for providing exclusive access to a resource shared by a plurality of processes in a computer system, the computer program product comprising:
one or more computer readable storage media; and
program instructions stored on the one or more computer readable storage media, the program instructions comprising:
program instructions to retrieve a process identifier for a first process attempting to access the resource, wherein the process identifier is uniquely assigned to each process of the plurality of processes requiring access to the resource in the computer system; and
program instructions to use, at least, the process identifier and a mutual exclusion object to provide exclusive access to the resource, wherein the mutual exclusion object includes a lock position providing exclusive access to the resource and a wait position for a next process to attain the lock position.

### Claim 11 (depends on 10)

The computer program product of claim 10, wherein to use, at least, the process identifier and a mutual exclusion object to provide exclusive access to the resource comprises:
program instructions to determine whether the lock position in the mutual exclusion object is occupied by a process identifier of a second process, wherein the second process is executing the resource; and
responsive to determining that the lock position is occupied by the process identifier of the second process; program instructions to determine whether a process identifier for a third process is stored in the wait position in the mutual exclusion object.

### Claim 12 (depends on 11)

The computer program product of claim 11, further comprising:
responsive to determining that the process identifier for the third process is not in the wait position in the mutual exclusion object, program instructions to move the process identifier of the first process into the wait position of the mutual exclusion object.

### Claim 13 (depends on 11)

The computer program product of claim 11, further comprising:
responsive to determining that the process identifier for the third process is in the wait position in the mutual exclusion object, determining, by one or more computer processors, whether the process identifier of the third process in the wait position in the mutual exclusion object has a higher priority than the process identifier of the first process attempting to access the resource, wherein the determining using an algorithm.

### Claim 14 (depends on 13)

The computer program product of claim 13, wherein using the algorithm to determine whether the process identifier for the third process in the wait position in the mutual exclusion object has a higher priority than the process identifier of the first process attempting to access the resource includes utilizing the process identifier for the first process attempting to access the resource, the process identifier for the second process in the lock position of the mutual exclusion object, and the process identifier for the third process in the wait position to determine whether the process identifier for the first process attempting to access the resource has the higher priority than the process identifier of the third process in the wait position in the mutual exclusion object.

### Claim 15 (depends on 13)

The computer program product of claim 13, wherein responsive to determining the process identifier of the third process in the wait position in the mutual exclusion object does not have the higher priority than the process identifier of the first process attempting to access the resource; and
replacing, by one or more processors, the process identifier of the third process in the wait position of the mutual exclusion object with the process identifier of the first process attempting to access the resource.

### Claim 16

A computer system for providing exclusive access to a resource shared by a plurality of processes in a computer system, the computer system comprising:
one or more computer processors;
one or more computer readable storage media; and
program instructions, stored on the one or more computer readable storage media for execution by at least one of the one or more computer processors, the program instructions comprising:
program instructions to retrieve a process identifier for a first process attempting to access the resource, wherein the process identifier is uniquely assigned to each process of the plurality of processes in the computer system; and
program instructions to use, at least, the process identifier for the first process and a mutual exclusion object to provide exclusive access to the resource, wherein the mutual exclusion object includes a lock position providing exclusive access to the resource and a wait position for a next process to attain the lock position.

### Claim 17 (depends on 16)

The computer system of claim 16, wherein to use, at least, the process identifier for the first process and a mutual exclusion object to provide exclusive access to the resource comprises:
program instructions to determine whether the lock position in the mutual exclusion object is occupied by a process identifier of a second process, wherein the second process is executing the resource;
responsive to determining that the lock position is occupied by the process identifier of the second process; program instructions to determine whether a process identifier for a third process is stored in the wait position in the mutual exclusion object; and
responsive to determining that the process identifier of the third process is not stored in the wait position in the mutual exclusion object, program instructions to move the process identifier of the first process into the wait position of the mutual exclusion object.

### Claim 18 (depends on 17)

The computer system of claim 17, further comprising:
program instructions to determine whether a process identifier of a fourth process attempting to access the resource has a higher priority than the process identifier of the first process stored in the wait position includes using an algorithm to determine that the process identifier of the fourth process attempting to access the resource has a higher priority than the process identifier of the first process; and
program instructions to replace the process identifier of the first process in the wait position with the process identifier of the fourth process attempting to access the resource.

### Claim 19 (depends on 17)

The computer system of claim 17, further comprising:
program instructions to determine that the process identifier of the first process in the wait position in the mutual exclusion object temporarily stops attempting to access the resource when the process identifier of the first process leaves the wait position of the mutual exclusion object;
program instructions to determine that the first process is again requesting access to the resource;
program instructions to determine whether the wait position is occupied by a process identifier of a fifth process;
responsive to determining that the wait position is occupied by the process identifier of the fifth process, program instructions to determine whether the process identifier of the first process has the higher priority than a process identifier of a fifth process in the wait position of the mutual exclusion object; and
responsive to determining that the process identifier of the first process has the higher priority than a process identifier of a fifth process in the wait position of the mutual exclusion object, program instructions to replace the process identifier of the fifth process in the wait position of the mutual exclusion object with the process identifier of the first process again requesting access to the resource.

### Claim 20 (depends on 18)

The computer system of claim 18, wherein the algorithm comprises:
program instructions to utilize an unsigned integer for of each resultant of two subtractions to determine whether the process identifier for the third process in the wait position in the mutual exclusion object has a higher priority than the process identifier of the first process attempting to access the resource, and wherein the two subtractions include a first subtraction of a sequence identifier of the process identifier of the second process executing the resource from a sequence identifier of the process identifier of the first process attempting to access the resource and a second subtraction of a sequence identifier of the process identifier of the second process in the lock position from a sequence identifier of the process identifier of the third process in the wait position in the mutual exclusion object; and
program instructions to determine whether the unsigned integer of the resultant of the first subtraction is less than the unsigned integer of the resultant of the second subtraction in order to determine that the process identifier of the first process attempting to access the resource has the higher priority than the process identifier of the third process in the wait position.
