Multi-process scheduling method, device, electronic device and storage medium

Through the round-robin and virtual time sorting of the Completely Fair Scheduler (CFS), the scheduling delay time and weight distribution are dynamically adjusted, which solves the problem that multi-process resource scheduling cannot meet the cluster operation and maintenance management needs and realizes efficient multi-process resource management.

CN116257337BActive Publication Date: 2025-09-26CHINA TELECOM CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211718818.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2025-09-26
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

Existing technologies cannot meet the current cluster's requirements for operation and maintenance management, and cannot effectively schedule multi-process resources.

Method used

The Completely Fair Scheduler (CFS) is used for multi-process scheduling. Through round-robin and virtual time sorting, it ensures that each process is prioritized from small to large according to its running time, dynamically adjusts the scheduling delay time and weight distribution, and realizes fair use of processes.

Benefits of technology

It achieves efficient management of multi-process resources, meets the cluster's management requirements for operation and maintenance, and improves the stability and efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116257337B_ABST
    Figure CN116257337B_ABST
Patent Text Reader

Abstract

This application discloses a multi-process scheduling method, apparatus, electronic device, and storage medium. The method comprises: detecting at least one pending task; using a scheduler to select a ready process from a thread pool according to a predetermined scheduling pattern to execute the pending task; wherein the scheduling pattern controls each process in the thread pool to execute in a cyclical manner according to an allocated execution time, and the execution order of each process in the thread pool is prioritized by the execution time in the previous execution cycle, which serves as the execution order of each process in the next execution cycle. This application solves the technical problem of being unable to meet the current cluster operation and maintenance management requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data clusters, and specifically to a multi-process scheduling method, device, electronic device, and storage medium. Background Art

[0002] In recent years, with the deepening of digital development, the number of operating equipment in various units has gradually increased, 10 to 100 times compared to ten years ago. Even though operation and maintenance has been evolving from manual operation and maintenance to tool operation and maintenance and platform operation and maintenance, it still cannot meet the current cluster's management requirements for operation and maintenance.

[0003] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0004] The embodiments of the present application provide a multi-process scheduling method, device, electronic device, and storage medium to at least solve the technical problem of being unable to meet the current cluster's management requirements for operation and maintenance.

[0005] According to one aspect of an embodiment of the present application, a multi-process scheduling method is provided, including: monitoring at least one task to be executed; using a scheduler to select a ready process from a thread pool according to a predetermined scheduling mode to run the task to be executed: wherein the scheduling mode is to control each process in the thread pool to run in a cyclic rotation according to the allocated running time, and the running order of each process in the thread pool is to prioritize the running time in the previous running round from small to large, as the running order of each process in the next running round.

[0006] Optionally, the scheduler determines the total number of processes in the ready state in the thread pool, and allocates a corresponding running time to each process in the ready state according to a weight ratio.

[0007] Optionally, the scheduler configures the core parameters of each process in the thread pool, wherein the core parameters include at least: scheduling delay time and virtual time, the scheduling delay time is the time interval for each process in the ready state in the thread pool to run at least once in a polling cycle, and the virtual time is used to control the running time of each process in the ready state to be the same.

[0008] Optionally, the scheduling delay time is in a dynamically changing state, wherein when the number of processes in the ready state in the thread pool is less than a fixed value, the scheduling delay time is configured as a fixed default value; when the number of processes in the ready state in the thread pool exceeds a fixed value, each process is controlled to run for at least a minimum granularity time before releasing CPU resources.

[0009] Optionally, the method also includes: each process in the ready state runs according to the corresponding scheduling delay time; based on the running time allocated to each process in the ready state and the scheduling delay time, determining the actual running time of each process; converting the actual running time of each process to obtain the virtual time of each process, wherein the time length of the virtual time of each process is the same.

[0010] Optionally, the method also includes: sorting each process in the thread pool according to virtual time to obtain an initial sorting result; in the process of scheduling each thread according to the scheduling delay time, using the thread pool usage model to count the occupancy of each thread; reordering the threads in the initial sorting result according to the sorting index, and prioritizing the threads in the reordered result whose priorities are in a predetermined order; wherein the sorting index includes at least one of the following: thread occupancy and scheduling delay time.

[0011] Optionally, when there are multiple sorting indices, the priority of each thread is obtained by performing weighted average calculation on each sorting indices of the thread.

[0012] According to another aspect of an embodiment of the present application, a multi-process scheduling device is also provided, including: a monitoring module for monitoring at least one task to be executed; a scheduling module for using a scheduler to select a ready process from a thread pool according to a predetermined scheduling mode to run the task to be executed: wherein the scheduling mode is to control each process in the thread pool to run in a cyclic rotation according to the allocated running time, and the running order of each process in the thread pool is to prioritize the running time in the previous running round from small to large, as the running order of each process in the next running round.

[0013] According to another aspect of an embodiment of the present application, an electronic device is also provided, comprising at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the multi-process scheduling method of the embodiment of the present application.

[0014] According to another aspect of the embodiments of the present application, a non-transitory computer-readable storage medium storing computer instructions is further provided, wherein the computer instructions are used to enable a computer to execute the multi-process scheduling method of the embodiments of the present application.

[0015] In an embodiment of the present application, at least one task to be executed is monitored; a scheduler is used to select a ready process from a thread pool according to a predetermined scheduling mode to run the task to be executed: wherein the scheduling mode is to control each process in the thread pool to run in a cyclic rotation according to the allocated running time, and the running order of each process in the thread pool is to prioritize the running time in the previous running round from small to large, as the running order of each process in the next running round, thereby achieving the technical effect of meeting the current cluster's management requirements for operation and maintenance, and thus solving the technical problem of not being able to meet the current cluster's management requirements for operation and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0017] Figure 1 This is a hardware structure block diagram of a computer terminal (or mobile device) for implementing a multi-process scheduling method according to an embodiment of the present application;

[0018] Figure 2 is a flowchart of a multi-process scheduling method according to an embodiment of the present application;

[0019] Figure 3 is a schematic diagram of a virtual time scheduling according to an embodiment of the present application;

[0020] Figure 4 This is a structural block diagram of a multi-process scheduling device according to an embodiment of the present application. DETAILED DESCRIPTION

[0021] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0023] The Completely Fair Scheduler (CFS) is the manager of the central processing unit (CPU) time. It is mainly responsible for selecting certain ready processes to run. CFS implements ideal and precise multi-tasking CPU scheduling on real hardware. The difference between CFS and other schedulers is that CFS does not have the concept of time slices, but allocates the proportion of CPU usage time. For example, if two processes of the same priority run on one CPU, each process will be allocated 50% of the CPU usage time to achieve fairness.

[0024] In a related technology, by parsing network attack alarm logs, characteristic quantities of alarm events of target alarm types and non-target alarm types are extracted from the network attack alarm logs respectively, and an exponentially weighted moving average control chart algorithm is used to calculate the one-step prediction error and control boundary of all characteristic quantities respectively. Based on the network security situation awareness matrix generated according to the one-step prediction error and control boundary of all characteristic quantities, it is judged whether there is a network security situation anomaly. When it is determined that there is a network security situation anomaly, the abnormal network security situation awareness matrix matching the network security situation awareness matrix in the historical database is sent to the user terminal. This can eliminate the interference of massive low-risk alarms and false alarms, effectively perceive the network security situation and promptly discover network security situation anomalies, further ensuring network security.

[0025] Another related technology integrates network security situation data collected from different monitoring points across all network units to determine a unified data presentation format for each network unit. A convolutional neural network-based feature extraction module, an attention-based personalized customization module, and a fully connected network-based network security situation classification module collaborate to construct and optimize local network security situation awareness methods. A collaborative learning framework is used to enhance the generalization capabilities of network units in feature extraction, and the attention-based personalized customization module is fine-tuned a second time to obtain the final network security situation awareness model. This model can then be used to perform network security situation awareness on any target network unit. However, this method is only applicable to network security situation awareness in large-scale, complex, and heterogeneous network scenarios with both common knowledge and specialized requirements or characteristics.

[0026] However, in the embodiment of the present application, CFS allows each process to run for a period of time and rotate in a round-robin manner, and selects the process with the shortest running time as the next running process, rather than allocating a time slice to each process. CFS calculates how long a process should run based on the total number of all runnable processes, rather than relying on the static priority value (Nice value) to calculate the time slice. In CFS, the Nice value is the weight of the processor running ratio obtained by the process. The larger the Nice value (the lower the priority), the lower the processor usage weight obtained (relative to the process with the default Nice value), and the smaller the Nice value (the higher the priority), the higher the processor usage weight obtained, thereby achieving the technical effect of meeting the current cluster's management requirements for operation and maintenance, and thus solving the technical problem of not being able to meet the current cluster's management requirements for operation and maintenance.

[0027] According to an embodiment of the present application, an embodiment of a multi-process scheduling method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0028] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 This is a hardware structure diagram of a computer terminal (or mobile device) for implementing a multi-process scheduling method according to an embodiment of the present application. Figure 1As shown, the computer terminal 10 (or mobile device 10) may include one or more (illustrated as 102a, 102b, ..., 102n) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0029] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuitry may be a single independent processing module, or may be incorporated in whole or in part into any of the other components of the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuitry serves as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0030] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to a multi-process scheduling method in an embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implementing the above-mentioned multi-process scheduling method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0031] The transmission device 106 is used to receive or send data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of the computer terminal 10. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In one embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0032] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).

[0033] In the above operating environment, the embodiment of the present application provides a multi-process scheduling method, such as Figure 2 As shown, the method includes the following steps:

[0034] Step S202: at least one task to be executed is detected.

[0035] In the above step S202 , the task to be executed may be a program to be run by the CPU, such as opening software, opening a website, etc. This is only an example and is not specifically limited.

[0036] Step S204: Use the scheduler to select a ready process from the thread pool according to a predetermined scheduling mode to run the task to be executed.

[0037] In the above step S204, the scheduler can be a CFS scheduler, and the scheduling mode can be to control each process in the thread pool to run in a cyclic manner according to the allocated running time, and the running order of each process in the thread pool is to sort the priorities from small to large according to the running time in the previous running round, as the running order of each process in the next running round.

[0038] In this embodiment, after detecting at least one task to be executed, the scheduler may select a ready process for the task to be executed from the thread pool according to a predetermined scheduling mode, and use the process to run the task to be executed.

[0039] Optionally, the above scheduler is the manager of CPU time, which is mainly used to select certain ready processes and run the processes. The scheduler does not have the concept of time slices, but allocates the proportion of CPU usage time. For example, if two processes of the same priority run on one CPU, each process will be allocated 50% of the CPU usage time. This is only an example and is not specifically limited.

[0040] It should be noted that the above scheduler can calculate the running time of a certain process based on the total number of all runnable processes, rather than relying on the Nice value to calculate the time slice as in related technologies, thereby achieving the technical effect of meeting the current cluster's management requirements for operation and maintenance.

[0041] Through the above steps S202 to S204, at least one task to be executed is monitored; a scheduler is used to select a ready process from the thread pool according to a predetermined scheduling mode to run the task to be executed; wherein the scheduling mode is to control each process in the thread pool to run in a cyclic rotation according to the allocated running time, and the running order of each process in the thread pool is to prioritize the running time in the previous running round from small to large, as the running order of each process in the next running round, thereby achieving the technical effect of meeting the current cluster's management requirements for operation and maintenance, and thus solving the technical problem of not being able to meet the current cluster's management requirements for operation and maintenance.

[0042] The above method of the embodiment of the present application is further introduced below.

[0043] As an optional embodiment of the present application, the scheduler determines the total number of processes in the ready state in the thread pool, and allocates corresponding running time to each process in the ready state according to a weight ratio.

[0044] In this embodiment, the scheduler may calculate the corresponding running time of each process in the ready state according to the weight ratio based on the total number of all processes in the ready state, wherein the weight and the Nice value may correspond one to one.

[0045] Optionally, the Nice value can be a specific number in the range of [-20, 19]. A larger Nice value indicates a lower process priority, indicating a lower processor usage weight obtained by the process. A smaller Nice value indicates a higher process priority, indicating a higher processor usage weight obtained by the process.

[0046] Optionally, nice values ​​and weights can be converted to each other. The conversion formula can be as follows:

[0047] Weight = 1024 / 1.25 Nice

[0048] In the above formula, the value of 1.25 is based on the assumption that a process receives 10% more CPU time for each Nice value reduction. This formula is based on a weight of 1024. A weight of 1024 corresponds to a Nice value of 0, which is referred to as NICE_0_LOAD. Note that by default, most processes have a weight of NICE_0_LOAD.

[0049] Optionally, after introducing weights, the time calculation formula allocated to a process can be as follows:

[0050] Time allocated to a process = total CPU time * process weight / sum of the weights of all processes in the ready queue (Runqueue).

[0051] For example, there are two processes A and B. The weight of process A is 1024 and the weight of process B is 2048. Then the proportion of CPU time obtained by process A is 1024 / (1024+2048)=33.3%, and the proportion of CPU time obtained by process B is 2048 / (1024+2048)=66.7%. The higher the weight, the greater the proportion of allocated time, which is equivalent to a higher priority.

[0052] As an optional embodiment of the present application, the scheduler configures the core parameters of each process in the thread pool.

[0053] In this embodiment, the goal of the scheduler is to ensure completely fair scheduling of each process. The core parameters of each process in the thread pool configured by the scheduler may include at least: scheduling delay time and virtual time. The scheduling delay time can be the time interval for each process in the ready state in the thread pool to run at least once in a training cycle. The virtual time can be used to control the running time of each process in the ready state to be the same.

[0054] As an optional embodiment of the present application, the scheduling delay time is in a dynamically changing state.

[0055] In this embodiment, the scheduling delay time of the scheduler is not fixed, that is, the scheduling delay time is in a dynamically changing state. When the number of processes in the ready state in the thread pool is less than a fixed value, the scheduling delay time is configured as a fixed default value; when the number of processes in the ready state in the thread pool exceeds a fixed value, each process is controlled to run for at least the minimum granularity time before releasing CPU resources.

[0056] For example, if each process runs for 10ms and there are 2 processes in the system, the scheduling delay time is 20ms; if there are 5 processes in the system, the scheduling delay time is 50ms; if the scheduling delay time is guaranteed to remain unchanged and is fixed at 6ms, if there are 2 processes in the system, each process runs for 3ms; if there are 6 processes, each process runs for 1ms: if there are 100 processes, the time allocated to each process is 0.06ms, that is, as the number of processes increases, the time allocated to each process decreases, and the process scheduling is too frequent, and the time overhead of context switching will become larger.

[0057] It should be noted that, in the default setting of the scheduler, the minimum granularity time may be 0.75 ms, which may be recorded using a variable (eg, Sysctlsched_Min_Granularity).

[0058] As an optional embodiment of the present application, the method also includes: each process in the ready state runs according to the corresponding scheduling delay time; based on the running time and scheduling delay time allocated to each process in the ready state, determining the actual running time of each process; converting the actual running time of each process to obtain the virtual time of each process.

[0059] In this embodiment, in order to ensure that the running time of each process is equal, the scheduler introduces virtual time. Each process in the ready state runs according to the corresponding scheduling delay time, and the actual running time of each process can be determined based on the running time and scheduling delay time allocated to each process in the ready state. The actual running time of each process is then converted to obtain the virtual time of each process, wherein the time length of the virtual time of each process is the same.

[0060] Optionally, the conversion formula between virtual time and real time can be as follows:

[0061] Virtual time = actual time * (NICE_0_LOAD / weight).

[0062] For example, if the scheduling period is 6ms and there are two processes A and B with the same priority in the system, then each process runs for 3ms within 6ms. If the weights of processes A and B are 1024 and 820 respectively, and the Nice values ​​are 0 and 1 respectively, then the running time obtained by process A is 6×1024(1024+820)=3.3ms, and the virtual time is 3.3×1024 / 1024-3.3ms. The running time obtained by process B is 6×820(1024+820)~2.7ms, and the virtual time is 2.7×1024 / 820≈3.3ms.

[0063] It should be noted that although the weights of the above processes A and B are different, the calculated virtual time is the same. Therefore, the scheduler only needs to ensure that each process obtains the same virtual time for running. When selecting the next process to run, it only needs to find the process with the smallest virtual time.

[0064] As an optional embodiment of the present application, the method also includes: sorting each process in the thread pool according to virtual time to obtain an initial sorting result; in the process of scheduling each thread according to the scheduling delay time, using the thread pool usage model to count the occupancy of each thread; reordering the threads in the initial sorting result according to the sorting index, and prioritizing the threads in the reordered result whose priorities are in a predetermined order; wherein the sorting index includes at least one of the following: thread occupancy and scheduling delay time.

[0065] In this embodiment, each process in the thread pool can be sorted in ascending order according to the virtual time to obtain an initial sorting result. Then, in the process of scheduling each thread according to the scheduling delay time, the thread pool usage model is used to count the occupancy of each thread. Finally, the threads in the initial sorting result are reordered according to the sorting index, and the threads with priorities in the predetermined order in the reordered results are prioritized to achieve the technical effect of providing a more optimized thread priority analysis solution for process scheduling managed by the scheduler, wherein the sorting index may include the thread occupancy rate and scheduling delay time, and the predetermined order may be a sequence with a high ranking.

[0066] Optionally, the thread pool utilization model can also be used to count the existing process scheduling delay time while obtaining the thread utilization rate, sorting the thread occupancy rate and the thread scheduling delay from small to large, and taking the comprehensive weighted average of the top two indicators to generate a priority identifier.

[0067] Alternatively, the formula for the thread pool utilization model can be as follows:

[0068]

[0069] In the above formula, N is the number of working threads in the thread pool at runtime, N max is the maximum number of threads set, Describes the saturation of the worker thread, T cur is the number of tasks in the current acquisition time window, T pre is the number of tasks in the last acquisition time window, Q is the size of the task buffer queue, Describe the current task saturation, Describes the task buffer queue growth rate, where ξ is the weight coefficient. Compare this to the preset thread pool load ω'. If it is greater than ω', threshold adjustment calculation is triggered; otherwise, the current collection time window is skipped.

[0070] As an optional embodiment of the present application, when there are multiple sorting indices, the priority of each thread is obtained by performing a weighted average calculation on each sorting index of the thread.

[0071] In this embodiment, if there are multiple sorting indices, the priority of each thread can be obtained by performing a weighted average calculation on each sorting indices of the thread.

[0072] It should be noted that the scheduler maintains a red-black tree sorted by virtual time, and all runnable scheduling entities are inserted into the red-black tree sorted by virtual time.

[0073] Figure 3 is a schematic diagram of a virtual time scheduling according to an embodiment of the present application, such as Figure 3 As shown, the scheduler selects the process on the far left of the red-black tree to run. As system time goes by, the process that originally ran on the left will slowly move to the right side of the red-black tree, and the process that originally ran on the right will eventually run to the far left. Any process in this red-black tree has a chance to run.

[0074] In the embodiment provided in the present application, at least one task to be executed is monitored; a scheduler is used to select a ready process from a thread pool according to a predetermined scheduling mode to run the task to be executed: wherein the scheduling mode is to control each process in the thread pool to run in a cyclic rotation according to the allocated running time, and the running order of each process in the thread pool is to prioritize the running time in the previous running round from small to large, as the running order of each process in the next running round, thereby achieving the technical effect of meeting the current cluster's management requirements for operation and maintenance, and thus solving the technical problem of not being able to meet the current cluster's management requirements for operation and maintenance.

[0075] Figure 4 This is a structural block diagram of a multi-process scheduling device according to an embodiment of the present application. Figure 4 As shown, the multi-process scheduling device 400 includes:

[0076] The monitoring module 401 is configured to monitor at least one task to be executed.

[0077] The scheduling module 402 is used to use the scheduler to select a ready process from the thread pool according to a predetermined scheduling mode to run the task to be executed: wherein the scheduling mode is to control each process in the thread pool to run in a cyclic rotation according to the allocated running time, and the running order of each process in the thread pool is to sort the priority from small to large according to the running time in the previous running round, as the running order of each process in the next running round.

[0078] In the multi-process scheduling device of the present application, the monitoring module is used to monitor at least one task to be executed; the scheduling module is used to use the scheduler to select a ready process from the thread pool according to a predetermined scheduling mode to run the task to be executed: wherein, the scheduling mode is to control each process in the thread pool to run in a cyclic rotation according to the allocated running time, and the running order of each process in the thread pool is to prioritize the running time in the previous running round from small to large, as the running order of each process in the next running round, thereby achieving the technical effect of meeting the current cluster's management requirements for operation and maintenance, and thus solving the technical problem of not being able to meet the current cluster's management requirements for operation and maintenance.

[0079] It should be noted that the various modules in the above-mentioned multi-process scheduling device can be program modules (for example, a set of program instructions that implement a certain specific function) or hardware modules. For the latter, it can be expressed in the following forms, but is not limited to this: the expression form of each of the above-mentioned modules is a processor, or the functions of each of the above-mentioned modules are implemented by a processor.

[0080] It should be noted that Figure 4 The preferred implementation of the embodiment shown can be found in Figure 2 The relevant description of the illustrated embodiment will not be repeated here.

[0081] An embodiment of the present application further provides a non-volatile storage medium, in which a program is stored. When the program is running, the device where the non-volatile storage medium is located is controlled to execute the above multi-process scheduling method.

[0082] The above-mentioned non-volatile storage medium is used to store a program that performs the following functions: monitoring at least one task to be executed; using a scheduler to select a ready process from a thread pool according to a predetermined scheduling mode to run the task to be executed: wherein the scheduling mode is to control each process in the thread pool to run in a cyclic rotation according to the allocated running time, and the running order of each process in the thread pool is to sort the priority from small to large according to the running time in the previous running round, as the running order of each process in the next running round.

[0083] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0084] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0085] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0086] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0087] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0088] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the relevant technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0089] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A multi-process scheduling method, characterized in that: include: At least one task to be executed is detected; Use the scheduler to select a ready process from the thread pool according to a predetermined scheduling mode to run the task to be executed: The scheduling mode is to control each process in the thread pool to run in a cyclic manner according to the allocated running time, and the running order of each process in the thread pool is to sort the priority from small to large according to the running time in the previous running round, which serves as the running order of each process in the next running round; The scheduler configures the core parameters of each process in the thread pool, and the core parameters include at least a scheduling delay time and a virtual time. The scheduling delay time is the time interval for each process in the ready state in the thread pool to run at least once in a round-robin cycle. The virtual time is used to control the running time of each process in the ready state to be the same. The method also includes: sorting each process in the thread pool according to the virtual time to obtain an initial sorting result; in the process of scheduling each thread according to the scheduling delay time, using a thread pool usage model to count the occupancy of each thread, wherein the occupancy is calculated based on the saturation of the working thread, the saturation of the current task, and the growth rate of the task buffer queue; when the occupancy is greater than the preset load of the thread pool, reordering the threads in the initial sorting result according to the sorting index, and prioritizing the threads in the reordered result whose priorities are in a predetermined order, wherein the sorting index includes at least one of the following: the occupancy of the thread and the scheduling delay time.

2. The method according to claim 1, characterized in that The scheduler determines the total number of processes in the ready state in the thread pool, and allocates corresponding running time to each process in the ready state according to a weight ratio.

3. The method according to claim 1, characterized in that The scheduling delay time is in a dynamically changing state, and the method further includes: When the number of processes in the ready state in the thread pool is less than a fixed value, the scheduling delay time is configured as a fixed default value; When the number of processes in the ready state in the thread pool exceeds the set value, each process is controlled to run for at least a minimum granularity time before releasing CPU resources.

4. The method according to claim 1, wherein The method further comprises: Each process in the ready state runs according to the corresponding scheduling delay time; Determining the actual running time of each process based on the running time allocated to each process in the ready state and the scheduling delay time; The actual running time of each process is converted to obtain the virtual time of each process, wherein the time length of the virtual time of each process is the same.

5. The method according to claim 1, wherein The method further comprises: In the case where there are multiple sorting indices, the priority of each thread is obtained by performing weighted average calculation on each sorting indices of the thread.

6. A multi-process scheduling device, characterized in that: include: A monitoring module, configured to monitor at least one task to be executed; The scheduling module is used to use the scheduler to select a ready process from the thread pool according to a predetermined scheduling mode to run the task to be executed: The scheduling mode is to control each process in the thread pool to run in a cyclic manner according to the allocated running time, and the running order of each process in the thread pool is to sort the priority from small to large according to the running time in the previous running round, which serves as the running order of each process in the next running round; The scheduler configures the core parameters of each process in the thread pool, and the core parameters include at least a scheduling delay time and a virtual time. The scheduling delay time is the time interval for each process in the ready state in the thread pool to run at least once in a round-robin cycle. The virtual time is used to control the running time of each process in the ready state to be the same. The device is also used to: sort each process in the thread pool according to the virtual time to obtain an initial sorting result; in the process of scheduling each thread according to the scheduling delay time, use the thread pool usage model to count the occupancy of each thread, wherein the occupancy is calculated based on the saturation of the working thread, the saturation of the current task, and the growth rate of the task buffer queue; when the occupancy is greater than the preset load degree of the thread pool, reorder the threads in the initial sorting result according to the sorting index, and give priority to marking the threads whose priorities are in a predetermined order in the reordered result, wherein the sorting index includes at least one of the following: the occupancy of the thread and the scheduling delay time.

7. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.

8. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Task scheduling method and device, storage medium and electronic equipment

    CN113495780A