# US 2025/0165294 A1 · Task scheduling method and apparatus, electronic device, and storage medium

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

- Number: US 2025/0165294 A1
- Document ID: US20250165294A1
- Status: Published application
- Kind: A1
- Application number: 18/878,029
- Filed: 2023-06-20
- Published: 2025-05-22
- Earliest claimed: 2022-12-06
- Assignees: Suzhou Metabrain Intelligent Technology Co., Ltd.
- Applicants: Suzhou Metabrain Intelligent Technology Co., Ltd.
- Inventors: Wenzheng QIN; Ji ZHONG
- Web page: https://patentgrep.com/patent/US20250165294A1

## CPC

- G06F 9/48: Program initiating; Program switching, e.g. by interrupt
- G06F 9/5027: {the resource being a machine, e.g. CPUs, Servers, Terminals}
- G06F 9/4881: {Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues}
- G06F 9/50: Allocation of resources, e.g. of the central processing unit [CPU]
- Y02D 10/00: Energy efficient computing, e.g. low power processors, power management or thermal management
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- Y02D: CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE

## Abstract

The present disclosure discloses a task scheduling method and apparatus, an electronic device and a non-transitory computer readable storage medium. The method includes: creating a target task and creating a target process corresponding to the target task; selecting an idle target central processing unit (CPU) core for the target task and deploying the target process in the target CPU core; calling a process function in the target process using the target CPU core to execute the target task; in a process of executing the target task, calling a task switching function of the target task; and selecting a switching task from all tasks waiting for switching and calling a process function corresponding to the switching task using the target CPU core to switch the target CPU core to the switching task for execution.

## Claims

### Claim 1

A task scheduling method, applied to an operating system of a solid state disk, comprising:
creating a target task and creating a target process corresponding to the target task;
selecting an idle target central processing unit (CPU) core for the target task and deploying the target process in the target CPU core;
calling a process function in the target process using the target CPU core to execute the target task;
in a process of executing the target task, calling a task switching function of the target task, wherein parameters of the task switching function comprise a dependent object during task switching and parameters corresponding to the dependent object; and
selecting a switching task from all tasks waiting for switching and calling a process function corresponding to the switching task using the target CPU core to switch the target CPU core to the switching task for execution.

### Claim 2 (depends on 1)

The task scheduling method according to claim 1, wherein creating the target process corresponding to the target task comprises:
determining task parameters of the target task, wherein the task parameters at least comprise a function corresponding to the target task and parameters corresponding to the function; and
creating the target process corresponding to the target task based on the task parameters of the target task, and allocating resources to the target process, wherein the resources comprise a task identifier, a stack space and a register address.

### Claim 3 (depends on 2)

The task scheduling method according to claim 2, wherein allocating the resources to the target process comprises:
allocating a stack space with a preset size to the target process.

### Claim 4 (depends on 2)

The task scheduling method according to claim 2, wherein allocating the resources to the target process comprises:
dividing all stack spaces into a plurality of subspaces with different sizes; and
allocating a smallest subspace larger than a size of a stack space required by the target process as a target subspace to the target process.

### Claim 5 (depends on 1)

The task scheduling method according to claim 1, wherein after calling the process function corresponding to the switching task using the target CPU core to switch the target CPU core to the switching task for execution, the method further comprises:
detecting whether a dependent object corresponding to the target task is completed, and in response to the dependent object corresponding to the target task being completed, taking the target task as a task waiting for switching.

### Claim 6 (depends on 1)

The task scheduling method according to claim 1, wherein selecting the switching task from all tasks waiting for switching comprises:
determining first priorities of all tasks waiting for switching according to attributes of all tasks waiting for switching; and
selecting a task waiting for switching with a highest first priority as the switching task.

### Claim 7 (depends on 6)

The task scheduling method according to claim 6, wherein the attributes arranged in descending order according to the first priorities comprise any one or any combination of displayed task switching, host read, host write, a host management command, background read, background write, a background management command, metadata management, an algorithm and statistical information.

### Claim 8 (depends on 6)

The task scheduling method according to claim 6, wherein selecting the task waiting for switching with the highest first priority as the switching task comprises:
in response to a presence of a plurality of tasks waiting for switching with the highest first priority, determining second priorities of all tasks waiting for switching according to dependent objects of all tasks waiting for switching during the task switching; and
selecting a task waiting for switching with a highest second priority as the switching task from the plurality of tasks waiting for switching with the highest first priority.

### Claim 9 (depends on 8)

The task scheduling method according to claim 8, wherein the dependent objects arranged in descending order according to the second priorities comprise a completion message, a lock resource release, a computer flash memory device (NAND) read/write command, a command indicating that direct memory access (DMA) flows to a host side, a command indicating that DMA flows to a device side, a lock resource acquisition command, a timer and an algorithm module.

### Claim 10 (depends on 8)

The task scheduling method according to claim 8, further comprising:
in response to an end time of the timer of the target task exceeding a preset value, rising a second priority of the target task by a preset level.

### Claim 11 (depends on 1)

The task scheduling method according to claim 1, wherein selecting the switching task from all tasks waiting for switching comprises:
determining times corresponding to dependent objects when all tasks waiting for switching are completed; and
selecting a task waiting for switching with a longest time as the switching task.

### Claim 12 (depends on 1)

The task scheduling method according to claim 1, further comprising:
determining whether processes corresponding to the other tasks are deployed in the target CPU core when the target task needs to communicate with other tasks; and
in response to the processes corresponding to the other tasks being deployed in the target CPU core, performing a communication between the target task with the other tasks in a shared memory variable manner.

### Claim 13 (depends on 12)

The task scheduling method according to claim 12, wherein after determining whether the processes corresponding to the other tasks are deployed in the target CPU core, the method further comprises:
in response to the processes corresponding to the other tasks being deployed in other CPU cores, performing the communication between the target task with the other tasks in a resource lock mutually exclusive manner.

### Claim 14 (depends on 1)

The task scheduling method according to claim 1, further comprising:
deleting context information of the target task and releasing a stack space of the target task when the target task is completed.

### Claim 15 (depends on 1)

The task scheduling method according to claim 1, wherein the process function comprises a resource encapsulation function, wherein the resource encapsulation function comprises any one or any combination of an input/output command selection function, a data transmission function, a resource locking function, a NAND operation function and a function sending a completion message to a host.

### Claim 16 (depends on 1)

The task scheduling method according to claim 1, wherein the process function comprises a system call function, wherein the system call function comprises any one or any combination of a memory request function, a memory release function, an encryption algorithm function, a compression algorithm function, a redundant array of independent disk (RAID) operation function, a memory search function, a memory sorting function and a management interface input/output function.

### Claim 17 (depends on 1)

The task scheduling method according to claim 1, further comprising:
initializing the operating system, allocating stacks and initializing hardware interfaces;
controlling a startup of an attendance process, wherein the attendance process is configured to receive an injection command for the solid state disk;
controlling a startup of a management process, wherein the management process is configured to receive a management command for the solid state disk; and
receiving a task creation command.

### Claim 18

(canceled)

### Claim 19

An electronic device, comprising:
a memory for storing a computer program; and
a processor for executing the computer program to implement operations comprising:
creating a target task and creating a target process corresponding to the target task;
selecting an idle target central processing unit (CPU) core for the target task and deploying the target process in the target CPU core;
calling a process function in the target process using the target CPU core to execute the target task;
in a process of executing the target task, calling a task switching function of the target task, wherein parameters of the task switching function comprise a dependent object during task switching and parameters corresponding to the dependent object; and
selecting a switching task from all tasks waiting for switching and calling a process function corresponding to the switching task using the target CPU core to switch the target CPU core to the switching task for execution.

### Claim 20

A non-transitory computer readable storage medium storing a computer program, wherein the processor, when executing the computer program, implements operations comprising:
creating a target task and creating a target process corresponding to the target task;
selecting an idle target central processing unit (CPU) core for the target task and deploying the target process in the target CPU core;
calling a process function in the target process using the target CPU core to execute the target task;
in a process of executing the target task, calling a task switching function of the target task, wherein parameters of the task switching function comprise a dependent object during task switching and parameters corresponding to the dependent object; and
selecting a switching task from all tasks waiting for switching and calling a process function corresponding to the switching task using the target CPU core to switch the target CPU core to the switching task for execution.

### Claim 21 (depends on 2)

The task scheduling method according to claim 2, further comprising:
in response to no task identifier being allocated, determining that creating the target task failed.
