Process scheduling method and device and computing equipment

By associating processes with containers in the Linux operating system, and using the two-level scheduling strategies of the first running queue and the second running queue, the problem that the Linux operating system cannot effectively schedule process groups with deadline limits is solved, and flexible process scheduling is achieved.

CN120371453APending Publication Date: 2025-07-25XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510261975.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-05
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The existing Linux operating system cannot effectively schedule process groups with deadline limits, resulting in poor flexibility in process group scheduling and cannot consider other scheduling strategies while ensuring that scheduling is completed before the deadline.

Method used

By associating multiple processes with containers, the target container is determined using the first running queue and the target process is determined according to the second running queue, two-level scheduling is realized, combining the deadline and priority scheduling strategies to improve the flexibility of scheduling.

Benefits of technology

It realizes that while ensuring that process scheduling is completed before the deadline, it can schedule according to other factors such as priority, improving the flexibility and efficiency of process scheduling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371453A_ABST
    Figure CN120371453A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a process scheduling method and device and computing equipment, belongs to the technical field of computers, and improves the flexibility of process scheduling. The method comprises the following steps: running a scheduler, and detecting whether a first running queue exists or not; when the first running queue exists, determining a target container according to the first running queue; the first running queue is used for indicating the scheduling sequence of the containers; the target container is the top container indicated by the first operation queue; determining a target process according to the target container and the second running queue; the second running queue is used for indicating a scheduling sequence of processes associated with the target container; the target container is associated with a plurality of processes, and the target process is the process, indicated by the second running queue, in the processes associated with the target container; and executing the target process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of computer technologies, and in particular, to a process scheduling method, apparatus, and computing device. Background Art

[0002] A computing device can implement the process of scheduling processes in a general scenario through the Linux operating system. In order to meet the requirements for scheduling process groups in industrial control and other fields, it is necessary to enable the computing device to ensure that process groups are uniformly scheduled according to a certain scheduling policy through the Linux operating system.

[0003] Currently, the Linux operating system can use a completely fair scheduler (CFS) and a real-time (RT) scheduler to implement priority scheduling and execution of processes in a process group based on the running duration or priority of the process group. Since the deadline (DL) scheduler cannot perform scheduling control on a process group according to the deadline, it cannot meet the process of scheduling a process group with deadline constraints in the Linux operating system, resulting in limitations in uniformly scheduling a process group according to the same scheduling policy and poor flexibility. Summary of the Invention

[0004] Embodiments of the present application provide a process scheduling method, apparatus, and computing device. By associating multiple processes with containers, when the scheduler detects a first run queue indicating the scheduling order of containers, the target container for the first-level scheduling is determined, and then the target process for the second-level scheduling is determined from the multiple processes associated with the target container according to the second run queue. After performing the first-level unified scheduling on multiple processes, the second-level scheduling of multiple processes can also be performed, avoiding limitations on the used scheduling policy and improving the flexibility of process scheduling. The technical solution is as follows:

[0005] In a first aspect, a process scheduling method is provided. The method includes: running a scheduler and detecting whether there is a first run queue; when there is a first run queue, determining a target container according to the first run queue; the first run queue is used to indicate the scheduling order of containers; the target container is the container with the earliest order indicated by the first run queue; determining a target process according to the target container and a second run queue; the second run queue is used to indicate the scheduling order of processes associated with the target container; the target container is associated with multiple processes, and the target process is the process with the earliest order indicated by the second run queue among the processes associated with the target container; and executing the target process.

[0006] It can be understood that in the case of detecting a first run queue indicating the order of container scheduling, the target container with the earliest order can be determined, and then the target process with the earliest order among the multiple processes associated with the target container can be determined through the second run queue indicating the order of process scheduling and the target container, so as to schedule and execute the target process. After the first-level unified scheduling of multiple processes, the second-level scheduling of multiple processes can also be performed, avoiding the limitation of the scheduling strategy used and improving the flexibility of process scheduling.

[0007] In a possible implementation, the first run queue includes scheduling entities of multiple containers, and the scheduling entity is used to indicate the deadline of the container, and the scheduling entity of the container with a shorter deadline is ranked earlier.

[0008] In a possible implementation, the second run queue includes scheduling entities of the processes associated with the target container, and the scheduling entity is used to indicate the priority of the process, and the scheduling entity of the process with a higher priority is ranked earlier.

[0009] In a possible implementation, the first scheduling strategy includes a deadline scheduling strategy, and the second scheduling strategy includes a priority scheduling strategy; the first run queue is used to indicate the order of scheduling the process group associated with the container according to the deadline; the second run queue is used to indicate the order of scheduling the processes associated with the container according to the priority.

[0010] It can be understood that by determining the deadlines of at least one process group, the target process group with the closest deadline is determined, so as to implement the scheduling of the target process group according to the deadline scheduling strategy, providing a basis for the subsequent next-level scheduling of each process in the target process group, ensuring that each process in at least one process group can be scheduled and executed before the deadline, and ensuring the execution effect of the process group in the real-time system.

[0011] In a possible implementation, running a scheduler to detect whether there is a first run queue includes: running the scheduler and detecting whether there is the first run queue through a first pointer; the scheduler is associated with the first pointer, and the first pointer is used to indicate the address of the first run queue in the kernel space.

[0012] It can be understood that by expanding the functions of the real-time scheduler, the scheduler can obtain the first run queue according to the first pointer, so as to determine the target container with the closest deadline, expanding the function of the Linux scheduler to implement process group scheduling according to the DL scheduling strategy.

[0013] In a possible implementation, before running the scheduler, it further includes: obtaining the deadline of the container; generating a first run queue according to the deadline of the container; inserting the first run queue in front of the second run queue.

[0014] It can be understood that by obtaining the deadline of the container and generating a first run queue sorted according to the deadline scheduling policy, the function of the real-time scheduler is extended, so that the scheduler can obtain the first run queue according to the first pointer, thereby determining the target container with the closest deadline, and extending the function of the Linux scheduler to implement process group scheduling according to the DL scheduling policy.

[0015] In a possible implementation, the container is created through a container template, and the container template includes a field for the deadline.

[0016] It can be understood that in order to let the container orchestration tool (kubernetes) and the container runtime (containerd / runc) manage the scheduling policy of the container, the interfaces of kubernetes and the container runtime runc are extended to support scheduling policy parameters, so that kubernetes and runc can perceive the scheduling policy.

[0017] In a possible implementation, the container template further includes at least one field of a preset running time or a period.

[0018] In a possible implementation, the first run queue is a data structure in the form of a red-black tree, and the nodes in the red-black tree include the scheduling entity of the container.

[0019] In a possible implementation, the cgroup attribute of the real-time container is set by the container runtime according to the container scheduling parameters and the scheduling policy field.

[0020] It can be understood that in order to let the container orchestration tool (kubernetes) and the container runtime (containerd / runc) manage the scheduling policy of the container, the interfaces of kubernetes and the container runtime runc are extended to support scheduling policy parameters, so that kubernetes and runc can perceive the scheduling policy.

[0021] In a possible implementation, the method further includes: if the actual running time of the target process reaches the preset running time shared by the processes associated with the target container, stop executing the target process through the CPU.

[0022] It can be understood that it ensures that each process in the target container can execute according to the shared preset running time, and avoids the situation where the actual total running time of each process in the target container exceeds the preset running time.

[0023] In a second aspect, a process scheduling device is provided. In the embodiments of the present application, the functional modules of the process scheduling device can be divided according to the method provided in the first aspect above. For example, each functional module can be divided corresponding to each function, or two or more functions can be inherited in one processing module. Exemplarily, in the embodiments of the present application, the process scheduling device can be divided into an acquisition module, a determination module, and a scheduling module according to functions. The descriptions of the possible technical solutions and beneficial effects executed by each of the above-divided functional modules can all refer to the technical solutions provided in the first aspect above or its corresponding possible implementation manners, and will not be elaborated here.

[0024] In a third aspect, embodiments of the present application provide a computing device, which includes a processor and a memory. Computer instructions are stored in the memory, and the computer instructions are loaded and executed by the processor so that the computing device implements the process scheduling method provided in the first aspect above.

[0025] In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, in which at least one computer program is stored, and the computer program is loaded and executed by a processor to implement the process scheduling method provided in the first aspect above.

[0026] In a fifth aspect, embodiments of the present application provide a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computing device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computing device executes the process scheduling method provided in the various optional implementation manners provided in the first aspect above.

[0027] For the specific descriptions of the second aspect to the fifth aspect and their various implementation manners in the embodiments of the present application, reference can be made to the detailed descriptions in the first aspect and its various implementation manners; and for the beneficial effects of the second aspect to the fifth aspect and their various implementation manners, reference can be made to the beneficial effect analysis in the first aspect and its various implementation manners, and will not be elaborated here.

[0028] These aspects or other aspects of the embodiments of the present application will be more clearly understood in the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 is a schematic diagram of a container cgroup hierarchy shown according to an exemplary embodiment;

[0030] Figure 2 is a schematic diagram of a run queue of a Linux scheduler shown according to an exemplary embodiment;

[0031] Figure 3 It is a schematic diagram of the architecture of a process scheduling system shown according to an exemplary embodiment;

[0032] Figure 4 It is a schematic flow diagram of a process scheduling method shown according to an exemplary embodiment;

[0033] Figure 5 It is a schematic flow diagram of the preparation stage of a plurality of process-related containers involved in the embodiments of the present application;

[0034] Figure 6 It is a schematic diagram of two-level scheduling involved in the embodiments of the present application;

[0035] Figure 7 It is a schematic flow diagram of a scheduler implementing a process scheduling method involved in the embodiments of the present application;

[0036] Figure 8 It is a schematic diagram of the structure of a process scheduling device 400 provided by an exemplary embodiment of the present application. Detailed implementation manners

[0037] Next, the technical solutions in the embodiments of the present application will be described with reference to the accompanying drawings in the embodiments of the present application. Among them, in the description of the present application, unless otherwise specified, " / " means that the objects associated before and after are in an "or" relationship. For example, A / B may represent A or B; "and / or" in the present application is only a description of the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. These three situations, where A and B may be singular or plural. And, in the description of the present application, unless otherwise specified, "a plurality of" means two or more than two. "At least one (item)" or its similar expression below refers to any combination of these items, including any combination of single item (item) or plural items (items). For example, at least one (item) of a, b, or c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c may be single or multiple. In addition, in order to clearly describe the technical solutions in the embodiments of the present application, in the embodiments of the present application, terms such as "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects.

[0038] Those skilled in the art can understand that terms such as "first" and "second" do not limit the quantity and execution order, and "first", "second" and other terms do not necessarily mean different. At the same time, in some embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as more preferred or more advantageous than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present relevant concepts in a specific way for easy understanding.

[0039] In addition, the device architecture and business scenarios described in the embodiments of the present application are for more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those of ordinary skill in the art know that with the evolution of the device architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.

[0040] Currently, with the wide application of real-time systems in specific scenarios and the continuous maturity of container technology, containers in real-time systems can be designed and used as real-time containers, thereby providing a more lightweight and efficient isolated running environment for applications.

[0041] The schedulers provided by the Linux operating system can include a Completely Fair Scheduler (CFS), a Deadline (DL) scheduler, and a Real Time (RT) scheduler, as shown below.

[0042] 1) CFS scheduler

[0043] The CFS scheduler is the default scheduler provided by the Linux operating system. The CFS scheduler sorts the scheduling entities of processes according to virtual run time, so that the CFS scheduler can select the scheduling entity of the process with the smallest virtual run time to run on the CPU in each scheduling period, ensuring that the CPU can fairly allocate the running duration of each process as much as possible, thereby ensuring the fairness of process scheduling.

[0044] 2) RT scheduler

[0045] Each process supported by the CPU for scheduling has a corresponding priority. Specifically, a process can correspond to a priority of 0-99. The RT scheduler can maintain a priority linked list on the CPU, and each RT process is connected to the corresponding priority linked list. The RT scheduler can select a process with a higher priority for scheduling, thereby ensuring a better response speed for processes with higher priorities. The priority of the RT scheduler is higher than that of the CFS scheduler.

[0046] 3) DL Scheduler

[0047] The DL scheduler can determine the priority order of process scheduling based on the deadline of the process. The process with the earliest expiration, that is, the process with the closest deadline, will be scheduled and executed first. The DL scheduler can implement a CPU bandwidth reservation quota mechanism to ensure that each process obtains the necessary running time during its running cycle. When the reserved CPU bandwidth quota is used up, the process will be scheduled out by the DL scheduler.

[0048] The CPU schedules and executes processes through the Linux scheduler according to the corresponding run queue. Since the objects used for sorting in the CPU's run queue are scheduling entities (SEs), and the basic unit for the Linux scheduler to manage objects is the scheduling entity, the scheduling entity is an important part of the process descriptor (task_struct) data structure.

[0049] Among them, the Linux kernel manages processes through the data structure of the process descriptor (task_struct). The task_struct can be loaded into RAM, and the task_struct includes the information required by the process. For example, the task_struct can include the process identifier, process status, process priority, program counter, memory pointer, context data, I / O status information, accounting information, etc.

[0050] The objects sorted in the run queue of the Linux scheduler can be scheduling entities. The scheduling entities used for sorting in the run queue of the CFS scheduler can include the running time of the process. That is to say, the run queue of the CFS scheduler can sort each process according to the running time of the process, and give priority to scheduling the process with the shortest running time; the run queue of the RT scheduler can sort each process according to the process priority, and give priority to scheduling the process with the highest priority; the run queue of the DL scheduler can be sorted according to the deadline of the process, and give priority to scheduling the process with the closest deadline.

[0051] In Linux, containers are implemented based on the kernel's namespace and control groups (cgroups) mechanisms. Namespaces can be used to isolate system resources. Processes running in a namespace have independent virtual resources and are unaware of and unable to use the resources of other namespaces. Cgroups are used to limit resource usage. That is, processes under the same cgroup share the resources divided by the cgroup according to their respective scheduling policies. In a container environment, a single container or multiple containers (pods) have independent namespace spaces and independent cgroups. For example, in a Docker environment, the cgroups of all containers are created under / sys / fs / cgroup / cpu / docker / .

[0052] In Linux, when creating a container, the container management system (exemplarily, runc, a container runtime) allocates a namespace space and a cgroup for the created container and further configures resources such as CPU and memory. When creating a process, the kernel can specify the namespace space and cgroup allocated to a certain container for the process. At this time, it can be said that this process is associated with this container. A container can be associated with multiple processes, and multiple processes associated with a container can be regarded as a process group.

[0053] Among them, Figure 1 is a schematic diagram of the cgroup hierarchy of a container shown in an embodiment of the present application. As Figure 1 shown, the root directory (root) in the Linux system is created under the / sys / fs / cgroup / cpu path. Processes 1 and 2 can be created under this path. The Linux system can use Docker as a container management tool. Docker is an open-source application container engine that allows developers to package applications and their dependent packages into a portable container and then publish it to the Linux system. The resource groups in the container domain of the Linux system can be uniformly managed under the Docker hierarchy. The cgroups of all containers are created under the / sys / fs / cgroup / cpu / docker path. Containers created through Docker include Container 1 and Container 2. Container 1 can include Process 3 and Process 4, and Container 2 can include Process 5 and Process 6.

[0054] Exemplarily, Figure 2 is a schematic diagram of the run queue of a Linux scheduler shown in an embodiment of the present application. As Figure 2As shown in the figure, the CPU may include the run queue of the CFS scheduler, the run queue of the RT scheduler, and the run queue of the DL scheduler. Each process corresponds to its own process descriptor (task_struct). The Linux operating system obtains the task_struct corresponding to the process, obtains the running time of the process therein, and the objects sorted in the run queue can be scheduling entities, and the scheduling entities include the running time of the process, to generate the run queue of the CFS scheduler; the Linux operating system obtains the task_struct corresponding to the process, obtains the priority of the process therein, and the scheduling entities include the priority of the process, to generate the run queue of the RT scheduler; the Linux operating system obtains the task_struct corresponding to the process, obtains the deadline of the process therein, and the scheduling entities include the deadline of the process, to generate the run queue of the DL scheduler.

[0055] In a possible implementation, the task_struct corresponding to the process includes relevant information indicating the scheduling policy adopted by the process. The scheduling policy may include the completely fair scheduling policy, the RT scheduling policy (priority scheduling policy), and the deadline scheduling policy (deadline scheduling policy). For example, when the relevant information of the scheduling policy in the task_struct takes the value of SCHED_NORMAL, it is determined that the scheduling policy used by the process is the default standard scheduling policy of Linux (that is, the completely fair scheduling policy); when the relevant information of the scheduling policy in the task_struct takes the value of SCHED_RR, it is determined that the scheduling policy used by the process is the RT scheduling policy (priority scheduling policy), and then the Linux operating system runs the processes with the same priority in the run queue in turn according to equal time slices; when the relevant information of the scheduling policy in the task_struct takes the value of SCHED_FIFO, it is determined that the scheduling policy used by the process is the RT scheduling policy, and then the Linux operating system runs according to the order of arrival of the processes. Unless preempted by a process with a higher priority or the process actively gives up CPU resources, the process will keep running; when the relevant information of the scheduling policy in the task_struct takes the value of SCHED_DEADLINE, it is determined that the scheduling policy used by the process is the deadline scheduling policy (that is, the deadline scheduling policy). In addition, the relevant information of the scheduling policy in the task_struct may also take the values of SCHED_BATCH or SCHED_IDLE. SCHED_BATCH indicates that the Linux operating system uses the high-throughput batch task scheduler dedicated to kernel threads to schedule processes, and SCHED_IDLE indicates that the Linux operating system uses the scheduler designed for the lowest-priority tasks in the system to schedule processes.

[0056] The run queue of the Linux scheduler in the CPU can be a data structure of a red-black tree. Each node in the red-black tree corresponds to a scheduling entity of a process. The scheduling entity includes the relevant information required to schedule and execute the process, and also includes the information on which the scheduler depends to sort the processes. For example, the scheduling entity of each process corresponding to each node in the red-black tree corresponding to the run queue of the CFS scheduler includes the relevant information required to schedule and execute the process, and also includes the running time of the process. The CFS scheduler sorts according to the running time of the process and determines the process with the shortest running time as the process to be scheduled and executed by the CFS scheduler; the scheduling entity of each process corresponding to each node in the red-black tree corresponding to the run queue of the RT scheduler includes the relevant information required to schedule and execute the process, and also includes the priority of the process. The CFS scheduler sorts according to the priority of the process and determines the process with the highest priority as the process to be scheduled and executed by the RT scheduler; the scheduling entity of each process corresponding to each node in the red-black tree corresponding to the run queue of the DL scheduler includes the relevant information required to schedule and execute the process, and also includes the deadline of the process. The DL scheduler sorts according to the deadline of the process and determines the process with the nearest deadline as the process to be scheduled and executed by the DL scheduler.

[0057] In the real-time scheduling scenario, the real-time scheduling scenario has a deadline limit for scheduling and executing multiple processes. For example, multiple processes running in a real-time system need to achieve the scheduling of multiple processes before the deadline. That is to say, in the real-time scheduling scenario, it is necessary to ensure that multiple processes can complete scheduling and execution before the deadline, and on the basis of ensuring that the processes also need to ensure the running effect, it is further necessary to schedule each process according to the running duration or priority on the basis of ensuring that the scheduling is completed before the deadline. At present, the DL scheduler cannot perform scheduling control according to the deadline for a process group containing multiple processes, thus unable to meet the process of Linux scheduling a process group with deadline constraints containing multiple processes, resulting in limitations in the unified scheduling of the process group according to the same scheduling policy, and thus unable to realize the process of further scheduling processes using other scheduling policies on the basis of ensuring that the scheduling is completed before the deadline, resulting in poor flexibility.

[0058] In the current process of Linux scheduling a process group with deadline constraints, it is necessary to use the DL scheduling policy to schedule and execute each process in the process group. On the one hand, the current Linux scheduler hierarchical architecture cannot implement the DL scheduling policy for the process group; on the other hand, if the DL scheduling policy is sampled for each process, it is impossible to consider scheduling according to other aspects (such as priority). It may occur that although processes 1 to 10 all ensure that they are scheduled and executed before the deadline, but it is impossible to make the more important processes among processes 1 to 10 execute first, thus affecting the effect of scheduling and executing the process group.

[0059] An embodiment of the present application provides a process scheduling method. When detecting a first run queue indicating the order of container scheduling, the target container with the earliest order can be determined. Then, according to the second run queue indicating the order of process scheduling and the target container, the target process with the earliest order among the multiple processes associated with the target container can be determined, and then the target process is executed, so that the multiple processes associated with the container can be scheduled according to the first scheduling policy. At the same time, the process associated with the container with the earliest order determined according to the first scheduling policy can be scheduled according to the second scheduling policy, improving the flexibility of process scheduling.

[0060] In some embodiments, in the process scheduling method provided by the embodiment of the present application, first, the computing device determines the deadline of the containers on the CPU. Then, according to the deadlines of the containers, the target container with the closest deadline is determined. Then, the processes associated with the target container are scheduled to execute the processes associated with the target container through the CPU. By determining the deadlines of the containers and determining the target container with the closest deadline, the target container can be scheduled according to the deadline scheduling policy, providing a basis for the subsequent next-level scheduling of each process associated with the target container, ensuring that each process in at least one process group can be scheduled and executed before the deadline, and ensuring the execution effect of the multiple processes associated with the containers in the real-time system.

[0061] First, an exemplary introduction to the system architecture of the embodiment of the present application is given.

[0062] By deploying a Kubernetes (k8s) cluster, the applications in each container managed by the k8s cluster can be run. The k8s cluster includes one or more master nodes and one or more worker nodes. Among them, the master node can be used to schedule the applications in the containers managed by the k8s cluster to run, and the worker node can be used to run the applications in the containers on its own node. The worker nodes can be managed by the master node. For example, the master node can be a physical machine or a virtual machine. Similarly, the worker node can also be a physical machine or a virtual machine. Figure 3 It is a schematic diagram of the architecture of a process scheduling system provided by an embodiment of the present application. As Figure 3 shown, this process scheduling system is applied in a k8s cluster. The k8s cluster can include two major parts, namely the master node 10 and the worker node 11. Among them, the master node 10 can include components such as the application programming interface service (kube-apiserver, k8s API).

[0063] Among them, kube-apiserver is a hub for providing data interaction and communication between modules.

[0064] In addition, the worker node 11 may include a kubelet component, a container runtime (containerd / runc), a process management module, a scheduler, and real-time containers.

[0065] Developers edit the container template file through the container orchestration tool (Kubernetes) running in the terminal, and add container call parameters to the container template file. Among them, the container call parameters include a first parameter, a container identifier, and may also include a deadline scheduling policy field and related parameters of the container. The first parameter can be used to indicate the scheduling entity of the first run queue. When the first run queue is a deadline queue, the first parameter is the deadline. The first parameter may also include the running time and the period. Then the terminal sends a container creation instruction to the master node 10. The container creation instruction includes the container call parameters or the container template file with the container call parameters added. The master node 10 then sends the container creation instruction to the kubelet component in the worker node 11 through the k8s API. The kubelet component passes the container creation instruction to the container runtime. The container runtime creates the cgroup of the container through the container call parameters included in the container creation instruction, and sets the scheduling policy of the container to the deadline scheduling policy, and then creates the corresponding container. The created container is a container with a time limit, for example, it can be a real-time container. Optionally, the master node 10 can be a physical machine or a virtual machine. Similarly, the worker node 11 can be a physical machine or a virtual machine. Among them, in the case where both the master node 10 and the worker node 11 are virtual machines, they can run on the same physical machine or on different physical machines, which is not limited here.

[0066] Among them, Kubernetes is an open-source platform for the automated deployment, scaling, and operation and maintenance of container clusters. Through Kubernetes, user requirements can be quickly and effectively responded to, and applications can be deployed and scaled quickly and predictably. Kubernetes is responsible for managing all containers in the service (for example, creating, running, restarting, and deleting). runc is a command-line tool that can operate on the host kernel to manage Namespace and cgroups. containerd is a project separated from the container (docker). containerd is a persistent daemon process responsible for managing the containers created by runc. Listening to the upper-layer requests to start, stop, or report the status of the containers. Responsible for managing the life cycle of the containers. In addition, it is also responsible for other functions such as pushing and pulling images and local storage of images, and cross-container network management.

[0067] Exemplarily, after the user increases the deadline scheduling policy fields and related parameters of Container 1 and Container 2 through Kubernetes, Kubernetes sends the deadline scheduling policy fields and related parameters of Container 1 and Container 2 to the container runtime. The container runtime is used to limit resources for Container 1 and Container 2 respectively according to the deadline scheduling policy fields and related parameters of Container 1 and Container 2, that is, to set the respective cgroups attributes of Container 1 and Container 2 using the deadline scheduling policy fields and related parameters of Container 1 and Container 2. Kubernetes schedules Container 1 and Container 2 through the operating system kernel according to the respective cgroups of the containers. Container 1 includes Process 1 (T1), Process 2 (T2), and Process 3 (T3), and Container 2 includes Process 4 (T4), Process 5 (T5), and Process 6 (T6). In the case where Container 1 and Container 2 are scheduled according to the cgroups set by their respective deadline scheduling policy fields and related parameters, the processes in the containers can also be scheduled and executed according to the scheduling policies and related parameters of the processes in the containers.

[0068] Among them, the physical machine can be a computing device or a server, such as a general server, a GPU server, a DPU server, or an AI server, etc.

[0069] Among them, the process management module is used to generate a run queue, which can include a first run queue and a second run queue. The first run queue can be used to indicate the order of scheduling the process group associated with the container according to the first scheduling policy, and the second run queue can be used to indicate the order of scheduling the processes according to the second scheduling policy. In a possible implementation manner, the first scheduling policy includes a deadline scheduling policy, and the second scheduling policy includes a priority scheduling policy.

[0070] The scheduler is used to schedule processes according to the run queue so that the CPU executes the processes. The scheduler includes a Linux scheduler. For example, the scheduler includes a CFS scheduler, an RT scheduler, and a DL scheduler. Among them, in the case where the first scheduling policy includes a deadline scheduling policy and the second scheduling policy includes a priority scheduling policy, the scheduler used to schedule the processes associated with the container is the RT scheduler.

[0071] That is to say, as Figure 3As shown in the figure, during the scheduling phase of the process, the scheduler (e.g., RT scheduler) can detect whether the CPU contains a first run queue (e.g., deadline queue). If it detects the existence of the first run queue, it determines the target container where the scheduling entity with the nearest deadline is located. Then, the scheduler determines the process with the highest priority among the corresponding scheduling entities of the processes associated with the target container according to the second run queue (e.g., priority queue), schedules and executes it, and then continues the next loop. If it does not detect the existence of the first run queue, it directly determines the process with the highest priority according to the second run queue, schedules and executes it, and then continues the next loop.

[0072] Among them, in the preparation phase of associating the process group with the container, after creating the container during the container runtime, the process management module can generate a deadline queue according to the deadline of the container, insert the deadline queue in front of the priority queue, and add the deadline of the container to the corresponding scheduling entity of the process in the priority queue.

[0073] It should be noted that the application scenarios and system architectures described in the embodiments of this application are for more clearly explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those of ordinary skill in the art know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of this application are equally applicable to similar technical problems.

[0074] For ease of understanding, the process scheduling method provided in this application is introduced exemplarily below with reference to the accompanying drawings. This process scheduling method is applicable to Figure 3 the k8s cluster and the worker nodes in the cluster as shown in the figure.

[0075] Figure 4 shows a schematic flowchart of the process scheduling method provided by an exemplary embodiment of this application. This process scheduling method can be executed by a computing node, and the computing node can be a worker node 11 as shown in Figure 3 the figure. This process scheduling method includes the following steps:

[0076] S101, run the scheduler and detect whether there is a first run queue.

[0077] The Linux scheduler in a computing device includes a CFS scheduler, an RT scheduler, and a deadline scheduler. Starting different schedulers can run different run queues, and different run queues correspond to different sorting methods for processes. For example, the CFS scheduler sorts the scheduling entities of processes according to virtual run time to generate a CFS run queue. When the CFS scheduler is started, processes are executed in the order of the CFS run queue. The RT scheduler sorts the scheduling entities of processes according to priority to generate an RT run queue. When the RT scheduler is started, processes are executed in the order of the RT run queue.

[0078] Before the preparation stage of the process group associated container, that is, before the computing node runs the scheduler, the computing node can create a first run queue through the container runtime. Figure 5 It is a schematic flowchart of the preparation stage of a container associated with multiple processes according to an embodiment of the present application. The preparation stage includes the following steps.

[0079] S11, obtain container call parameters, and create a container according to the container call parameters.

[0080] Among them, developers edit a container template file through a container orchestration tool (Kubernetes) running in the terminal, and add container call parameters to the container template file. The container call parameters include a first parameter, a container identifier, and may also include a scheduling policy field and related parameters of the container. The first parameter can be used to indicate the scheduling entity of the first run queue. When the first run queue is a deadline queue, the first parameter is the deadline. The first parameter can also include run time and period.

[0081] Then the terminal sends a container creation instruction to the master node 10. The container creation instruction includes container call parameters, or includes a container template file with container call parameters added. The master node 10 then sends the container creation instruction to the kubelet component in the worker node 11 through the k8s API. The kubelet component passes the container creation instruction to the container runtime. The container runtime creates a cgroup of the container through the container call parameters included in the container creation instruction, and sets the scheduling policy of the container to the deadline scheduling policy, and then creates the corresponding container. The created container is a container with time limit restrictions. That is, in one possible case, the container template can be pre-set in the computing device, and the container runtime creates a container by combining the container call parameters in the container creation instruction with the pre-set container template; in another possible case, after the container runtime obtains the container template file with container call parameters added in the container creation instruction, it creates a container according to the container template file with container call parameters added.

[0082] In a possible implementation, when creating a container with a deadline limit, a deadline for the container can be set. Here, the deadline for the container is used to indicate that multiple processes associated with the container need to be scheduled and executed before this deadline.

[0083] To facilitate the management of the deadline attribute of a container from the user space through the container orchestration component (kubelet) and the container runtime component (containerd / runc), a control parameter for setting the deadline can be added during the container lifecycle management. By extending the container template definition of Kubernetes, a deadline scheduling policy field and related parameters are added. The following is the code content of the template file (deployment.yml) for creating a container.

[0084] containers:

[0085] name: nginx

[0086] image: nginx:latest

[0087] imagepullpolicy: ifnotpresent

[0088] ports:

[0089] - containerport: 80

[0090] Scheduler: deadline

[0091] Runtime: 20ms

[0092] Deadline: 50ms

[0093] Period: 50ms

[0094] Among them, in the template file, the container name is defined as nginx through "name:nginx"; in the template file, the image pulling policy of the container is defined as "imagepullpolicy:ifnotpresent", which means the image is pulled only when it does not exist on the host machine; then in the template file, the container interface can be defined as 80 through "containerport:80", the scheduling policy used by the container is defined as the deadline scheduling policy through "Scheduler:deadline", the preset running time of the container is defined as 20ms through "Runtime:20ms", the deadline set for the container is defined as 50ms through "Deadline:50ms", and the period set for the container is defined as 50ms through "Period:50ms". In one implementation, Kubelet identifies the deadline scheduling policy field and related parameters of the container. When creating or changing a container, Kubelet passes the deadline scheduling policy field and related parameters to the container runtime (containerd / runc). When creating a container, the container runtime uses the deadline scheduling policy field and related parameters to set the cgroup attributes of the container.

[0095] S12. Associate the container with multiple processes.

[0096] Among them, after the container (task_group) is created, the container runtime can configure resources through cgroup grouping.

[0097] That is to say, the container runtime (runc) allocates a namespace space and a cgroup for the created container, and further configures resources such as CPU and memory. When creating a process, the kernel can specify the namespace space and cgroup allocated to a certain container for the process. Exemplarily, the process management module can specify the namespace space and cgroup allocated to a certain container for the process, so as to realize the association between the container and multiple processes.

[0098] S13. Generate a first run queue and insert the first run queue in front of the second run queue.

[0099] In the embodiment of the present application, the process management module of the computing node can generate a first run queue. The sorting object of the first run queue is the scheduling entity corresponding to the container. Since the subsequent scheduling of the process depends on the scheduler to which the second run queue belongs, inserting the first run queue before the second run queue can enable the scheduler to detect the existence of the first run queue when reading the second run queue.

[0100] In a possible implementation, the first run queue includes the scheduling entities of containers and is sorted according to the scheduling entities of containers. In one implementation, the first run queue can be arranged in the form of a red-black tree. The scheduling entity with a shorter deadline is sorted earlier in the red-black tree, and conversely, the scheduling entity with a longer deadline is sorted later in the red-black tree. Through the sorting of the first run queue, the target container with a shorter deadline to be scheduled first can be determined subsequently.

[0101] In addition, the second run queue includes the scheduling entities of the processes corresponding to the containers and is sorted according to the scheduling entities of the processes. The parameters of the scheduling entities of the first run queue and the second run queue can be different. In a possible implementation, when the scheduling entity of the container in the first run queue includes a deadline, the scheduling entity of the process in the second run queue can include a priority. When the target container is scheduled, the process with a higher priority among the multiple processes corresponding to the target container can be scheduled first.

[0102] It can be understood that after the scheduler is started, it originally corresponds to running the second run queue. The embodiments of the present application can enable the scheduler to associate a first pointer. The first pointer can be used to indicate the address of the first run queue in the kernel space. After the scheduler obtains the first pointer, it will first run the first run queue. By modifying the original scheduler, it can be made such that before the scheduler obtains that it needs to use the scheduling policy of the first order for scheduling, it can first identify whether there is a need to use the scheduling policy of the second order for scheduling.

[0103] Exemplarily, add a first pointer in the RT scheduler. The RT scheduler corresponds to the second run queue. When the RT scheduler is running, it will first obtain whether the address in the kernel space indicated by the first pointer contains the first run queue, so as to first run the first run queue.

[0104] In a possible implementation, obtain the first run queue according to the first pointer. The first run queue is used to indicate the order of scheduling containers; determine the target container with the closest deadline from the first run queue.

[0105] S102, when there is a first run queue, determine the target container according to the first run queue.

[0106] Among them, the first run queue is used to indicate the scheduling order of containers, and the target container is the container with the earliest order indicated by the first run queue.

[0107] If there is a first run queue, select a container according to the order of the first run queue, and the container with the earliest order indicated by the first run queue can be determined as the target container.

[0108] In a possible implementation, the scheduling entities in the first run queue include the deadline of the container. According to the first run queue, the computing node can determine the deadline of the process group associated with the container. The computing node can determine the container with the closest deadline as the target container based on the obtained deadline of the container.

[0109] Exemplarily, Figure 6 is a schematic diagram of a two-level scheduling involved in an embodiment of the present application. As Figure 6 shown, when the scheduler runs, it first needs to obtain whether there is a first run queue according to the first pointer. If there is a first run queue, according to the red-black tree structure of the first run queue, it can be determined that container 3 is the target container with the closest deadline. Container 2 is associated with processes 3 and 4, and container 3 is associated with processes 5 and 6. The scheduler identifies the second run queue, and the second run queue is used to indicate the order of scheduling processes according to priority. Subsequently, the scheduler can determine the process with a higher priority among processes 5 and 6 associated with the target container (container 3) in the second run queue.

[0110] S103. Determine the target process according to the target container and the second run queue.

[0111] After determining the target container, the scheduler can determine the target process in the second run queue according to the position of the processes associated with the target container in the second run queue. The target process can be the process with the earliest order among the processes associated with the target container in the second run queue.

[0112] That is to say, the scheduler can determine the scheduling entities corresponding to the multiple processes associated with the target container in the second run queue, and then determine the process corresponding to the scheduling entity with a higher rank among the scheduling entities corresponding to the multiple processes associated with the target container in the second run queue as the target process. For example, the second run queue can be a data structure in the form of a red-black tree or a priority linked list arranged in the order of priority. The nodes in the red-black tree or the priority linked list are used as scheduling objects. When the system creates a container, it initializes the deadline scheduling entity according to the container scheduling parameters, and generates the first run queue based on the deadline of the process group according to the deadline size. After determining the target container, the scheduler can determine the scheduling entities corresponding to the multiple processes associated with the target container in the second run queue. According to the red-black tree structure of the second run queue or the priority linked list, the scheduler can determine the scheduling entity corresponding to the process associated with the target container with the earliest order in the second run queue. That is, the scheduler can determine the target process with the highest priority among the multiple processes associated with the target container.

[0113] Through the above method, by associating multiple processes with containers, the scheduler can determine the target container for the first-level scheduling after detecting the first run queue indicating the scheduling order of the containers, and then determine the target process for the second-level scheduling from the multiple processes associated with the target container according to the second run queue. After performing the unified scheduling of the first level on the multiple processes, the second-level scheduling can also be performed on the multiple processes, avoiding the limitation of the scheduling policies used. That is to say, when the scheduling entity of the container is scheduled according to the deadline scheduling policy, the process with the highest priority in the container with the closest deadline will be scheduled first and executed.

[0114] S104, execute the target process.

[0115] In the embodiment of the present application, after the computing node determines the target process through the scheduler, the target process is run by the CPU.

[0116] Exemplarily, Figure 7 is a flowchart showing a method for a scheduler to implement process scheduling according to an embodiment of the present application. As Figure 7 shown, first, the scheduler is started (S21). The scheduler determines whether there is a first run queue (S22). If there is a first run queue, the container with the closest deadline is determined in the second run queue (S23), and then the process with the highest priority in the container with the closest deadline is determined (S24). If it is determined that there is no first run queue, the scheduler determines the process with the highest priority according to the second run queue (S25), and then the process is scheduled and executed through the scheduler (S26).

[0117] In summary, the embodiment of the present application provides a process scheduling method. By associating multiple processes with containers, the scheduler can determine the target container for the first-level scheduling after detecting the first run queue indicating the scheduling order of the containers, and then determine the target process for the second-level scheduling from the multiple processes associated with the target container according to the second run queue. After performing the unified scheduling of the first level on the multiple processes, the second-level scheduling can also be performed on the multiple processes, avoiding the limitation of the scheduling policies used and improving the flexibility of process scheduling.

[0118] The above mainly introduced the solution of the embodiments of the present application from the perspective of methods. It can be understood that in order for the process scheduling device to implement the above functions, it includes at least one of the corresponding hardware structures and software modules for executing each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed in this article, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.

[0119] The embodiments of the present application can divide the functional units of the process scheduling device according to the above method examples. For example, each functional unit can be divided corresponding to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. It should be noted that the division of units in the embodiments of the present application is illustrative, only a logical function division, and there may be other division methods in actual implementation.

[0120] Exemplarily, Figure 8 shows a schematic diagram of the structure of a process scheduling device 400 provided by the embodiments of the present application. As Figure 8 shown, the process scheduling device 400 can be applied to a computing node, and the process scheduling device 400 includes:

[0121] A detection module 410, configured to run a scheduler and detect whether there is a first run queue;

[0122] An acquisition module 420, configured to, when there is the first run queue, determine a target container according to the first run queue; the first run queue is used to indicate the scheduling order of containers; the target container is the container with the earliest order indicated by the first run queue;

[0123] A determination module 430, configured to determine a target process according to the target container and a second run queue; the second run queue is used to indicate the scheduling order of processes associated with the target container; the target container is associated with multiple processes, and the target process is the process with the earliest order indicated by the second run queue among the processes associated with the target container;

[0124] An execution module 440, configured to execute the target process.

[0125] In a possible implementation, the first run queue includes scheduling entities of multiple containers, and the scheduling entity is used to indicate the deadline of the container. The scheduling entities of the containers with earlier deadlines are ranked higher.

[0126] In a possible implementation, the second run queue includes scheduling entities of processes associated with the target container, and the scheduling entity is used to indicate the priority of the process. The scheduling entities of the processes with higher priorities are ranked higher.

[0127] In a possible implementation, the apparatus further includes:

[0128] A generation module, configured to, before running the scheduler, obtain the deadline of the container; generate the first run queue according to the deadline of the container; and insert the first run queue in front of the second run queue.

[0129] In a possible implementation, the detection module 410 is further configured to run the scheduler and detect whether the first run queue exists through a first pointer; the scheduler is associated with the first pointer, and the first pointer is used to indicate the address of the first run queue in the kernel space.

[0130] In a possible implementation, the container is created through a container template, and the container template includes a field for the deadline.

[0131] In a possible implementation, the first run queue is a data structure in the form of a red-black tree, and the nodes in the red-black tree include the scheduling entities of the containers.

[0132] Optionally, the above process scheduling apparatus 400 can be applied to Figure 3 the working node 11 shown in the figure to implement the above Figure 4 process scheduling method described therein.

[0133] Among them, the detection module 410, the acquisition module 420, the determination module 430, and the scheduling module 440 can all be implemented by software or by hardware.

[0134] Exemplarily, next, taking the detection module 410 as an example, the implementation manner of the detection module 410 will be introduced. Similarly, the implementation manners of the acquisition module 420, the determination module 430, and the scheduling module 440 can refer to the implementation manner of the detection module 410.

[0135] As an example of a software functional unit, the detection module 410 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above computing instance may be one or more. For example, the detection module 410 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers for running the code may be distributed in the same region or in different regions. Further, the multiple hosts / virtual machines / containers for running the code may be distributed in the same availability zone (AZ) or in different AZs, and each AZ includes one data center or multiple geographically proximate data centers. Usually, one region may include multiple AZs.

[0136] Similarly, the multiple hosts / virtual machines / containers for running the code may be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, one VPC is set within one region. For cross-region communication between two VPCs within the same region and between VPCs in different regions, a communication gateway needs to be set in each VPC, and the interconnection between VPCs is achieved through the communication gateway.

[0137] For cross-region communication between two VPCs within the same region and between VPCs in different regions, a communication gateway needs to be set in each VPC, and the interconnection between VPCs is achieved through the communication gateway.

[0138] As an example of a hardware functional unit, the detection module 410 may include at least one computing device, such as a server. Alternatively, the detection module 410 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). Among them, the above PLD may be implemented by a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0139] The multiple computing devices included in the detection module 410 can be distributed in the same region or in different regions. The multiple computing devices included in the detection module 410 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the detection module 410 can be distributed in the same VPC or in multiple VPCs. Among them, the multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0140] It should be noted that in other embodiments, the detection module 410 can be used to execute any step in the process scheduling method, the acquisition module 420 can be used to execute any step in the process scheduling method, the determination module 430 can be used to execute any step in the process scheduling method, and the scheduling module 440 can be used to execute any step in the process scheduling method. The steps to be implemented by the detection module 410, the acquisition module 420, the determination module 430, and the scheduling module 440 can be specified as needed. The entire function of the process scheduling device 400 is realized by separately implementing different steps in the process scheduling method through the detection module 410, the acquisition module 420, the determination module 430, and the scheduling module 440.

[0141] For the specific descriptions of the above optional methods, reference can be made to the foregoing method embodiments, which will not be elaborated herein. In addition, the explanations and descriptions of the beneficial effects of any of the above-provided process scheduling devices 400 can all refer to the Figure 4 corresponding method embodiments and will not be repeated.

[0142] The embodiments of the present application also provide a computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When it runs on a computing device, it causes the computing device to execute the operations corresponding to any one of the implementation schemes and various feasible implementation manners of the process scheduling method.

[0143] The embodiments of the present application also provide a computer program product containing instructions. When it runs on a computing device, it causes the computing device to execute the operations corresponding to any one of the implementation schemes and various feasible implementation manners of the process scheduling method.

[0144] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present application.

[0145] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0146] An embodiment of the present application further provides a chip system, including: a processor, the processor is coupled to a memory, and the memory is used to store programs or instructions. When the programs or instructions are executed by the processor, the chip system implements the methods in any of the foregoing method embodiments.

[0147] Optionally, the processor in the chip system can be one or more. The processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented by software, the processor can be a general-purpose processor that implements by reading the software code stored in the memory.

[0148] Optionally, the memory in the chip system can also be one or more. The memory can be integrated with the processor or can be separately provided from the processor, which is not limited in the embodiments of the present application. Exemplarily, the memory can be a non-transitory processor, such as a read-only memory (ROM), which can be integrated with the processor on the same chip or can be separately provided on different chips. The embodiments of the present application do not specifically limit the type of the memory and the setting manner of the memory and the processor.

[0149] Exemplarily, the chip system can be a field programmable gate array (FPGA), can be an application specific integrated circuit (ASIC), can also be a system on chip (SoC), can also be a central processing unit (CPU), can also be a network processor (NP), can also be a digital signal processing circuit (DSP), can also be a microcontroller unit (MCU), can also be a programmable logic device (PLD) or other integrated chips.

[0150] The electronic device, computer storage medium, or computer program product provided by the present application is all used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above and will not be elaborated herein.

[0151] From the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and brevity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be allocated to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0152] In the several embodiments provided in the present application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in electrical, mechanical or other forms.

[0153] The unit described as a separated component may or may not be physically separated. The component displayed as a unit may be a physical unit or multiple physical units, which can be located in one place or distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0154] In addition, each functional unit in the various embodiments of the present application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0155] 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 readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application, in essence, or the part that makes a contribution, or all or part of the technical solution, can be embodied in the form of a software product. The software product is stored in a storage medium and includes several instructions to enable a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods in the various embodiments of the present application. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read only memory (ROM), random access memory (RAM), magnetic disks or optical discs and other various media that can store program codes.

[0156] The above content is only a specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application shall be covered by the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.

Claims

1. A process scheduling method, characterized in that, The method includes: Running a scheduler to detect whether there is a first run queue; When there is the first run queue, determining a target container according to the first run queue; the first run queue is used to indicate the scheduling order of containers; the target container is the container with the earliest order indicated by the first run queue; Determining a target process according to the target container and a second run queue; the second run queue is used to indicate the scheduling order of processes associated with the target container; the target container is associated with multiple processes, and the target process is the process with the earliest order indicated by the second run queue among the processes associated with the target container; Executing the target process.

2. The method according to claim 1, wherein The first run queue includes scheduling entities of multiple containers, and the scheduling entity is used to indicate the deadline of the container, and the scheduling entities of containers with earlier deadlines are in the front.

3. The method according to claim 2, wherein The second run queue includes scheduling entities of processes associated with the target container, and the scheduling entity is used to indicate the priority of the process, and the scheduling entities of processes with higher priorities are in the front.

4. The method according to claim 2 or 3, characterized in that, Before running the scheduler, it further includes: Obtaining the deadline of the container; Generating the first run queue according to the deadline of the container; Inserting the first run queue in front of the second run queue.

5. The method according to claim 4, characterized in that, When running the scheduler to detect whether there is a first run queue, it includes: Running the scheduler to detect whether there is the first run queue through a first pointer; the scheduler is associated with the first pointer, and the first pointer is used to indicate the address of the first run queue in the kernel space.

6. The method according to any one of claims 2 to 4, characterized in that The container is created through a container template, and the container template includes a field for the deadline.

7. The method according to claim 6, characterized in that, The container template further includes at least one field for a preset running time or period.

8. The method according to any one of claims 1 to 7, characterized in that, The first run queue is a data structure in the form of a red-black tree, and the nodes in the red-black tree include the scheduling entities of the containers.

9. A process scheduling device, characterized in that, The device includes: A detection module, configured to run a scheduler to detect whether there is a first run queue; An obtaining module, configured to determine a target container according to the first run queue when there is the first run queue; the first run queue is used to indicate the scheduling order of containers; the target container is the container with the earliest order indicated by the first run queue; A determining module, configured to determine a target process according to the target container and a second run queue; the second run queue is used to indicate the scheduling order of processes associated with the target container; the target container is associated with multiple processes, and the target process is the process with the earliest order indicated by the second run queue among the processes associated with the target container; An execution module, configured to execute the target process.

10. A computing device, characterized in that, The computing device includes: a processor and a memory for storing instructions executable by the processor; The processor is configured to execute the instructions such that the computing device executes the process scheduling method according to any one of claims 1-8.