# US 2024/0004695 A1 · Method and Apparatus for Processing Interrupt Request

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

- Number: US 2024/0004695 A1
- Document ID: US20240004695A1
- Status: Published application
- Kind: A1
- Application number: 18/469,069
- Filed: 2023-09-18
- Published: 2024-01-04
- Earliest claimed: 2021-03-17
- Assignees: Huawei Technologies Co., Ltd.
- Applicants: Huawei Technologies Co., Ltd.
- Inventors: Fangming Chai; Wenjing Wang; Kun Huang
- Web page: https://patentgrep.com/patent/US20240004695A1

## CPC

- G06F 9/4812: {by interrupt, e.g. masked}
- G06F 9/4881: {Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues}
- G06F 9/526: {Mutual exclusion algorithms}
- G06F 2209/485: Resource constraint
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for processing an interrupt request includes: receiving a first interrupt request, where operations that the first interrupt request requests to execute include a first operation, execution of the first operation needs to occupy a critical resource, and the critical resource cannot be simultaneously occupied by a plurality of operations; determining, based on at least the received first interrupt request, that the first operation is an operation that does not need to be executed immediately; and storing the first operation into a temporary storage area.

## Claims

### Claim 1

A method comprising:
receiving a first interrupt request requesting to execute a first operation, wherein requesting to execute the first operation comprises requesting to occupy a critical resource that cannot be simultaneously occupied by a plurality of second operations, and wherein the second operations comprise the first operation;
determining, based on the first interrupt request, that the first operation is not to be executed immediately; and
storing, in response to determining that the first operation is not to be executed immediately, the first operation into a temporary storage area storing an operation that occupies the critical resource and that a received interrupt request requests to execute.

### Claim 2 (depends on 1)

The method of claim 1, wherein before receiving the first interrupt request, the method further comprises:
executing a third operation by occupying the critical resource;
determining, based on a mutual exclusion flag that is set in an operating system, that the first operation cannot be executed immediately, wherein the mutual exclusion flag indicates that the critical resource is occupied; and
further storing, in response to determining that the first operation cannot be executed immediately, the first operation into the temporary storage area.

### Claim 3 (depends on 2)

The method of claim 2, wherein before executing the third operation, the method further comprises:
determining that the mutual exclusion flag is not set in the operating system; and
in response to determining that the mutual exclusion flag is not set in the operating system:
disabling task preemption; and
setting the mutual exclusion flag.

### Claim 4 (depends on 3)

The method of claim 3, wherein after executing the third operation, the method further comprises:
reading and executing at least one fourth operation temporarily stored in the temporary storage area, wherein the at least one fourth operation comprises the first operation; and
when the temporary storage area does not comprise a remaining operation:
clearing the mutual exclusion flag; and
enabling the task preemption.

### Claim 5 (depends on 4)

The method of claim 4, further comprising:
disabling reception of a second interrupt request;
determining that the temporary storage area temporarily stores the at least one fourth operation;
reading a fifth operation from the temporary storage area;
enabling reception of the second interrupt request; and
executing the fifth operation, wherein the fifth operation is one of the at least one fourth operation.

### Claim 6 (depends on 1)

The method of claim 1, further comprising determining, based on a context corresponding to the first interrupt request being a first interrupt context, to store the first operation into the temporary storage area.

### Claim 7 (depends on 6)

The method of claim 6, wherein the first interrupt request is further for requesting to execute a third operation different from the first operation, and wherein the method further comprises:
executing the third operation;
when executing the third operation has ended:
determining to return a second interrupt context corresponding to a second interrupt request; or
determining to return a task context, wherein a second priority of the second interrupt request is lower than a first priority of the first interrupt request; and
when determining to return the task context and the task context indicates that the third operation does not occupy the critical resource:
setting a mutual exclusion flag;
reading and executing at least one operation temporarily stored in the temporary storage area, wherein the at least one operation comprises the first operation; and
clearing the mutual exclusion flag when the temporary storage area does not comprise a remaining operation.

### Claim 8 (depends on 7)

The method of claim 7, wherein before setting the mutual exclusion flag, the method further comprises obtaining a spin lock, and wherein the spin lock prevents a plurality of processors from performing parallel processing.

### Claim 9 (depends on 1)

The method of claim 1, further comprising:
receiving a task request requesting to execute a third operation, wherein requesting to execute the third operation comprises requesting to occupy the critical resource;
determining, based on a context corresponding to the task request being a task context, to disable task preemption and set a mutual exclusion flag in an operating system, wherein the mutual exclusion flag indicates that the critical resource is occupied; and
executing the third operation,
wherein after executing the third operation has ended, the method further comprises:
reading and executing at least one operation temporarily stored in the temporary storage area; and
clearing the mutual exclusion flag when the temporary storage area does not comprise a remaining operation.

### Claim 10 (depends on 1)

The method of claim 1, wherein before storing the first operation into the temporary storage area, the method further comprises:
disabling reception of a second interrupt request; and
determining that the temporary storage area is not full,
wherein after storing the first operation into the temporary storage area, the method further comprises enabling reception of the second interrupt request.

### Claim 11

An apparatus comprising:
a memory configured to store instructions; and
one or more processors coupled to the memory and configured to execute the instructions to cause the apparatus to:
receive a first interrupt request requesting to execute a first operation, wherein requesting to execute the first operation comprises requesting to occupy a critical resource that cannot be simultaneously occupied by a plurality of second operations, and wherein the second operations comprise the first operation;
determine, based on the first interrupt request, that the first operation is not to be executed immediately; and
store, in response to determining that the first operation is not to be executed immediately, the first operation into a temporary storage area storing an operation that occupies the critical resource and that a received interrupt request requests to execute.

### Claim 12 (depends on 11)

The apparatus of claim 11, wherein the one or more processors are further configured to execute the instructions to cause the apparatus to:
execute a third operation by occupying the critical resource;
determine, based on a mutual exclusion flag that is set in an operating system, that the first operation cannot be executed immediately, wherein the mutual exclusion flag indicates that the critical resource is occupied; and
further store, in response to determining that the first operation cannot be executed immediately, the first operation into the temporary storage area.

### Claim 13 (depends on 12)

The apparatus of claim 12, wherein the one or more processors are further configured to execute the instructions to cause the apparatus to:
determine that the mutual exclusion flag is not set in the operating system; and
in response to determining that the mutual exclusion flag is not set in the operating system:
disable task preemption; and
set the mutual exclusion flag.

### Claim 14 (depends on 13)

The apparatus of claim 13, wherein the one or more processors are further configured to execute the instructions to cause the apparatus to:
read and execute at least one fourth operation temporarily stored in the temporary storage area, wherein the at least one fourth operation comprises the first operation; and
when the temporary storage area does not comprise a remaining operation:
clear the mutual exclusion flag; and
enable the task preemption.

### Claim 15 (depends on 11)

The apparatus of claim 11, wherein the one or more processors are further configured to execute the instructions to cause the apparatus to determine, based on a context corresponding to the first interrupt request being a first interrupt context, to store the first operation into the temporary storage area.

### Claim 16 (depends on 15)

The apparatus of claim 15, wherein the first interrupt request is further for requesting to execute a third operation different from the first operation, and wherein the one or more processors are further configured to execute the instructions to cause the apparatus to:
execute the third operation;
when executing the third operation has ended:
determine to return a second interrupt context corresponding to a second interrupt request; or
determine to return a task context, wherein a second priority of the second interrupt request is lower than a first priority of the first interrupt request; and
when determining to return the task context and the task context indicates that the third operation does not occupy the critical resource:
set a mutual exclusion flag;
read and execute at least one operation temporarily stored in the temporary storage area, wherein the at least one operation comprises the first operation; and
clear the mutual exclusion flag when the temporary storage area does not comprise a remaining operation.

### Claim 17 (depends on 16)

The apparatus of claim 16, wherein the one or more processors are further configured to execute the instructions to cause the apparatus to obtain a spin lock, and wherein the spin lock is configured to prevent a plurality of second processors from performing parallel processing.

### Claim 18 (depends on 11)

The apparatus of claim 11, wherein the one or more processors are further configured to execute the instructions to cause the apparatus to:
receive a task request requesting to execute a third operation, wherein requesting to execute the third operation comprises requesting to occupy the critical resource;
determine, based on a context corresponding to the task request being a task context, to disable task preemption and set a mutual exclusion flag in an operating system, wherein the mutual exclusion flag indicates that the critical resource is occupied; and
execute the third operation,
wherein after executing the third operation has ended, the one or more processors are further configured to execute the instructions to cause the apparatus to:
read and execute at least one operation temporarily stored in the temporary storage area; and
clear the mutual exclusion flag when the temporary storage area does not comprise a remaining operation.

### Claim 19 (depends on 11)

The apparatus of claim 11, wherein a structure of the temporary storage area comprises any one of the following:
a linked list structure;
a heap structure; or
a queue structure.

### Claim 20

A computer program product comprising computer-executable instructions that are stored on a non-transitory computer-readable medium and that, when executed by one or more processors, cause an apparatus to:
receive a first interrupt request requesting to execute a first operation, wherein requesting to execute the first operation comprises requesting to occupy a critical resource that cannot be simultaneously occupied by a plurality of second operations, and wherein the second operations comprise the first operation;
determine, based on the first interrupt request, that the first operation is not to be executed immediately; and
store, in response to determining that the first operation is not to be executed immediately, the first operation into a temporary storage area storing an operation that occupies the critical resource and that a received interrupt request requests to execute.
