Task scheduling method and device, electronic equipment, storage medium and program product

By detecting the remaining resources of the task processor and reasonably scheduling online and offline tasks, the problem of unreasonable utilization of computer resources is solved, and the efficient execution of online and offline tasks is achieved.

CN120508364APending Publication Date: 2025-08-19JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510596188.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-09
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

In the prior art, when computers process online and offline tasks, resource utilization is unreasonable, resulting in inefficient execution of offline tasks.

Method used

By detecting the remaining resources of the task processor, reasonably dispatching online and offline tasks, using online tasks to run offline tasks when they are idle, using online scheduling classes and offline scheduling classes to manage different types of tasks respectively, realizing dynamic conversion of task types and automatic balance of resources.

Benefits of technology

Improve the operation efficiency of offline tasks, rationally utilize the entire computer processor resources, and ensure the efficient execution of online tasks and offline tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120508364A_ABST
    Figure CN120508364A_ABST
Patent Text Reader

Abstract

The invention provides a task scheduling method and device, electronic equipment, a storage medium and a program product. Relates to the technical field of computers such as cloud computing. The method comprises the steps that under the condition that a task processor is determined to support processing of online tasks and offline tasks, in response to the detection that the online tasks to be scheduled exist in an online operation queue and the offline tasks to be scheduled exist in an offline operation queue, the online tasks are scheduled from the online operation queue and sent to the task processor to be processed; and in response to detection that the current residual resources of the task processor meet a first preset condition and the to-be-scheduled online task in the online operation queue is empty, scheduling an offline task from the offline operation queue, and sending the offline task to the task processor for processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, in particular to fields such as cloud computing, and more specifically to a task scheduling method, device, electronic device, storage medium, and program product. Background Art

[0002] With the rapid development of computer network technology, the cloud computing industry has evolved from single-server computers to interconnected cluster deployments. Mainstream cluster deployment solutions primarily rely on stacking machines to meet specific business requirements, failing to fully leverage the performance advantages of individual computers within the cluster. Furthermore, the diverse nature of cloud computing services has led to management and maintenance challenges.

[0003] In the process of implementing the concept of the present disclosure, the inventors discovered that there are at least the following problems in the related art: in a scenario involving online tasks and offline tasks, computer resources cannot be reasonably utilized. Summary of the Invention

[0004] In view of this, the present disclosure provides a task scheduling method, apparatus, electronic device, storage medium, and program product.

[0005] One aspect of the present disclosure provides a task scheduling method, comprising: in a case where it is determined that a task processor supports processing online tasks and offline tasks, in response to detecting that there are online tasks to be scheduled in an online running queue and offline tasks to be scheduled in an offline running queue, scheduling the online tasks from the online running queue and sending them to the task processor for processing; in response to detecting that the current remaining resources of the task processor meet a first preset condition and the online tasks to be scheduled in the online running queue are empty, scheduling the offline tasks from the offline running queue and sending them to the task processor for processing.

[0006] According to an embodiment of the present disclosure, the task scheduling method also includes: in response to task initiation, obtaining the task type parameter of the task; when the task type parameter represents an online scheduling type, calling the online scheduling class to distribute the task to the online running queue; when the task type parameter represents an offline scheduling type, calling the offline scheduling class to distribute the task to the offline running queue.

[0007] According to an embodiment of the present disclosure, in response to task initiation, obtaining the task type parameters of the task includes: in response to task initiation, obtaining the task priority information of the task; when the task priority information satisfies a first priority range, determining the task type parameter as an online scheduling type; when the task priority information satisfies a second priority range, determining the task type parameter as an offline scheduling type, and the scheduling priority represented by the first priority range is higher than the scheduling priority represented by the second priority range.

[0008] According to an embodiment of the present disclosure, the task scheduling method also includes: in response to detecting that the task type parameter of the first task already existing in the online running queue is changed to the offline scheduling type, calling the offline scheduling class to migrate the first task to the offline running queue; in response to detecting that the task type parameter of the second task already existing in the offline running queue is changed to the online scheduling type, calling the online scheduling class to migrate the second task to the online running queue.

[0009] According to an embodiment of the present disclosure, there are multiple task processors; the task scheduling method also includes: in response to detecting that the total remaining resources of the multiple task processors meet the second preset condition and the online tasks to be scheduled in the online running queue are empty, migrating the online tasks processed by the multiple task processors to the first part of the multiple task processors for processing; sending the offline tasks to the second part of the multiple task processors for processing, the second part of the task processors representing the task processors whose current remaining resources meet the first preset condition among the multiple task processors.

[0010] According to an embodiment of the present disclosure, the task scheduling method also includes: obtaining kernel startup parameters related to the task processor; in response to detecting that the kernel startup parameter is a first parameter value characterizing that online tasks and offline tasks share the task processor, determining that the task processor supports processing online tasks and offline tasks; in response to detecting that the kernel startup parameter is a second parameter value characterizing that online tasks exclusively occupy the task processor, determining that the task processor only supports processing online tasks.

[0011] Another aspect of the present disclosure provides a task scheduling device, including: an online task scheduling module, which is used to schedule online tasks from the online running queue and send them to the task processor for processing in response to detecting that there are online tasks to be scheduled in the online running queue and offline tasks to be scheduled in the offline running queue when it is determined that the task processor supports processing online tasks and offline tasks; an offline task scheduling module, which is used to schedule offline tasks from the offline running queue and send them to the task processor for processing in response to detecting that the current remaining resources of the task processor meet a first preset condition and that the online tasks to be scheduled in the online running queue are empty.

[0012] Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the task scheduling method of the present disclosure.

[0013] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the task scheduling method of the present disclosure when executed.

[0014] Another aspect of the present disclosure provides a computer program product, which includes computer-executable instructions. When the instructions are executed, they are used to implement the task scheduling method of the present disclosure.

[0015] According to the embodiments of the present disclosure, because a technical means is adopted in which, in response to detecting that there are online tasks to be scheduled in the online running queue and offline tasks to be scheduled in the offline running queue, the online tasks are scheduled from the online running queue and sent to the task processor for processing; in response to detecting that the current remaining resources of the task processor meet the first preset condition and the online tasks to be scheduled in the online running queue are empty, the offline tasks are scheduled from the offline running queue and sent to the task processor for processing, by detecting the current remaining resources of the task processor, the idle task processor can be timely and automatically released to run the offline tasks when the online tasks in the computer are relatively idle, thereby improving the offline task running efficiency and effectively and reasonably utilizing the execution efficiency of the computer's processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:

[0017] Figure 1 Schematically illustrates an exemplary system architecture to which the task scheduling method according to an embodiment of the present disclosure can be applied;

[0018] Figure 2 The following schematically shows a flowchart of a task scheduling method according to an embodiment of the present disclosure;

[0019] Figure 3 The overall flow chart of the task scheduling method according to an embodiment of the present disclosure is schematically shown;

[0020] Figure 4 A block diagram schematically illustrates a task scheduling device according to an embodiment of the present disclosure;

[0021] Figure 5 A block diagram of an electronic device suitable for implementing a task scheduling method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0022] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the detailed description below, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.

[0023] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise," "include," etc. used herein indicate the presence of the features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0024] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0025] When expressions such as "at least one of A, B, and C, etc." are used, they should generally be interpreted in accordance with the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0026] In the embodiments of this disclosure, the collection, updating, analysis, processing, use, transmission, provision, disclosure, and storage of all data involved (including, but not limited to, user personal information) comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. In particular, necessary measures have been taken to prevent unauthorized access to user personal information and maintain information security.

[0027] In the embodiments of the present disclosure, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.

[0028] In the related art, it is impossible to simultaneously meet the use scenarios of online tasks and offline tasks. When there are fewer online tasks in the computer, manual switching to offline tasks or scheduled switching to offline tasks are usually adopted to allow offline tasks to have running time.

[0029] Related technologies are unable to intelligently distinguish whether online tasks are idle, thus constantly occupying computer resources and overall slowing down offline task execution times. For example, movie downloads require a long runtime. Manual or scheduled offline task switching often results in long download times, failing to meet customer needs due to the limited runtime.

[0030] In summary, the inventors discovered during the process of implementing the concept of the present disclosure that, in a scenario involving both online and offline tasks, computer resources cannot be reasonably utilized.

[0031] Embodiments of the present disclosure provide a task scheduling method, apparatus, electronic device, storage medium, and program product, including: in a case where it is determined that a task processor supports processing online tasks and offline tasks, in response to detecting that there are online tasks to be scheduled in an online run queue and offline tasks to be scheduled in an offline run queue, scheduling the online task from the online run queue and sending it to the task processor for processing; in response to detecting that the current remaining resources of the task processor meet a first preset condition and that the online run queue has no online tasks to be scheduled, scheduling the offline task from the offline run queue and sending it to the task processor for processing.

[0032] Figure 1 The exemplary system architecture 100 to which the task scheduling method according to an embodiment of the present disclosure can be applied is schematically shown. It should be noted that, Figure 1 The examples shown are merely examples of system architectures to which the embodiments of the present disclosure may be applied, to help those skilled in the art understand the technical content of the present disclosure, but do not mean that the embodiments of the present disclosure may not be used in other devices, systems, environments or scenarios.

[0033] like Figure 1 As shown, the system architecture 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.

[0034] A user may use a first terminal device 101, a second terminal device 102, or a third terminal device 103 to interact with a server 105 via a network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, or the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software (for example only).

[0035] The first terminal device 101 , the second terminal device 102 , and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0036] The server 105 may be a server that provides various services, such as a background management server (for example only) that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process received data such as user requests, and feed back processing results (e.g., web pages, information, or data obtained or generated based on user requests) to the terminal devices.

[0037] It should be noted that the task scheduling method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the task scheduling device provided in the embodiment of the present disclosure can generally be set in the server 105. The task scheduling method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the task scheduling device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Alternatively, the task scheduling method provided in the embodiment of the present disclosure can also be executed by the first terminal device 101, the second terminal device 102 or the third terminal device 103, or can also be executed by other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103. Accordingly, the task scheduling device provided in the embodiment of the present disclosure can also be set in the first terminal device 101, the second terminal device 102 or the third terminal device 103, or in other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103.

[0038] For example, the online tasks and offline tasks may be originally stored in any one of the first terminal device 101, the second terminal device 102, or the third terminal device 103 (for example, the first terminal device 101, but not limited thereto), or stored on an external storage device and imported into the first terminal device 101. Then, the first terminal device 101 may locally execute the task scheduling method provided by the embodiment of the present disclosure, or send the online tasks and offline tasks to other terminal devices, servers, or server clusters, and the other terminal devices, servers, or server clusters that receive the online tasks and offline tasks may execute the task scheduling method provided by the embodiment of the present disclosure.

[0039] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.

[0040] Figure 2 The flowchart of the task scheduling method according to the embodiment of the present disclosure is schematically shown.

[0041] like Figure 2 As shown, the method includes operations S201-S202.

[0042] In operation S201, when it is determined that the task processor supports processing online tasks and offline tasks, in response to detecting that there are online tasks to be scheduled in the online running queue and there are offline tasks to be scheduled in the offline running queue, the online tasks are scheduled from the online running queue and sent to the task processor for processing.

[0043] According to embodiments of the present disclosure, the task processor may use any type of processor with task processing capabilities. For example, it may include, but is not limited to, a central processing unit (CPU), a graphics processing unit (GPU), a field-programmable gate array (FPGA), an application-specific integrated circuit (ASIC), and a microcontroller unit (MCU).

[0044] According to embodiments of the present disclosure, before processing tasks using a task processor, tasks can be first divided into online tasks and offline tasks. For example, online tasks can be generated when a search or promotion application is launched, while offline tasks can be generated when a video download or map application is launched. Online tasks are then stored in an online run queue, while offline tasks are stored in an offline run queue, awaiting scheduling.

[0045] According to an embodiment of the present disclosure, online tasks may have a higher scheduling priority than offline tasks. Therefore, when there are online tasks and offline tasks, online tasks may be scheduled to the task processor for processing first.

[0046] In operation S202 , in response to detecting that the current remaining resources of the task processor meet the first preset condition and the online running queue is empty of online tasks to be scheduled, an offline task is scheduled from the offline running queue and sent to the task processor for processing.

[0047] According to an embodiment of the present disclosure, the current remaining resources can represent the idle computing power that the processor can currently put into calculation immediately. Specifically, it can include: idle time slices, representing processing time not used by processes; available cache / memory bandwidth, representing unoccupied data read and write channels; idle cores / threads, representing physical or logical cores that are not called in a multi-core processor, and it is not limited to this. The first preset condition can include any of the following: the amount of resources currently remaining meets the first threshold, the proportion of current remaining resources to total resources is greater than a preset proportion, etc., and it is not limited to this.

[0048] According to an embodiment of the present disclosure, offline tasks can be executed when online tasks are idle. Therefore, after the online task scheduling is completed, the scheduling and processing of offline tasks can be started.

[0049] Through the above-mentioned embodiments of the present disclosure, by detecting the current remaining resources of the task processor, the idle task processor can be released in a timely and automatic manner to run offline tasks when the online tasks in the computer are relatively idle, thereby improving the efficiency of offline task operation and effectively and reasonably utilizing the execution efficiency of the computer's entire processor.

[0050] In conjunction with specific embodiments, Figure 2 The method shown is further explained.

[0051] According to an embodiment of the present disclosure, before performing the above-mentioned operation S201, tasks may first be classified according to their task types and stored in corresponding run queues. The method may include: in response to task initiation, obtaining a task type parameter for the task. If the task type parameter indicates an online scheduling type, calling an online scheduling class to distribute the task to an online run queue. If the task type parameter indicates an offline scheduling type, calling an offline scheduling class to distribute the task to an offline run queue.

[0052] According to an embodiment of the present disclosure, when different types of applications are started, task types can be specified as needed and recorded in task type parameters. The task type parameters can be represented by online_task (online task) or offline_task (offline task).

[0053] According to the embodiments of the present disclosure, the offline scheduling class is mainly used for scheduling and running offline tasks, such as tasks entering the running queue, tasks being loaded into the CPU for execution, tasks exiting the running queue, and so on. The online scheduling class is mainly used for scheduling and running online tasks, and may have the same or similar functions as the aforementioned offline scheduling class, or may maintain the original scheduling class scheduling and running of the computer kernel. The online scheduling class and the offline scheduling class may be pre-configured in the computer kernel. All online tasks are managed / maintained by the online scheduling class, and all offline tasks are managed / maintained by the offline scheduling class. The online scheduling class may have a higher priority, and the offline scheduling class priority is lower than the online scheduling class priority. Each time an application is started, the kernel layer may schedule online tasks and offline tasks according to the corresponding scheduling class, and different tasks enter different running queues.

[0054] For example, when application 1 is started, the parameter "online_task" with a value of 1 is added, or the default value of "offline_task" is 0. This indicates that the application is started as an online task. The online task generated by the application can be dispatched to the online run queue by calling the online scheduling class. When application 2 is started, the parameter "offine_task" with a value of 1 is added, or the default value of "online_task" is 0. This indicates that the application is started as an offline task. The online task generated by the application can be dispatched to the online run queue by calling the offline scheduling class.

[0055] According to an embodiment of the present disclosure, in response to task initiation, obtaining a task type parameter of the task may include: obtaining task priority information of the task in response to task initiation. If the task priority information satisfies a first priority range, the task type parameter is determined to be an online scheduling type. If the task priority information satisfies a second priority range, the task type parameter is determined to be an offline scheduling type, and the scheduling priority represented by the first priority range is higher than the scheduling priority represented by the second priority range.

[0056] According to the embodiment of the present disclosure, each task can be generated with its own task priority information. The first priority range and the second priority range can be customized according to business needs and are not limited here.

[0057] For example, based on business needs, tasks can include real-time tasks, regular tasks, and offline tasks, forming a task identifier. The priority of a real-time task can range from 0 to 99, the priority of a regular task can range from 100 to 139, and the priority of an offline task can range from 140 to 179. The first priority range can be set to 0 to 139, and the second priority range can be set to 140 to 179. Based on the priority values of the initiated tasks, real-time tasks and regular tasks can be classified as online tasks and assigned the value online_task = 1 or offline_task = 0. Offline tasks can be assigned the value online_task = 0 or offline_task = 1.

[0058] Through the above-mentioned embodiments of the present disclosure, by adding online scheduling classes, offline scheduling classes and scheduling rules in the computer kernel, it is possible to effectively implement intelligent management of online / offline tasks and maintain different business types.

[0059] Based on the above embodiment, for CPU (CPU is used in the following embodiments for description) task execution rules, a rule of online first, offline last can be set. Specifically, the task execution order can be set in the computer kernel: online task > offline task > idle thread.

[0060] For example, when CPU0 has online tasks waiting to be scheduled, it can execute all online tasks in the online run queue in order according to their priority before entering the idle state, or the idle thread. Because offline tasks have a higher execution priority than the idle thread, when CPU0 is idle, it first executes all offline tasks in order according to their priority before entering the idle thread.

[0061] It should be noted that for the task scheduling process of multiple tasks in the online running queue (or offline running queue), the priority order can be determined according to the priority value of each task, or the priority value of each task can be weighted calculated in combination with the weight of each task to re-plan the task scheduling order. There is no limitation here.

[0062] According to an embodiment of the present disclosure, when there are multiple task processors, the method may further include: in response to detecting that the total remaining resources of the multiple task processors meet a second preset condition and the number of online tasks to be scheduled in the online run queue is empty, migrating the online tasks processed by the multiple task processors to a first portion of the multiple task processors for processing. Sending offline tasks to a second portion of the multiple task processors for processing, the second portion of the task processors representing the task processors whose current remaining resources meet the first preset condition.

[0063] According to an embodiment of the present disclosure, the total remaining resources can be determined based on the sum of the current remaining resources of each task processor. The second preset condition may include any of the following: the amount of the total remaining resources meets the second threshold, the proportion of the total remaining resources to the total resources is greater than the preset proportion, etc., and may not be limited thereto. The second threshold can be determined based on the first threshold. For example, the second threshold may be equal to the first threshold; in the case where the first threshold represents the threshold set for a task processor, the second threshold can also be determined based on the product of the first threshold and the total number of task processors, which is not limited here.

[0064] For example, when the online business load is low, that is, when the overall number of online tasks is relatively idle, some CPUs in the computer are idle. The online task scheduling class can tighten the online tasks to run on some CPUs, leaving some CPUs for running offline tasks, ensuring that all CPUs in the computer are run reasonably.

[0065] Through the above-mentioned embodiments of the present disclosure, a new task automatic balancing mechanism is added, which can realize the intelligent operation of online and offline services and effectively improve the task processing efficiency.

[0066] According to an embodiment of the present disclosure, in the above-mentioned task scheduling process, the task type of each task can also be dynamically modified by modifying the task type parameters. Specifically, the task type parameters of the corresponding task can be modified by configuring a timing program or a rule program. Then, in response to detecting that the task type parameter of the first task already existing in the online running queue is changed to the offline scheduling type, the offline scheduling class is called to migrate the first task to the offline running queue. In response to detecting that the task type parameter of the second task already existing in the offline running queue is changed to the online scheduling type, the online scheduling class is called to migrate the second task to the online running queue.

[0067] A timed program may represent a program that runs at a preset time. A rule program may represent a program that runs when a preset rule is met. Preset rules may include, but are not limited to, at least one of the following: a task's waiting time in the run queue exceeds a preset time, a task ID change, such as a normal task being changed to an offline task or a real-time task, etc., and are not limited thereto.

[0068] For example, if online task 1 does not require a timely response time, you can change it to an offline task by changing its online_task to 0. This task will remain an offline task until it exits. If offline task 1 requires a timely response time and more running time, you can change it to an online task by changing its online_task to 1. This task will remain an online task until it exits.

[0069] Through the above-mentioned embodiments of the present disclosure, a task type conversion mechanism is newly added, so that online and offline businesses support business type conversion, and task type conversion can be conveniently implemented when necessary, meeting task processing requirements in various scenarios and improving task processing efficiency.

[0070] According to an embodiment of the present disclosure, for the aforementioned task scheduling method, an online task exclusive mechanism can be configured by obtaining kernel startup parameters related to the task processor to determine whether the online task exclusively occupies the CPU in the computer. In a subsequent processing process, in response to detecting that the kernel startup parameter is a first parameter value indicating that the online task and the offline task share the task processor, it can be determined that the task processor supports processing both online and offline tasks. In response to detecting that the kernel startup parameter is a second parameter value indicating that the online task exclusively occupies the task processor, it can be determined that the task processor only supports processing online tasks.

[0071] For example, kernel startup parameters can be defined using the online_unique parameter. When online_unique is 1, it indicates that the online task is exclusive, while when online_unique is 0, it indicates that the online task and the offline task share the CPU in the computer.

[0072] It should be noted that offline tasks can only meet the running conditions when the "online task exclusive mechanism" is not enabled. Otherwise, the offline tasks that are enabled or modified will be started / run as online tasks.

[0073] Through the above-mentioned embodiments of the present disclosure, an online task exclusive mechanism can be added by configuring kernel startup parameters to ensure the maximum execution time of online tasks and reduce time-consuming items such as frequent buffer refreshes due to offline task interference.

[0074] Figure 3 The overall flow chart of the task scheduling method according to an embodiment of the present disclosure is schematically shown.

[0075] like Figure 3 As shown, the method includes operations S301 to S310.

[0076] In operation S301 , an application is started and a task is generated.

[0077] In operation S302 , the value of the offline_task parameter of the task is updated according to the priority value of the task.

[0078] In operation S303, it is determined whether the value of offline_task is 0. If so, operation S304 is executed; if not, operation S305 is executed.

[0079] In operation S304, tasks are distributed to online running queues based on the online scheduling class, and online tasks are given priority to occupy the CPU.

[0080] In operation S305 , when the online task exclusive mechanism is not enabled, the task is distributed to the offline running queue based on the offline scheduling class, and the offline task occupies the CPU when the CPU is idle.

[0081] In operation S306 , the CPU runs the task.

[0082] In operation S307, it is determined whether there is still a task to be scheduled. If so, operations S308 to S309 are executed; if not, operation S310 is executed.

[0083] In operation S308 , the online task continues to enter the online running queue, or the offline task is changed to an online task and then enters the online running queue.

[0084] In operation S309 , the offline task continues to enter the online running queue, or the online task is changed to an offline task and then enters the offline running queue.

[0085] In operation S310 , the task execution is completed and the application is exited.

[0086] Through the above-mentioned embodiments of the present disclosure, a design scheme of a multi-tasking type kernel is provided, which can timely and automatically release idle task processors to run offline tasks when online tasks in the computer are relatively idle, thereby improving the efficiency of offline task operation and effectively and reasonably utilizing the execution efficiency of the computer's entire processor.

[0087] Figure 4 The block diagram schematically shows a task scheduling device according to an embodiment of the present disclosure.

[0088] like Figure 4 As shown, the task scheduling apparatus 400 includes an online task scheduling module 410 and an offline task scheduling module 420 .

[0089] The online task scheduling module 410 is used to schedule online tasks from the online running queue and send them to the task processor for processing in response to detecting that there are online tasks to be scheduled in the online running queue and offline tasks to be scheduled in the offline running queue, when it is determined that the task processor supports processing online tasks and offline tasks.

[0090] The offline task scheduling module 420 is configured to schedule offline tasks from the offline running queue and send them to the task processor for processing in response to detecting that the current remaining resources of the task processor meet the first preset condition and the online running queue has no online tasks to be scheduled.

[0091] According to an embodiment of the present disclosure, the task scheduling apparatus further includes a task type parameter acquisition module, an online scheduling module, and an offline scheduling module.

[0092] The task type parameter acquisition module is used to obtain the task type parameters of the task in response to task initiation.

[0093] The online scheduling module is used to call the online scheduling class and distribute the task to the online running queue when the task type parameter represents the online scheduling type.

[0094] The offline scheduling module is used to call the offline scheduling class and distribute the task to the offline running queue when the task type parameter represents the offline scheduling type.

[0095] According to an embodiment of the present disclosure, the task type parameter acquisition module includes a task priority information acquisition unit, an online type determination unit, and an offline type determination unit.

[0096] The task priority information acquiring unit is configured to acquire the task priority information of the task in response to task initiation.

[0097] The online type determining unit is configured to determine the task type parameter as an online scheduling type when the task priority information satisfies a first priority range.

[0098] The offline type determination unit is used to determine the task type parameter as an offline scheduling type when the task priority information meets the second priority range, and the scheduling priority represented by the first priority range is higher than the scheduling priority represented by the second priority range.

[0099] According to an embodiment of the present disclosure, the task scheduling apparatus further includes a first task migration module and a second task migration module.

[0100] The first task migration module is configured to, in response to detecting that a task type parameter of a first task already existing in an online running queue is changed to an offline scheduling type, call an offline scheduling class to migrate the first task to the offline running queue.

[0101] The second task migration module is configured to call the online scheduling class to migrate the second task to the online running queue in response to detecting that the task type parameter of the second task already existing in the offline running queue is changed to the online scheduling type.

[0102] According to an embodiment of the present disclosure, there are multiple task processors. The task scheduling device further includes an online task migration module and an offline task sending module.

[0103] An online task migration module is used to migrate online tasks processed by multiple task processors to a first part of task processors among the multiple task processors for processing in response to detecting that the total remaining resources of multiple task processors meet a second preset condition and the online tasks to be scheduled in the online running queue are empty.

[0104] The offline task sending module is used to send the offline task to the second part of the task processors among the multiple task processors for processing. The second part of the task processors represent the task processors among the multiple task processors whose current remaining resources meet the first preset condition.

[0105] According to an embodiment of the present disclosure, the task scheduling apparatus further includes a kernel startup parameter acquisition module, a shared module, and an exclusive module.

[0106] The kernel startup parameter acquisition module is used to obtain kernel startup parameters related to the task processor.

[0107] The sharing module is configured to determine that the task processor supports processing the online task and the offline task in response to detecting that the kernel startup parameter is a first parameter value indicating that the task processor is shared by the online task and the offline task.

[0108] The exclusive module is configured to determine that the task processor only supports processing the online task in response to detecting that the kernel startup parameter is a second parameter value indicating that the online task exclusively occupies the task processor.

[0109] According to the embodiments of the present invention, any number of modules and units, or at least part of the functions of any number of them, can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules and units can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules and units can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or can be implemented in any one of the three implementation methods of software, hardware and firmware, or in an appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules and units can be at least partially implemented as a computer program module, which can perform the corresponding function when the computer program module is executed.

[0110] For example, any number of the online task scheduling module 410 and the offline task scheduling module 420 can be combined into one module / unit / sub-unit for implementation, or any one of the modules / units / sub-units can be split into multiple modules / units / sub-units. Alternatively, at least part of the functionality of one or more of these modules / units / sub-units can be combined with at least part of the functionality of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present disclosure, at least one of the online task scheduling module 410 and the offline task scheduling module 420 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented in hardware or firmware by any other reasonable means of integrating or packaging circuits, or can be implemented in any one of the three implementation methods of software, hardware, and firmware, or in an appropriate combination of any of them. Alternatively, at least one of the online task scheduling module 410 and the offline task scheduling module 420 may be at least partially implemented as a computer program module, and when the computer program module is executed, the corresponding function may be performed.

[0111] It should be noted that the task scheduling device part in the embodiment of the present disclosure corresponds to the task scheduling method part in the embodiment of the present disclosure. The description of the task scheduling device part specifically refers to the task scheduling method part and will not be repeated here.

[0112] Figure 5 A block diagram of an electronic device suitable for implementing a task scheduling method according to an embodiment of the present disclosure is schematically shown. Figure 5The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.

[0113] like Figure 5 As shown, the electronic device 500 according to an embodiment of the present disclosure includes a processor 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage unit 508 into a random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.

[0114] Various programs and data required for the operation of the electronic device 500 are stored in the RAM 503. The processor 501, ROM 502, and RAM 503 are connected to each other via a bus 504. The processor 501 executes the various operations of the method flow according to the embodiment of the present disclosure by executing the programs in the ROM 502 and / or RAM 503. It should be noted that the programs may also be stored in one or more memories other than the ROM 502 and RAM 503. The processor 501 may also execute the various operations of the method flow according to the embodiment of the present disclosure by executing the programs stored in the one or more memories.

[0115] According to an embodiment of the present disclosure, electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to bus 504. Electronic device 500 may also include one or more of the following components connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including devices such as a cathode ray tube (CRT), liquid crystal display (LCD), and speakers; a storage section 508 including a hard disk; and a communication section 509 including a network interface card such as a LAN card or modem. Communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. Removable media 511, such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed in drive 510 as needed, so that computer programs read from the removable media can be installed into storage section 508 as needed.

[0116] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the processor 501, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.

[0117] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments, or may exist independently and not be incorporated into the device / apparatus / system. The computer-readable storage medium carries one or more programs, and when executed, implements the task scheduling method according to the embodiments of the present disclosure.

[0118] According to embodiments of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples include, but are not limited to, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0119] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 502 and / or the RAM 503 described above and / or one or more memories other than the ROM 502 and the RAM 503 .

[0120] An embodiment of the present disclosure also includes a computer program product, which includes a computer program, which contains program code for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the task scheduling method provided by the embodiment of the present disclosure.

[0121] When the computer program is executed by the processor 501, the above functions defined in the system / device of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0122] In one embodiment, the computer program may be stored on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may be transmitted and distributed in the form of a signal on a network medium, downloaded and installed via the communication portion 509, and / or installed from a removable medium 511. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to wireless, wired, or any suitable combination thereof.

[0123] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C" or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect via the Internet).

[0124] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of the systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or part of the code, which contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the boxes can also occur in an order different from that marked in the accompanying drawings. For example, two boxes shown in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, as well as the combination of boxes in the block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified functions or operations, or can be implemented using a combination of dedicated hardware and computer instructions. It will be understood by those skilled in the art that the features described in the various embodiments of the present disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or coupled in various ways, and all of these combinations and / or couplings fall within the scope of the present disclosure.

[0125] The above describes the embodiments of the present disclosure. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although each embodiment has been described separately above, this does not mean that the measures in each embodiment cannot be advantageously used in combination. Without departing from the scope of the present disclosure, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present disclosure.

Claims

1. A task scheduling method, comprising: In a case where it is determined that the task processor supports processing of online tasks and offline tasks, in response to detecting that there are online tasks to be scheduled in the online run queue and offline tasks to be scheduled in the offline run queue, scheduling the online tasks from the online run queue and sending them to the task processor for processing; In response to detecting that the current remaining resources of the task processor meet a first preset condition and the online tasks to be scheduled in the online running queue are empty, an offline task is scheduled from the offline running queue and sent to the task processor for processing.

2. The method according to claim 1, further comprising: In response to a task being started, obtaining a task type parameter of the task; In the case where the task type parameter represents an online scheduling type, calling the online scheduling class to distribute the task to the online running queue; In the case where the task type parameter represents an offline scheduling type, the offline scheduling class is called to distribute the task to the offline running queue.

3. The method according to claim 2, wherein: In response to the task being started, obtaining the task type parameter of the task includes: In response to task initiation, obtaining task priority information of the task; In a case where the task priority information satisfies a first priority range, determining the task type parameter as the online scheduling type; In a case where the task priority information satisfies a second priority range, the task type parameter is determined to be the offline scheduling type, and the scheduling priority represented by the first priority range is higher than the scheduling priority represented by the second priority range.

4. The method according to claim 2, further comprising: In response to detecting that a task type parameter of a first task already in the online running queue is changed to the offline scheduling type, calling the offline scheduling class to migrate the first task to the offline running queue; In response to detecting that the task type parameter of the second task already in the offline running queue is changed to the online scheduling type, the online scheduling class is called to migrate the second task to the online running queue.

5. The method according to claim 1, wherein There are multiple task processors; The method further comprises: In response to detecting that the total remaining resources of the plurality of task processors meet a second preset condition and the number of online tasks to be scheduled in the online run queue is empty, migrating the online tasks processed by the plurality of task processors to a first portion of the plurality of task processors for processing; The offline task is sent to a second part of the task processors among the plurality of task processors for processing, where the second part of the task processors represent the task processors among the plurality of task processors whose current remaining resources meet the first preset condition.

6. The method according to claim 1, further comprising: Obtaining kernel startup parameters related to the task processor; In response to detecting that the kernel startup parameter is a first parameter value indicating that an online task and an offline task share a task processor, determining that the task processor supports processing the online task and the offline task; In response to detecting that the kernel startup parameter is a second parameter value indicating that the online task exclusively occupies the task processor, it is determined that the task processor only supports processing the online task.

7. A task scheduling device, comprising: an online task scheduling module for, upon determining that the task processor supports processing both online and offline tasks, scheduling the online task from the online running queue and sending it to the task processor for processing in response to detecting that there are online tasks to be scheduled in the online running queue and offline tasks to be scheduled in the offline running queue; The offline task scheduling module is used to schedule offline tasks from the offline running queue and send them to the task processor for processing in response to detecting that the current remaining resources of the task processor meet the first preset condition and the online tasks to be scheduled in the online running queue are empty.

8. An electronic device comprising: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to implement the method according to any one of claims 1 to 6.

10. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.