# US 2026/0099353 A1 · Task scheduling

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

- Number: US 2026/0099353 A1
- Document ID: US20260099353A1
- Status: Published application
- Kind: A1
- Application number: 19/417,127
- Filed: 2025-12-11
- Published: 2026-04-09
- Earliest claimed: 2023-09-27
- Assignees: Beijing OceanBase Technology Co., Ltd.
- Applicants: Beijing Oceanbase Technology Co., Ltd.
- Inventors: Haosheng HU; Jingkun FENG
- Web page: https://patentgrep.com/patent/US20260099353A1

## CPC

- G06F 9/48: Program initiating; Program switching, e.g. by interrupt
- G06F 9/4831: {with variable priority}
- G06F 9/46: Multiprogramming arrangements
- 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]
- G06F 9/5016: {the resource being the memory}
- G06F 9/5022: {Mechanisms to release resources}
- G06F 9/5027: {the resource being a machine, e.g. CPUs, Servers, Terminals}
- G06F 9/5038: {considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration (scheduling strategies G06F9/4881 and subgroups)}
- G06F 9/505: {considering the load}
- G06F 9/5083: {Techniques for rebalancing the load in a distributed system}
- G06F 2209/5011: Pool
- G06F 2209/5017: Task decomposition
- G06F 2209/5018: Thread allocation
- G06F 2209/5021: Priority
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

One or more implementations of the present specification provide a task scheduling method and apparatus, and relate to the field of computer technologies. The method includes: determining a target task queue from a plurality of pre-constructed task queues, the plurality of pre-constructed task queues being used respectively to store tasks with different priorities, each task queue having a respective scheduling weight, and the scheduling weight being used to control a probability that the task queue is determined as the target task queue; and scheduling a target task in the target task queue to a specified thread in a thread pool, to execute the target task. In the implementations of the present specification, execution of tasks with different priorities can be properly coordinated, thereby avoiding resource contention among the tasks with different priorities in a task scheduling process.

## Claims

### Claim 1

A task scheduling method, comprising: determining a target task queue from a plurality of task queues, the plurality of task queues configured to respectively store tasks with different priorities, each task queue having a respective scheduling weight, and the scheduling weight related to a probability that the task queue is determined as the target task queue; and scheduling a target task in the target task queue to a thread in a thread pool, to execute the target task.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the thread pool includes a first thread and a second thread, and the first thread and the second thread are configured respectively to execute tasks with different priorities; and the scheduling the target task in the target task queue to the thread in the thread pool includes: scheduling the target task to one of the first thread or the second thread based on a priority of the target task.

### Claim 3 (depends on 2)

The method according to claim 2, wherein the first thread is configured to execute a task with a highest priority stored in the plurality of task queues, the second thread is configured to execute a task with a priority other than the highest priority stored in the plurality of task queues, and a quantity of the first thread is less than or equal to a quantity of the second thread.

### Claim 4 (depends on 2)

The method according to claim 2, further comprising: determining a total quantity of the plurality of threads in the thread pool; and configuring at least half of the plurality of threads in the thread pool as second threads.

### Claim 5 (depends on 4)

The method according to claim 4, wherein the determining the total quantity of the plurality of threads in the thread pool includes: preliminarily determining the total quantity of the plurality of threads; predicting, based on the total quantity of threads preliminarily determined, a total memory usage during execution of tasks stored in the plurality of task queues; and in response to the total memory usage exceeding a memory limit, reducing the total quantity of the plurality of threads until the total memory usage predicted satisfies the memory limit.

### Claim 6 (depends on 5)

The method according to claim 5, wherein the tasks stored in the plurality of pre-constructed task queues are subtasks of a compaction task; and the predicting, based on the total quantity of threads preliminarily determined, the total memory usage during execution of the tasks stored in the plurality of pre-constructed task queues includes: separately predicting macroblock buffer memory usage, macroblock meta information memory usage, deep copy memory usage, and prestored array memory usage that are generated during execution of the compaction task; multiplying a sum of the macroblock buffer memory usage and the macroblock meta information memory usage by a quantity of the compaction task, to obtain a first product; multiplying a sum of the deep copy memory usage and the prestored array memory usage by the total quantity of threads preliminarily determined, to obtain a second product; and adding the first product and the second product to obtain the total memory usage.

### Claim 7 (depends on 1)

The method according to claim 1, wherein the probability that the task queue is determined as the target task queue is positively correlated with a priority of a task stored in the task queue.

### Claim 8 (depends on 1)

The method according to claim 1, wherein the scheduling weight is configured by using a weight coefficient interval, and a size of the weight coefficient interval corresponding to each task queue is positively correlated with a priority of a task stored in the task queue; and the determining the target task queue from the plurality of task queues includes: generating a random weight coefficient; and determining a task queue corresponding to a weight coefficient interval within which the random weight coefficient falls as the target task queue.

### Claim 9

An electronic device, comprising: one or more processors; and one or more storage devices, individually or collectively having computer executable instructions stored thereon, the computer executable instructions, when executed by the one or more processors, enabling the one or more processors to, individually or collectively, implement acts including: determining a target task queue from a plurality of task queues, the plurality of task queues configured to respectively store tasks with different priorities, each task queue having a respective scheduling weight, and the scheduling weight related to a probability that the task queue is determined as the target task queue; and scheduling a target task in the target task queue to a thread in a thread pool, to execute the target task.

### Claim 10 (depends on 9)

The electronic device according to claim 9, wherein the thread pool includes a first thread and a second thread, and the first thread and the second thread are configured respectively to execute tasks with different priorities; and the scheduling the target task in the target task queue to the thread in the thread pool includes: scheduling the target task to one of the first thread or the second thread based on a priority of the target task.

### Claim 11 (depends on 10)

The electronic device according to claim 10, wherein the first thread is configured to execute a task with a highest priority stored in the plurality of task queues, the second thread is configured to execute a task with a priority other than the highest priority stored in the plurality of task queues, and a quantity of the first thread is less than or equal to a quantity of the second thread.

### Claim 12 (depends on 10)

The electronic device according to claim 10, wherein the acts include: determining a total quantity of the plurality of threads in the thread pool; and configuring at least half of the plurality of threads in the thread pool as second threads.

### Claim 13 (depends on 12)

The electronic device according to claim 12, wherein the determining the total quantity of the plurality of threads in the thread pool includes: preliminarily determining the total quantity of the plurality of threads; predicting, based on the total quantity of threads preliminarily determined, a total memory usage during execution of tasks stored in the plurality of task queues; and in response to the total memory usage exceeding a memory limit, reducing the total quantity of the plurality of threads until the total memory usage predicted satisfies the memory limit.

### Claim 14 (depends on 13)

The electronic device according to claim 13, wherein the tasks stored in the plurality of pre-constructed task queues are subtasks of a compaction task; and the predicting, based on the total quantity of threads preliminarily determined, the total memory usage during execution of the tasks stored in the plurality of pre-constructed task queues includes: separately predicting macroblock buffer memory usage, macroblock meta information memory usage, deep copy memory usage, and prestored array memory usage that are generated during execution of the compaction task; multiplying a sum of the macroblock buffer memory usage and the macroblock meta information memory usage by a quantity of the compaction task, to obtain a first product; multiplying a sum of the deep copy memory usage and the prestored array memory usage by the total quantity of threads preliminarily determined, to obtain a second product; and adding the first product and the second product to obtain the total memory usage.

### Claim 15 (depends on 9)

The electronic device according to claim 9, wherein the probability that the task queue is determined as the target task queue is positively correlated with a priority of a task stored in the task queue.

### Claim 16 (depends on 9)

The electronic device according to claim 9, wherein the scheduling weight is configured by using a weight coefficient interval, and a size of the weight coefficient interval corresponding to each task queue is positively correlated with a priority of a task stored in the task queue; and the determining the target task queue from the plurality of task queues includes: generating a random weight coefficient; and determining a task queue corresponding to a weight coefficient interval within which the random weight coefficient falls as the target task queue.

### Claim 17

A computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by one or more processors, the computer instructions enable the one or more processors to, individually or collectively, implement acts comprising: determining a target task queue from a plurality of task queues, the plurality of task queues configured to respectively store tasks with different priorities, each task queue having a respective scheduling weight, and the scheduling weight related to a probability that the task queue is determined as the target task queue; and scheduling a target task in the target task queue to a thread in a thread pool, to execute the target task.

### Claim 18 (depends on 17)

The computer-readable storage medium according to claim 17, wherein the thread pool includes a first thread and a second thread, and the first thread and the second thread are configured respectively to execute tasks with different priorities; and the scheduling the target task in the target task queue to the thread in the thread pool includes: scheduling the target task to one of the first thread or the second thread based on a priority of the target task.

### Claim 19 (depends on 18)

The computer-readable storage medium according to claim 18, wherein the first thread is configured to execute a task with a highest priority stored in the plurality of task queues, the second thread is configured to execute a task with a priority other than the highest priority stored in the plurality of task queues, and a quantity of the first thread is less than or equal to a quantity of the second thread.

### Claim 20 (depends on 17)

The computer-readable storage medium according to claim 17, where the acts comprise: preliminarily determining a total quantity of the plurality of threads; predicting, based on the total quantity of threads preliminarily determined, a total memory usage during execution of tasks stored in the plurality of task queues; and in response to the total memory usage exceeding a memory limit, reducing the total quantity of the plurality of threads until the total memory usage predicted satisfies the memory limit.
