Task-based resource scheduling method, electronic device, and computer-readable medium

Through the task-based resource scheduling method, the life cycle status and resource occupancy status of the job are dynamically scheduled, which solves the problem of inflexible process-level resource scheduling in the existing technology and realizes dynamic adjustment of system resources and improved stability.

CN120371484BActive Publication Date: 2025-09-19YICI NETCOM (HANGZHOU) TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510864820.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-26
Publication Date
2025-09-19
Estimated Expiration
2045-06-26

AI Technical Summary

Technical Problem

The process-level resource scheduling in the existing technology is not flexible enough and cannot be dynamically adjusted, resulting in static system resource configuration and being unable to adapt to dynamic business changes.

Method used

A task-based resource scheduling method is adopted to insert jobs into the startup queue corresponding to the task unique identifier, user identifier and group identifier. By determining the concurrency upper limit and job priority, the life cycle status and resource occupancy status of the job are dynamically scheduled.

Benefits of technology

It achieves the dynamic adjustment of resource usage according to business conditions, avoids problems such as device overheating, long-term heavy load on CPU and memory, ensures system stability and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371484B_ABST
    Figure CN120371484B_ABST
Patent Text Reader

Abstract

This application discloses a task-based resource scheduling method, electronic device, and computer-readable medium. The method includes inserting to-be-scheduled jobs into a startup queue corresponding to the unique identifier of the task to which they belong, the user identifier to which they belong, and the group identifier to which they belong, in a first-in-first-out order based on their creation time. The method also determines the concurrency upper limit of each startup queue and schedules the jobs that are ranked first in the startup queue and whose number is equal to the concurrency upper limit into a running state. The running jobs in each startup queue are inserted into multiple gear queues based on their job priority and the task priority of their tasks. Different gear queues correspond to different task priority intervals, and the job priority is determined based on the task priority of the task to which the job belongs, the user role to which the job belongs, and the device role to which the job belongs. The method also schedules the lifecycle status and resource occupancy status of jobs in multiple gear queues based on the job priority and a pre-configured task-binding resource policy. This method improves system stability and user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of resource scheduling, and in particular, to a task-based resource scheduling method, electronic device, and computer-readable medium. Background Art

[0002] Control groups (cgroups) are a mechanism provided by the Linux kernel that enable process-level resource restrictions, including central processing unit (CPU) core binding, CPU usage limits, and memory caps. Currently, this mechanism is commonly used to implement static configuration of system resources. For example, it pre-configures the resources used by each process and limits the resources used by the process during runtime.

[0003] However, process-level resource scheduling has serious drawbacks such as lack of flexibility and inability to adjust dynamically, so a new resource scheduling method is urgently needed. Summary of the Invention

[0004] The present application aims to solve one of the technical problems in the related art to a certain extent. To this end, the present application provides a task-based resource scheduling method, an electronic device, and a computer-readable medium.

[0005] As a first aspect of the present application, a task-based resource scheduling method is provided, wherein the method comprises:

[0006] Insert the jobs to be scheduled into the start queue corresponding to their unique task ID, user ID, and group ID according to their creation time.

[0007] Determine the concurrency upper limit of each of the startup queues, and for any job that is ranked first in the startup queue and whose number is equal to the concurrency upper limit, schedule its lifecycle state to the running state;

[0008] Inserting the running jobs in each of the startup queues into a plurality of gear queues according to the job priority and the task priority of the task to which it belongs; wherein different gear queues correspond to different task priority intervals, and the job priority is determined according to the task priority of the task to which the job belongs, the user role to which the job belongs, and the device role to which it belongs;

[0009] The life cycle status and resource occupancy status of the jobs in the plurality of gear queues are scheduled according to the job priority and a pre-configured task binding resource policy.

[0010] Optionally, scheduling the lifecycle status and resource occupancy status of jobs in the plurality of gear queues according to job priorities and a pre-configured task binding resource policy includes:

[0011] Determining a first job, a second job, and a third job from the multiple gear queues; wherein the first job includes a job with the highest job priority in the multiple gear queues that is not in a running state, the second job includes other jobs in the gear queue where the first job is located that have a lower job priority than the first job and are in a running state, and the third job includes jobs in other gear queues other than the gear queue where the first job is located that are in a running state;

[0012] Scheduling the lifecycle state of the first job to a running state, and allocating resources to the first job according to a pre-configured task binding resource policy;

[0013] reallocating resources to the second job so that the resources actually occupied by the second job are less than the resources allocated to the second job by the task binding resource policy;

[0014] The lifecycle state of the third job is scheduled to be a pause state, and the resources occupied by the third job are released.

[0015] Optionally, the job is created based on a base class of the task to which it belongs, and determining the concurrency upper limit of each startup queue includes:

[0016] For any of the startup queues, obtain the base class of the task to which the job in the startup queue belongs;

[0017] Based on the obtained basic class of the task, read the job concurrency limit as the concurrency limit of the startup queue.

[0018] Optionally, the basic class definition of a task includes a task name, a task unique identifier, a static priority, a task type, an upper limit on jobs that can be created, an upper limit on batch processing within a job, and an upper limit on job concurrency.

[0019] Optionally, the basic class definition of the job includes the job unique identifier, creation time, user role, device role, user identifier, group identifier, dynamic priority, life cycle status, and functional task execution parameters.

[0020] Optionally, inserting the running jobs in each of the startup queues into a plurality of gear queues according to the job priority and the task priority of the task to which it belongs includes:

[0021] For any job in the running state in each of the start queues, determine a target gear queue for it from the multiple gear queues according to the task priority of the task to which the job belongs;

[0022] Sort the jobs by priority from high to low and insert the job into the target gear queue.

[0023] Optionally, the plurality of gear queues include a first gear queue, a second gear queue, a third gear queue and a fourth gear queue;

[0024] The types of tasks to which the jobs in the first gear queue belong include tasks that affect system stability, the types of tasks to which the jobs in the second gear queue belong include user real-time tasks, the types of tasks to which the jobs in the third gear queue belong include user non-real-time tasks, and the types of tasks to which the jobs in the fourth gear queue belong include ordinary tasks;

[0025] The task priority intervals corresponding to the first gear queue, the second gear queue, the third gear queue and the fourth gear queue decrease in sequence.

[0026] Optionally, the method further includes:

[0027] In a case where there is no preset keep-alive operation in the plurality of gear queues and the time exceeds a preset time threshold, a sleep operation or a shutdown operation is performed.

[0028] As a second aspect of the present application, an electronic device is provided, wherein the electronic device includes:

[0029] one or more processors;

[0030] A memory having one or more computer programs stored thereon, wherein when the one or more computer programs are executed by the one or more processors, the one or more processors implement the task-based resource scheduling method described in the first aspect of the present application.

[0031] As a third aspect of the present application, a computer-readable medium is provided, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the task-based resource scheduling method described in the first aspect of the present application is implemented.

[0032] The task-based resource scheduling method provided in the embodiment of the present application creates jobs based on tasks. Instead of using processes as the basic scheduling granularity for resources, it uses jobs as the basic scheduling granularity for resources. The job priority is determined by the task priority, the user role to which it belongs, and the device role to which it belongs. Combined with the resources bound to the task, the job lifecycle status and resource occupancy status are uniformly scheduled. This method can dynamically adjust resource occupancy based on business needs, avoiding system instability caused by device overheating, long-term heavy CPU and memory loads, etc., thereby ensuring system stability and further improving user experience. It ensures the response speed of users during real-time operations, reasonably arranges the execution time of heavy-load tasks, and reserves necessary system resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The present application will be further described below with reference to the accompanying drawings:

[0034] Figure 1 This is a flowchart of an implementation of a task-based resource scheduling method provided in an embodiment of the present application;

[0035] Figure 2 This is a diagram of the role of the task life cycle provided by the embodiment of the present application;

[0036] Figure 3 This is a schematic diagram of organizing operations in a single chain form provided by an embodiment of the present application;

[0037] Figure 4 This is a flowchart of another implementation of the resource scheduling method provided in the embodiment of the present application;

[0038] Figure 5 This is a schematic diagram of a job lifecycle state machine provided in an embodiment of the present application;

[0039] Figure 6 This is a flowchart of another implementation of the resource scheduling method provided in the embodiment of the present application;

[0040] Figure 7 This is a flowchart of another implementation of the resource scheduling method provided in an embodiment of the present application;

[0041] Figure 8 This is a flowchart of another implementation of the resource scheduling method provided in the embodiment of the present application;

[0042] Figure 9 This is a module diagram of an implementation of an electronic device provided in an embodiment of the present application;

[0043] Figure 10 This is a module diagram of the computer-readable medium provided in an embodiment of the present application.

[0044] Description of Reference Numerals

[0045] 101: Processor 102: Memory

[0046] 103: I / O interface 104: bus. DETAILED DESCRIPTION

[0047] The embodiments of the present application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described in the embodiments are intended to be used to explain the present application and are not to be construed as limiting the present application.

[0048] References in this specification to "one embodiment," "an example," or "an example" mean that a particular feature, structure, or characteristic described in connection with the embodiment itself can be included in at least one embodiment disclosed herein. The appearances of the phrase "in one embodiment" in various places in the specification are not necessarily all referring to the same embodiment.

[0049] Currently, process-level resource scheduling has the serious drawbacks of being inflexible and unable to be dynamically adjusted. For example, a business only requires process A to be processed at full speed and does not require other business processes to run. However, in this case, the business process is required to actively identify and shut down other business processes, which violates the design concept of decoupling the system and business.

[0050] To address this issue, the inventors of this application propose designing a task-based resource scheduling approach that transforms all asynchronous work in systems or businesses into tasks. These tasks are time-consuming, resource-intensive, and require no immediate response but high completion quality. Each task is associated with specific resources, such as the CPU (central processing unit) clock speed, memory clock speed, and network bandwidth. By creating jobs based on tasks, the basic resource scheduling granularity is no longer based on processes, but rather on jobs. The priority of a job is determined by its priority, the user role it belongs to, and the device role it belongs to. Combined with the resources bound to the task, the job's lifecycle status and resource usage status are uniformly scheduled.

[0051] Accordingly, as a first aspect of the embodiment of the present application, a task-based resource scheduling method is provided, such as Figure 1 As shown, the method may include:

[0052] Step S110: insert the jobs to be scheduled into the start queue corresponding to their unique task identifiers, user identifiers, and group identifiers according to their creation time in a first-in-first-out order.

[0053] Step S120: determining the concurrency upper limit of each of the startup queues, and scheduling the lifecycle state of the jobs that are ranked first in any of the startup queues and whose number is equal to the concurrency upper limit to the running state;

[0054] Step S130: inserting the running jobs in each of the startup queues into a plurality of gear queues according to the job priority and the task priority of the task to which it belongs; wherein different gear queues correspond to different task priority intervals, and the job priority is determined according to the task priority of the task to which the job belongs, the user role to which the job belongs, and the device role to which the job belongs;

[0055] Step S140 : scheduling the lifecycle states and resource occupancy states of the jobs in the plurality of gear queues according to the job priorities and the pre-configured task binding resource policy.

[0056] First, it should be noted that in this embodiment, a task refers to a statically defined service capability, such as a "download to local device" task. A job refers to an instantiation of a task, such as creating a "download to local device" job. To minimize the number of jobs and take into account embedded resource constraints, tasks are designed as batch processing. This means that a job can contain N task processing items. For example, a job to download 10 files contains 10 download file tasks.

[0057] like Figure 2 As shown, in the embodiment of the present application, the life cycle of a task involves four roles: task submitter, task scheduler, task executor and task progress queryer. The task submitter manages the creation, query, update, pause, continue and stop of jobs; the task scheduler does not care about the business to which the job belongs, and within limited resources, it schedules all jobs reasonably with the job as the granularity to achieve the best results; the task executor is the real executor of the job, and is responsible for the execution of the job while the job is in the running state, and regularly feeds back the job progress to the task scheduler. A task can have multiple task executors; the task progress queryer can query the progress and status information of any job. Among them, the task executor needs to support the following capabilities: 1. Support the creation, pause, continue and stop of a single job; 2. There is no need to persist the job progress within the service. The service actively obtains the running job from the task scheduler every time it starts; 3. Supports regular reporting of job progress to the task scheduler. The job progress contains detailed information about the currently executed job.

[0058] In this embodiment of the present application, a "job to be scheduled" refers to a newly created job. Step S110 indicates that all jobs with the same task, the same user, and the same group will be organized into a startup queue in a single chain, following the first-in-first-out principle based on creation time. Accordingly, after determining the concurrency limit for a particular startup queue, the jobs with the highest concurrency limit at the top of the queue will be scheduled to the running state, while the remaining jobs can be scheduled to the ready state.

[0059] For example, if Figure 3 As shown in the figure, all jobs (job1, job2, job3, and job4) for the same task, the same user, and the same group are organized in a single chain. Assuming the concurrency limit is 3, only the first three jobs (job1, job2, and job3) will be scheduled to the running state at any one time, while the last job (job4) will be scheduled to the ready state. This avoids wasted resources.

[0060] In the embodiment of the present application, all running jobs in each startup queue are inserted into the gear queue. At this time, the task priority of the job determines which gear queue the job is inserted into, and the job priority of the job determines the position of the job in the gear queue.

[0061] In an embodiment of the present application, based on the job priority scheduling strategy and combined with the pre-configured strategy of binding resources in task units, the life cycle status and resource occupancy status of jobs in the gear queue are scheduled, so as to achieve the purpose of dynamic adjustment of resources with business.

[0062] In the embodiment of the present application, there is no specific limitation on how to bind resources in units of tasks. Specifically, it can be considered from the aspects of the impact of tasks on system stability and the real-time requirements of tasks. For example, each task essentially represents a business scenario, such as uploading files, deleting files in batches, AI calculations, etc. From the perspective of resource utilization, the best result is for each business to use just the right resources. For example, the task of uploading files is a real-time operation for users, and the user hopes to complete the upload as soon as possible. At this time, the CPU main frequency can be modulated to the highest and the memory frequency can also be increased to the highest. For another example, for large file transfer tasks, the network bandwidth can be debugged to be large enough to optimize the upload performance. For another example, for batch file deletion tasks, the focus of this task is that the deletion can be executed completely, and the timeliness requirement is not so high. Therefore, in a system with strict power consumption control, the main frequency can be adjusted to the lowest to reduce power consumption and prevent heat.

[0063] The task-based resource scheduling method provided in the embodiment of the present application creates jobs based on tasks. Instead of using processes as the basic scheduling granularity for resources, it uses jobs as the basic scheduling granularity for resources. The job priority is determined by the task priority, the user role to which it belongs, and the device role to which it belongs. Combined with the resources bound to the task, the job lifecycle status and resource occupancy status are uniformly scheduled. This method can dynamically adjust resource occupancy based on business needs, avoiding system instability caused by device overheating, long-term heavy CPU and memory loads, etc., thereby ensuring system stability and further improving user experience. It ensures the response speed of users during real-time operations, reasonably arranges the execution time of heavy-load tasks, and reserves necessary system resources.

[0064] The applicant of this application further proposes that when a task is running at the highest task priority, all other running tasks are suspended and the resources occupied by these tasks are released. When the job priorities of multiple jobs belonging to the same task are different, the high-priority job suppresses the running of the low-priority job. Accordingly, in some embodiments, such as Figure 4 As shown, the scheduling of the lifecycle status and resource occupancy status of the jobs in the plurality of gear queues according to the job priority and the pre-configured task binding resource policy (i.e., step S140) may include:

[0065] Step S210: Determine a first job, a second job, and a third job from the multiple gear queues; wherein the first job includes a job with the highest job priority in the multiple gear queues that is not in a running state; the second job includes other jobs in the gear queue where the first job is located that have a lower job priority than the first job and are in a running state; and the third job includes jobs in the gear queue other than the gear queue where the first job is located that are in a running state.

[0066] Step S220: Schedule the lifecycle state of the first job to the running state, and allocate resources to the first job according to a pre-configured task binding resource policy;

[0067] Step S230: reallocate resources to the second job so that the resources actually occupied by the second job are less than the resources allocated to the second job by the task binding resource policy;

[0068] Step S240: Schedule the lifecycle state of the third job to a pause state, and release the resources occupied by the third job.

[0069] In the embodiment of the present application, there is no special limitation on the execution order between the above steps S210-S240. It can be seen that step S210 and steps S220-S240 can be executed simultaneously or successively, and steps S220, S230, and S240 can be executed simultaneously or successively.

[0070] like Figure 5 As shown, in this embodiment of the present application, the lifecycle states of a job can include running, pause, ready, and completion. Essentially, the job lifecycle states are switched based on the job priority, task priority, and job execution status.

[0071] In the embodiment of the present application, by executing steps S220 and S240, jobs in the gear queue with high task priority are executed first, that is, high-priority tasks are executed before low-priority tasks. By executing steps S220 and S230, jobs with high task priority in the same gear queue are executed first, that is, high-priority jobs in the same gear queue suppress the execution of low-priority jobs. This allows resources to be dynamically adjusted according to business needs.

[0072] The applicant of this application further proposes to define the upper limit of job concurrency in the basic class of the task. Accordingly, in some embodiments, the job is created based on the basic class of the task to which it belongs, such as Figure 6 As shown, determining the concurrency upper limit of each of the start queues (ie, involved in step S120) may include:

[0073] Step S310: For any of the startup queues, obtain the base class of the task to which the job in the startup queue belongs;

[0074] Step S320 , based on the obtained basic class of the task, read the upper limit of job concurrency as the upper limit of concurrency of the startup queue.

[0075] In addition to defining the upper limit of job concurrency, the basic class of a task can also define other information. Accordingly, in some embodiments, the basic class of a task defines the task name, the task unique identifier, the static priority, the task type, the upper limit of jobs that can be created, the upper limit of batch processing within a job, and the upper limit of job concurrency.

[0076] For example, the basic Task class can define the following:

[0077] type Task struct {

[0078] Name / / Task name

[0079] TaskID / / Unique ID (to distinguish different tasks)

[0080] Priority / / Static priority

[0081] Mode / / Task type (defines the execution mode of the job, such as batch / real-time)

[0082] CreateThr / / The maximum number of jobs that can be created (limiting the maximum number of jobs generated under this task)

[0083] OptThr / / The batch limit within a job (the maximum number of sub-items a single job can contain)

[0084] ConcurrencyThr / / Job concurrency limit (the maximum number of jobs under this task that can run simultaneously)}

[0085] Similarly, job priority can be identified based on the job's base class. Accordingly, in some embodiments, the job's base class definition includes the job's unique identifier, creation time, user role, device role, user ID, group ID, dynamic priority, lifecycle status, and functional task execution parameters.

[0086] For example, the base class of a job can define the following:

[0087] type Job struct {

[0088] JobID / / Unique ID (to distinguish different job instances)

[0089] Time / / Creation time (for FIFO sorting)

[0090] UserRole / / User role (for example, used to distinguish different user permissions)

[0091] DeviceRole / / Device role (for example, used to distinguish different device permissions)

[0092] UserID / / User ID (to distinguish different users)

[0093] GroupID / / Group ID (to distinguish different groups)

[0094] Priority / / Dynamic priority

[0095] State / / Lifecycle state (running / ready / pause, etc.)

[0096] Args / / Functional task execution parameters (specific content to be processed by the job, such as a list of downloaded files)}

[0097] In some embodiments, as Figure 7 As shown, the steps of inserting the running jobs in each of the startup queues into the plurality of gear queues (i.e., involved in step S130 ) according to the job priority and the task priority of the task to which it belongs may include:

[0098] Step S410: for any job in the running state in each of the start queues, determine a target gear queue for it from the multiple gear queues according to the task priority of the task to which the job belongs;

[0099] Step S420 , inserting the job into the target gear queue according to the job priority order from high to low.

[0100] In some embodiments, the plurality of gear queues include a first gear queue, a second gear queue, a third gear queue, and a fourth gear queue;

[0101] The types of tasks to which the jobs in the first gear queue belong include tasks that affect system stability, the types of tasks to which the jobs in the second gear queue belong include user real-time tasks, the types of tasks to which the jobs in the third gear queue belong include user non-real-time tasks, and the types of tasks to which the jobs in the fourth gear queue belong include ordinary tasks;

[0102] The task priority intervals corresponding to the first gear queue, the second gear queue, the third gear queue and the fourth gear queue decrease in sequence.

[0103] In the embodiment of the present application, there is no special limitation on how to assign different task priorities to different tasks. For example, the impact of the task on system stability, the real-time requirements of the task, etc. can be considered, and the jobs can be divided into four task priority intervals according to the task type: T0, tasks that affect system stability, such as tasks that may cause CPU overheating and excessive load; T1, user real-time tasks, such as tasks that users upload and download files in real time; T2, user non-real-time tasks, such as tasks such as batch downloading to local and batch deleting files; T3, tasks without special requirements, such as tasks such as video transcoding, AI calculation, automatic backup, etc. The embodiment of the present application does not make any special limitation on how to set the values ​​of the above four task priority intervals. For example, T0, T2, T2, and T2 can be set to [0, 31], [32, 63], [64-95], and [96-127] respectively, with the lower the value, the higher the task priority.

[0104] For example, if there is a "download file from the network to the local machine" task in the current T2 gear queue, the task priority is 65, and its job is in the running state, the job priority is 65 (task priority) + 2 (user role bonus) + 1 (device role bonus) = 68. At this time, there is a "real-time file upload" waiting to be scheduled job, and this waiting to be scheduled job should be in the T1 gear queue. According to the task-based resource scheduling method provided in the embodiment of the present application, the task priority of the T1 gear queue is higher than that of the T2 gear queue. After the "real-time file upload" waiting to be scheduled job is inserted into the T1 gear queue, all jobs of the "download file from the network to the local machine" task should be scheduled to the pause state and the resources they occupy should be released. The "real-time file upload" job should be scheduled to the running state, and resources should be allocated to the "real-time file upload" job according to the pre-configured task binding resource policy. After the file upload is completed, the "real-time file upload" job is in the completed state, and then the "download file from the network to the local machine" task job is re-enabled.

[0105] The applicant of this application further proposes that, in addition to the above-mentioned priority scheduling strategy, other auxiliary strategies can also be adopted, for example, tasks of certain business behaviors can be associated with keep-alive attributes. Figure 8 As shown, the method further includes:

[0106] Step S510 : When there is no preset keep-alive operation in the plurality of gear queues and the time exceeds a preset time threshold, a sleep operation or a shutdown operation is performed.

[0107] Some mobile devices require the system to automatically sleep or shut down when not in use to preserve battery life. Therefore, some tasks can be associated with keep-alive attributes. This allows the system to be shut down or put into sleep mode simply by checking for jobs associated with keep-alive. If no keep-alive jobs exist for a certain period of time (e.g., 30 minutes), the system can be put into sleep or shut down mode.

[0108] As a second aspect of the embodiments of the present application, an electronic device is provided, wherein, Figure 9 As shown, the electronic device includes:

[0109] One or more processors 101;

[0110] The memory 102 stores one or more computer programs. When the one or more computer programs are executed by the one or more processors 101, the one or more processors 101 implement the task-based resource scheduling method provided in the first aspect of the embodiment of the present application.

[0111] The electronic device may further include one or more I / O interfaces 103 connected between the processor 101 and the memory 102 and configured to implement information exchange between the processor 101 and the memory 102 .

[0112] Among them, the processor 101 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 102 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically such as SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), and flash memory (FLASH); the I / O interface (read-write interface) is connected between the processor and the memory, and can realize information exchange between the processor and the memory, including but not limited to a data bus (Bus), etc.

[0113] In some embodiments, the processor 101 , the memory 102 , and the I / O interface 103 are connected to each other via a bus 104 , and further connected to other components of the computing device.

[0114] As a third aspect of the embodiment of this application, Figure 10 As shown, a computer-readable medium is provided, on which a computer program is stored, wherein when the computer program is executed by a processor, the task-based resource scheduling method provided in the first aspect of the embodiment of the present application is implemented.

[0115] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program. Accordingly, the computer program can be stored in a non-volatile computer-readable storage medium, and when the computer program is executed, it can implement the method of any of the above-mentioned embodiments. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the embodiments of the present application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0116] The above are only specific embodiments of the present application, but the scope of protection of the present application is not limited thereto. Those skilled in the art should understand that the present application includes but is not limited to the contents described in the drawings and the above specific embodiments. Any modifications that do not deviate from the functional and structural principles of the present application are included within the scope of the claims.

Claims

1. A task-based resource scheduling method, characterized in that: The method comprises: Insert the jobs to be scheduled into the start queue corresponding to their unique task ID, user ID, and group ID according to their creation time. Determine the concurrency upper limit of each of the startup queues, and for any job that is ranked first in the startup queue and whose number is equal to the concurrency upper limit, schedule its lifecycle state to the running state; Inserting the running jobs in each of the startup queues into a plurality of gear queues according to the job priority and the task priority of the task to which it belongs; wherein different gear queues correspond to different task priority intervals, and the job priority is determined according to the task priority of the task to which the job belongs, the user role to which the job belongs, and the device role to which it belongs; Scheduling the lifecycle status and resource occupancy status of jobs in the plurality of gear queues according to job priorities and pre-configured task binding resource policies; The scheduling of the lifecycle status and resource occupancy status of the jobs in the plurality of gear queues according to the job priority and the pre-configured task binding resource strategy includes: Determining a first job, a second job, and a third job from the multiple gear queues; wherein the first job includes a job with the highest job priority in the multiple gear queues that is not in a running state, the second job includes other jobs in the gear queue where the first job is located that have a lower job priority than the first job and are in a running state, and the third job includes jobs in other gear queues other than the gear queue where the first job is located that are in a running state; Scheduling the lifecycle state of the first job to a running state, and allocating resources to the first job according to a pre-configured task binding resource policy; reallocating resources to the second job so that the resources actually occupied by the second job are less than the resources allocated to the second job by the task binding resource policy; The lifecycle state of the third job is scheduled to be a pause state, and the resources occupied by the third job are released.

2. The method according to claim 1, characterized in that The job is created based on the base class of the task to which it belongs, and determining the concurrency upper limit of each startup queue includes: For any of the startup queues, obtain the base class of the task to which the job in the startup queue belongs; Based on the obtained basic class of the task, read the job concurrency limit as the concurrency limit of the startup queue.

3. The method according to claim 2, characterized in that The basic class definition of a task includes the task name, task unique identifier, static priority, task type, upper limit of jobs that can be created, upper limit of batch processing within a job, and upper limit of job concurrency.

4. The method according to claim 2, characterized in that The basic class definition of a job includes the job's unique identifier, creation time, user role, device role, user ID, group ID, dynamic priority, lifecycle status, and functional task execution parameters.

5. The method according to claim 1, wherein The step of inserting the running jobs in each of the startup queues into the plurality of gear queues according to the job priority and the task priority of the task to which it belongs includes: For any job in the running state in each of the start queues, determine a target gear queue for it from the multiple gear queues according to the task priority of the task to which the job belongs; Sort the jobs by priority from high to low and insert the job into the target gear queue.

6. The method according to any one of claims 1 to 5, characterized in that The plurality of gear queues include a first gear queue, a second gear queue, a third gear queue and a fourth gear queue; The types of tasks to which the jobs in the first gear queue belong include tasks that affect system stability, the types of tasks to which the jobs in the second gear queue belong include user real-time tasks, the types of tasks to which the jobs in the third gear queue belong include user non-real-time tasks, and the types of tasks to which the jobs in the fourth gear queue belong include ordinary tasks; The task priority intervals corresponding to the first gear queue, the second gear queue, the third gear queue and the fourth gear queue decrease in sequence.

7. The method according to any one of claims 1 to 5, characterized in that The method further comprises: In a case where there is no preset keep-alive operation in the plurality of gear queues and the time exceeds a preset time threshold, a sleep operation or a shutdown operation is performed.

8. An electronic device, characterized in that: The electronic device comprises: one or more processors; A memory having one or more computer programs stored thereon, wherein when the one or more computer programs are executed by the one or more processors, the one or more processors implement the task-based resource scheduling method according to any one of claims 1-7.

9. A computer-readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the task-based resource scheduling method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Cluster data duplication method and device and priority determining method and device

    CN107291724A

  • Cluster job scheduling method and device, equipment and storage medium

    CN112965820A

  • Job scheduling method, apparatus and device, and medium

    CN117873685A

  • Multi-machine resource configuration management method, device, equipment, medium and product

    CN119440766A