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

Through task-based resource scheduling methods, dynamically adjust the life cycle and resource occupation status of jobs, solving the problem of inflexible process-level scheduling and improving system stability and user experience.

CN120371484AActive Publication Date: 2025-07-25YICI NETCOM (HANGZHOU) TECH CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

In the prior art, process-level resource scheduling has problems such as inflexible enough and dynamic adjustment, resulting in system instability and degradation of user experience.

Method used

The task-based resource scheduling method is adopted to insert the job into the startup queue, insert the staging queue according to the job priority and task priority, and schedule it in combination with the task binding resource strategy to dynamically adjust the resource occupation status.

Benefits of technology

It has achieved improvement in system stability, ensured user experience, reasonably arranged the execution time of large-load tasks, avoided unstable problems caused by equipment overheating and long-term large loads, and improved response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371484A_ABST
    Figure CN120371484A_ABST
Patent Text Reader

Abstract

The invention discloses a task-based resource scheduling method, electronic equipment and a computer readable medium. The method comprises the following steps: inserting a to-be-scheduled job into a starting queue corresponding to a task unique identifier, a user identifier and a group identifier which the to-be-scheduled job belongs to according to creation time first-in first-out; determining a concurrence upper limit of each starting queue, and scheduling jobs which are ranked in the front in the starting queues and have the number of the concurrence upper limit to be in a running state; inserting jobs in a running state in the starting queues into a plurality of gear queues according to job priorities and task priorities of the tasks to which the jobs belong; different gear queues correspond to different task priority intervals, and the job priority is determined according to a task priority of a task to which the job belongs, a user role to which the job belongs and a device role to which the job belongs; and scheduling life cycle states and resource occupation states of the jobs in the plurality of gear queues according to the job priorities and a pre-configured task binding resource strategy. And the system stability and the user experience are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of resource scheduling. Specifically, it relates to a task-based resource scheduling method, an electronic device, and a computer-readable medium. Background Art

[0002] Control groups (abbreviated as cgroup) is a mechanism provided by the Linux kernel that can provide resource limiting capabilities at the process level, including CPU core binding, CPU occupancy rate limitation, memory upper limit limitation, etc. Currently, this mechanism is usually used to implement static configuration of system resources. For example, the resources occupied by each process are pre-configured to limit the resources occupied during the operation of the process.

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

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

[0005] As the first aspect of this application, a task-based resource scheduling method is provided. The method includes: Insert the jobs to be scheduled into the start queue corresponding to their unique task identifier, user identifier, and group identifier in the order of creation time first in, first out; Determine the concurrency upper limit of each start queue. For the jobs sorted in the front and with the number equal to the concurrency upper limit in any start queue, schedule their life cycle status to the running state; Insert the jobs in the running state in each start queue into multiple gear queues according to the job priority and the task priority of the task to which they belong; among them, 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; Schedule the life cycle status and resource occupancy status of the jobs in the multiple gear queues according to the job priority and the pre-configured task binding resource policy.

[0006] Optionally, the scheduling of the life cycle status and resource occupancy status of the jobs in the multiple gear queues according to the job priority and the pre-configured task binding resource policy includes: From the multiple gear queues, determine a first job, a second job, and a third job; wherein, the first job includes the job with the highest job priority in the multiple gear queues that is not in the running state, the second job includes other jobs in the gear queue where the first job is located that are in the running state and have a job priority lower than that of the first job, and the third job includes jobs in the running state in other gear queues except the gear queue where the first job is located; Schedule the life cycle state of the first job to the running state, and allocate resources to the first job according to the pre-configured task binding resource policy; Re-allocate resources for 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; Schedule the life cycle state of the third job to the suspended state and release the resources occupied by the third job.

[0007] Optionally, the job is created based on the base class of its affiliated task, and determining the concurrency upper limit of each of the startup queues includes: For any one of the startup queues, obtain the base class of the task to which the job in the startup queue belongs; According to the obtained base class of the affiliated task, read the job concurrency upper limit as the concurrency upper limit of the startup queue.

[0008] Optionally, the base class of the task defines a task name, a task unique identifier, a static priority, a task type, an upper limit on the number of jobs that can be created, an upper limit on batch processing within a job, and a job concurrency upper limit.

[0009] Optionally, the base class of the job defines a job unique identifier, a creation time, an affiliated user role, an affiliated device role, an affiliated user identifier, an affiliated group identifier, a dynamic priority, a life cycle state, and functional task execution parameters.

[0010] Optionally, inserting the jobs in the running state in each of the startup queues into multiple gear queues according to the job priority and the task priority of the affiliated task includes: For any job in the running state in each of the startup 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; Insert the job into the target gear queue in descending order of job priority.

[0011] Optionally, the multiple 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 affecting 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.

[0012] Optionally, the method further includes: When the time when there is no preset keep-alive job in the multiple gear queues exceeds a preset duration threshold, perform a sleep operation or a shutdown operation.

[0013] As a second aspect of the present application, there is provided an electronic device, where the electronic device includes: One or more processors; A memory, on which one or more computer programs are stored. 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.

[0014] As a third aspect of the present application, there is provided a computer-readable medium, 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.

[0015] The task-based resource scheduling method provided by the embodiments of the present application creates jobs based on tasks. Instead of using processes as the basic scheduling granularity of resources, it uses jobs as the basic scheduling granularity of 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. Combining the resources bound to the tasks, it uniformly schedules the life cycle state and resource occupancy state of the jobs. It can dynamically adjust resource occupancy according to services, avoid system instability problems caused by overheating of the device, long-term high loads of the CPU and memory, etc., thereby ensuring system stability, further improving the user experience, ensuring the response speed during real-time user operations, reasonably arranging the execution time of large-load tasks, and reserving necessary system resources, etc. Description of the Drawings

[0016] The following further describes the present application with reference to the drawings: Figure 1 It is a flowchart of an implementation manner of the task-based resource scheduling method provided by the embodiments of the present application; Figure 2 It is a schematic diagram of the task life cycle role provided by the embodiments of the present application; Figure 3 It is a schematic diagram of organizing operations in a single-chain form provided by an embodiment of the present application; Figure 4 It is a flowchart of another implementation manner of the resource scheduling method provided by an embodiment of the present application; Figure 5 It is a schematic diagram of a job life cycle state machine provided by an embodiment of the present application; Figure 6 It is a flowchart of yet another implementation manner of the resource scheduling method provided by an embodiment of the present application; Figure 7 It is a flowchart of another implementation manner of the resource scheduling method provided by an embodiment of the present application; Figure 8 It is a flowchart of another implementation manner of the resource scheduling method provided by an embodiment of the present application; Figure 9 It is a schematic diagram of a module of an implementation manner of an electronic device provided by an embodiment of the present application; Figure 10 It is a schematic diagram of a module of a computer-readable medium provided by an embodiment of the present application.

[0017] Description of the reference numerals 101: Processor 102: Memory 103: I / O interface 104: Bus. Detailed implementation manners

[0018] The embodiments of the present application will be described in detail below. The examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals denote the same or similar elements or elements with the same or similar functions from beginning to end. Based on the embodiments in the implementation manners, it is intended to explain the present application and should not be construed as a limitation to the present application.

[0019] As used herein, the phrase "in one embodiment" or "example" or "instance" means that a particular feature, structure, or characteristic described in connection with the embodiment itself may be included in at least one embodiment of the present disclosure. The appearances of the phrase "in one embodiment" in various places in the specification do not necessarily refer to the same embodiment.

[0020] Currently, resource scheduling at the process level has serious drawbacks of being inflexible and unable to be dynamically adjusted. For example, a service only requires process A to process at full speed and does not require the processes of other services to run. However, in this case, the processes of the service need to actively identify and close the processes of other services, which violates the design concept of decoupling the system and the service.

[0021] In response, the inventors of the present application propose to design a task-based resource scheduling method, which taskifies all asynchronous work of systems or services, obtaining asynchronous tasks that are time-consuming, resource-intensive, have no requirement for timely response but have requirements for completion quality. Each task is associated with certain resources, such as the main frequency of the Central Processing Unit (CPU), the main frequency of the memory, the network bandwidth, etc. Jobs are created based on tasks, and instead of using processes as the basic scheduling granularity of resources, jobs are used as the basic scheduling granularity of 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, and the life cycle state and resource occupancy state of the job are uniformly scheduled in combination with the resources bound to the task.

[0022] Correspondingly, as the first aspect of the embodiment of the present application, a task-based resource scheduling method is provided. As Figure 1 shown, the method may include: Step S110: Insert the job to be scheduled into the start queue corresponding to its unique task identifier, user identifier, and group identifier in the order of creation time first in, first out. Step S120: Determine the concurrency upper limit of each start queue. For the jobs that are sorted in the front and have a quantity equal to the concurrency upper limit in any start queue, schedule their life cycle states to the running state. Step S130: Insert the jobs in the running state in each start queue into multiple gear queues according to the job priority and the task priority of the task to which they belong; among them, 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. Step S140: Schedule the life cycle state and resource occupancy state of the jobs in the multiple gear queues according to the job priority and the pre-configured task binding resource policy.

[0023] First of all, it should be noted that in the embodiment of the present application, a task refers to a statically defined service capability, such as the "download to local" task, and a job refers to an instantiated object of a task, such as creating a "download to local" job. Considering the embedded resource limitations and minimizing the number of jobs as much as possible, tasks are designed as batch processing types, that is, an internal job can contain N task processing items. For example, a job of downloading 10 files contains 10 tasks of downloading files.

[0024] As Figure 2As shown in the figure, in the embodiment of the present application, the life cycle of a task involves 4 roles: task submitter, task scheduler, task executor, and task progress querier. The task submitter manages operations including job creation, query, update, suspension, resume, and stop. The task scheduler does not care about the business to which the job belongs. Within limited resources, it reasonably schedules all jobs at the job granularity to achieve the best effect. The task executor is the actual executor of the job. During the running state of the job, it is responsible for job execution and regularly feeds back the job progress to the task scheduler. A task can have multiple task executors. The task progress querier 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, suspension, resume, and stop of single jobs; 2. There is no need to persist the job progress internally in the service. When the service starts each time, it actively obtains the jobs in the running state from the task scheduler; 3. Support regularly reporting the job progress to the task scheduler. The job progress includes detailed information about the job executed this time.

[0025] In the embodiment of the present application, the job to be scheduled refers to a newly created job. Step S110 means that all jobs with the same task, the same user, and the same group will be organized into a start queue in a single-chain manner following the first-in, first-out principle of creation time after creation. Correspondingly, after determining the concurrency limit of a certain start queue, the top concurrency limit number of jobs sorted in the start queue will be scheduled to the running state, and the remaining jobs can be scheduled to the ready state.

[0026] For example, as Figure 3 shown, all jobs job1, job2, job3, job4 with the same task Task, the same user User, and the same group Group are organized in a single-chain form. Assuming that the concurrency limit is 3 at this time, only the top 3 jobs job1, job2, job3 sorted in the same time will be scheduled to the running state, and the last job job4 will be scheduled to the ready state, so as to avoid ineffective resource waste.

[0027] In the embodiment of the present application, all jobs in the running state in each start 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.

[0028] In the embodiment of the present application, based on the job priority scheduling strategy and combined with the strategy of binding resources in units of tasks configured in advance, the life cycle state and resource occupancy state of the jobs in the gear queue are scheduled, so as to achieve the purpose of dynamically adjusting resources according to the business.

[0029] In the embodiments of the present application, there is no specific limitation on how to bind resources in units of tasks. Specifically, it can be considered from aspects such as 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, batch deleting files, AI computing, etc. From the perspective of resource utilization, the best result is that each service uses just the right amount of resources. For example, the file upload task belongs to the user's real-time operation, and the user hopes to complete the upload as soon as possible. At this time, the CPU main frequency can be adjusted to the highest and the memory frequency can also be increased to the highest. Another example is the large file transfer task, where the network bandwidth can be adjusted to be large enough to optimize the upload performance. Another example is the batch file deletion task. The key point of this task is to ensure that the deletion can be completed, and the requirement for timeliness 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 overheating.

[0030] The task-based resource scheduling method provided by the embodiments of the present application creates jobs based on tasks. Instead of using processes as the basic scheduling granularity of resources, it uses jobs as the basic scheduling granularity of resources. The job priority is determined by the task priority, the user role to which the task belongs, and the device role to which the task belongs. Combining the resources bound to the task, it uniformly schedules the life cycle state and resource occupancy state of the job. It can dynamically adjust resource occupancy according to the service, avoid system instability problems caused by overheating of the device, long-term high loads of the CPU and memory, etc., thereby ensuring system stability, further improving the user experience, ensuring the response speed during the user's real-time operation, reasonably arranging the execution time of large-load tasks, and reserving necessary system resources.

[0031] The applicant of the present 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 inhibits the operation of the low-priority job. Correspondingly, in some embodiments, as Figure 4 shown, scheduling the life cycle state and resource occupancy state of the jobs in the multiple gear queues according to the job priority and the pre-configured task binding resource policy (i.e., step S140) may include: Step S210, determining a first job, a second job, and a third job from the multiple gear queues; wherein, the first job includes the job with the highest job priority in the multiple gear queues and not in the running state, the second job includes other jobs in the gear queue where the first job is located and in the running state with a job priority lower than that of the first job, and the third job includes the jobs in the running state in other gear queues except the gear queue where the first job is located; Step S220, 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; Step S230, 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; Step S240: Schedule the lifecycle state of the third job to a paused state, and release the resources occupied by the third job.

[0032] 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 one after another, and steps S220, S230, and S240 can be executed simultaneously or one after another.

[0033] like Figure 5 As shown, in the embodiment of the present application, the life cycle state of a job may include running state, pause state, ready state, and completion state. Essentially, the life cycle state of a job is switched based on the job priority, task priority, and the execution status of the job.

[0034] In the embodiment of the present application, by executing step S220 and step S240, the jobs in the gear queue with high task priority are executed first, that is, the high priority tasks are executed before the low priority tasks, and by executing step S220 and step S230, the jobs with high job priority in the same gear queue are executed first, that is, the high priority jobs in the same gear queue suppress the execution of the low priority jobs. Thus, resources are adjusted dynamically with the business.

[0035] The applicant of the present 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, the determining of the concurrency upper limit of each of the start queues (ie, involved in step S120) may include: Step S310, for any of the startup queues, obtaining the basic class of the task to which the job in the startup queue belongs; Step S320, according to the acquired basic class of the task, read the upper limit of job concurrency as the upper limit of concurrency of the startup queue.

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

[0037] For example, the following can be defined in the base class of task Task: type Task struct { Name / / Task name TaskID / / Unique ID (to distinguish different tasks) Priority / / Static priority Mode / / Task type (defines the execution mode of the job, such as batch processing / real-time) CreateThr / / Upper limit on the number of jobs that can be created (limits the maximum number of jobs generated under this task) OptThr / / Upper limit on batch processing within a job (the maximum number of sub-items in a single job) ConcurrencyThr / / Upper limit on job concurrency (the maximum number of jobs running simultaneously under this task)}.

[0038] Similarly, job priorities can be identified based on the base class of the job. Correspondingly, in some embodiments, the base class of a job defines a unique job identifier, a creation time, the user role to which it belongs, the device role to which it belongs, the user identifier to which it belongs, the group identifier to which it belongs, a dynamic priority, a lifecycle state, and functional task execution parameters.

[0039] For example, the following can be defined in the base class of job Job: type Job struct { JobID / / Unique ID (to distinguish different job instances) Time / / Creation time (for FIFO sorting) UserRole / / User role to which it belongs (e.g., used to distinguish different user permissions) DeviceRole / / Device role to which it belongs (e.g., used to distinguish different device permissions) UserID / / User ID to which it belongs (to distinguish different users) GroupID / / Group ID to which it belongs (to distinguish different groups) Priority / / Dynamic priority State / / Lifecycle state (running / ready / paused, etc.) Args / / Function task execution parameters (the specific content to be processed by the job, such as the list of downloaded files).

[0040] In some embodiments, as Figure 7 shown, inserting the jobs in the running state in each of the start queues into multiple gear queues according to the job priority and the task priority of the affiliated task (i.e., involved in step S130) may include: 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; Step S420, insert the job into the target gear queue in descending order of job priority.

[0041] In some embodiments, the multiple 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 affecting 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 general 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.

[0042] In the embodiments of the present application, there is no special limitation on how to divide different tasks into different task priorities. For example, it can be considered from aspects such as the impact of the task on system stability and the real-time requirements of the task. According to the task type, the jobs are divided into gear queues in four task priority intervals: T0, tasks affecting system stability, such as tasks that cause the CPU to overheat or have too high a load; T1, user real-time tasks, such as tasks for users to upload files and download files in real time; T2, user non-real-time tasks, such as tasks for batch downloading to the local and batch deleting files; T3, tasks with no particularly clear requirements, such as video transcoding, AI computing, automatic backup, etc. There is also no special limitation on how to set the values of the above four task priority intervals in the embodiments of the present application. For example only, T0, T1, T2, and T3 can be set to [0, 31], [32, 63], [64 - 95], [96 - 127] respectively, with lower values indicating higher task priorities.

[0043] For further illustration, if there is a task of "downloading a file from the network to the local" 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 (bonus for the user role to which it belongs) + 1 (bonus for the device role to which it belongs) = 68. At this time, there is a pending job of "real-time file upload", and this pending job should be in the T1 gear queue. According to the task-based resource scheduling method provided by the embodiments of the present application, the task priority of the T1 gear queue is higher than that of the T2 gear queue. After inserting the pending job of "real-time file upload" into the T1 gear queue, all jobs of the task of "downloading a file from the network to the local" should be scheduled to the suspended state, and the resources they occupy should be released. Also, the job of "real-time file upload" should be scheduled to the running state, and resources should be allocated to the job of "real-time file upload" according to the pre-configured task-bound resource policy. After the file upload is completed, the job of "real-time file upload" is in the completed state, and then the jobs of the task of "downloading a file from the network to the local" are re-enabled.

[0044] The applicant of the present application further proposes that in addition to the above-mentioned scheduling strategy according to priority, other auxiliary strategies can also be adopted. For example, the tasks of some business behaviors can be associated with a keep-alive attribute. Correspondingly, in some embodiments, as Figure 8 shown, the method further includes: Step S510, when the time when there is no preset keep-alive job in the multiple gear queues exceeds a preset duration threshold, perform a sleep operation or a shutdown operation.

[0045] For some mobile devices, it is desired that the system can automatically sleep or shut down when there is no business usage to ensure the battery life. Therefore, the tasks of some business behaviors can be associated with a keep-alive attribute. In this way, as long as it is detected whether there is a job associated with keep-alive in the system, it can be determined whether the system can perform sleep or shutdown. If there is no keep-alive job for more than a certain period of time (for example, 30 minutes), the sleep or shutdown can be performed.

[0046] As the second aspect of the embodiments of the present application, an electronic device is provided. Wherein, as Figure 9 shown, the electronic device includes: One or more processors 101; A memory 102, on which one or more computer programs are stored. 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 by the first aspect of the embodiments of the present application.

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

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

[0049] In some embodiments, the processor 101, the memory 102, and the I / O interface 103 are interconnected through a bus 104 and then connected to other components of the computing device.

[0050] As the third aspect of the embodiments of the present application, as Figure 10 shown, a computer-readable medium is provided, on which a computer program is stored. Among them, when the computer program is executed by a processor, it implements the task-based resource scheduling method provided in the first aspect of the embodiments of the present application.

[0051] Those of ordinary skill in the art can understand that to implement all or part of the processes in the methods of the above embodiments, it can be completed by instructing 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 methods of any of the above embodiments. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided by the present application can include non-volatile and / or volatile memories. The non-volatile memory can include a read-only memory (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory can include a random access memory (RAM) or an 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 (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0052] The above is only the specific implementation manner of the present application, but the protection scope 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 content described in the drawings and the above specific implementation manner. Any modification that does not deviate from the functional and structural principles of the present application will be included in the scope of the claims.

Claims

1. A task-based resource scheduling method, characterized in that, The method includes: Inserting the jobs to be scheduled into the start queue corresponding to their unique task identifiers, user identifiers, and group identifiers in a first-in, first-out order according to the creation time; Determining the concurrency limit of each start queue, and scheduling the life cycle status of the jobs that are sorted in the front and the number of which is the concurrency limit in any start queue to the running state; Inserting the jobs in the running state in each start queue into multiple gear queues according to the job priority and the task priority of the task to which they belong; 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; Scheduling the life cycle status and resource occupancy status of the jobs in the multiple gear queues according to the job priority and the pre-configured task binding resource policy.

2. The method according to claim 1, characterized in that, The scheduling the life cycle status and resource occupancy status of the jobs in the multiple gear queues according to the job priority and the pre-configured task binding resource policy includes: Determining a first job, a second job, and a third job from the multiple gear queues; wherein, the first job includes the job with the highest job priority in the multiple gear queues and not in the running state, the second job includes other jobs in the gear queue where the first job is located and in the running state and with a job priority lower than that of the first job, and the third job includes the jobs in the running state in other gear queues except the gear queue where the first job is located; Scheduling the life cycle status of the first job to the running state, and allocating resources to the first job according to the pre-configured task binding resource policy; Re-allocating resources for 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; Scheduling the life cycle status of the third job to the paused state and releasing the resources occupied by the third job.

3. The method according to claim 1, wherein The job is created based on the base class of its belonging task, and the determining the concurrency limit of each start queue includes: For any start queue, obtaining the base class of the task to which the jobs in this start queue belong; Reading the job concurrency limit according to the obtained base class of the belonging task as the concurrency limit of this start queue.

4. The method according to claim 3, wherein The base class of the task defines the task name, task unique identifier, static priority, task type, maximum number of jobs that can be created, maximum number of in-batch processing in the job, and job concurrency limit.

5. The method according to claim 3, characterized in that, The base class of the job defines the job unique identifier, creation time, user role to which the job belongs, device role to which the job belongs, user identifier to which the job belongs, group identifier to which the job belongs, dynamic priority, life cycle status, and functional task execution parameters.

6. The method according to claim 1, wherein The inserting the jobs in the running state in each start queue into multiple gear queues according to the job priority and the task priority of the task to which they belong includes: For any job in the running state in each start queue, determining 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 in descending order of job priority and insert the job into the target gear queue.

7. The method according to any one of claims 1-6, characterized in that, The multiple 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 affecting 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.

8. The method according to any one of claims 1 to 6, characterized in that, The method further includes: Performing a sleep operation or a shutdown operation when the time when there is no preset keep-alive job in the multiple gear queues exceeds a preset duration threshold.

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

10. A computer-readable medium having a computer program stored thereon, characterized in that, The computer program, when executed by a processor, implements the task-based resource scheduling method according to any one of claims 1-8.

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 and system based on high response ratio, terminal and storage medium

    CN113254179A

  • Job scheduling method, apparatus and device, and medium

    CN117873685A

  • Task scheduling method, system and equipment for multi-stage feedback queue and medium

    CN119179558A

Cited By

  • Storage chip acceleration method and computer readable storage medium

    CN121900976A

  • A memory chip speed-up method and a computer readable storage medium

    CN121900976B