Thread priority control method and device, computer equipment, readable storage medium and program product

By presetting the highest priority and lowest priority of container threads in the container configuration structure and clarifying the priority control scope, the problem of thread priority configuration conflicts in container scheduling is solved, and the system's real-time performance and resource scheduling efficiency are improved.

CN119597420AActive Publication Date: 2025-03-11GUANGZHOU YIHUI INFORMATION TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411616009.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-13
Publication Date
2025-03-11
Estimated Expiration
2044-11-13

AI Technical Summary

Technical Problem

In the existing container scheduling methods, thread priority configuration is prone to conflicts, resulting in unreasonable CPU resource allocation, affecting the real-time response of high-priority tasks, and thus leading to unstable real-time performance of the system as a whole.

Method used

Through a predetermined container configuration structure, the highest priority and lowest priority of the container threads within a plurality of containers are determined, and the priority range of the container is determined based on these priorities. In response to thread creation operations, determine the priority parameters of the currently created thread, and verify and control it according to the priority range to ensure that the priority of the thread is within a reasonable range.

Benefits of technology

It effectively avoids resource competition caused by excessive or low thread priority setting, ensures resource occupation rights for high-priority tasks, and reduces the obstacles to critical tasks by low-priority tasks, and improves the real-time nature of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597420A_ABST
    Figure CN119597420A_ABST
Patent Text Reader

Abstract

The invention relates to a thread priority control method and device, computer equipment, a computer readable storage medium and a computer program product, relates to the technical field of containers, and can improve the real-time performance in thread scheduling. The method comprises the following steps: determining the highest priority and the lowest priority of container threads in a plurality of containers through a predetermined container configuration structure, and determining a priority range corresponding to the containers according to the highest priority and the lowest priority; in response to the thread creation operation, determining a priority parameter of the currently created thread; if the priority parameter belongs to the priority range, taking the priority parameter as a priority control parameter of the thread in the container; if the priority parameter is higher than the highest priority of the container thread, taking the highest priority as a priority control parameter of the thread in the container; and if the priority parameter is lower than the lowest priority of the container thread, taking the lowest priority as a priority control parameter of the thread in the container.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of container technology, and in particular to a thread priority control method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] With the development of container technology, container-based real-time systems have emerged. This technology has the characteristics of lightweight and strong isolation, and can deploy different applications in a multi-container environment, but lacks fine-grained real-time scheduling capabilities. In the current container scheduling method, thread priority configurations in different containers are prone to conflict. The lack of fine-grained real-time scheduling capabilities will lead to unreasonable preemption of CPU resources by low-priority threads during CPU resource allocation, thereby affecting the real-time response of high-priority tasks and causing the overall real-time performance of the system to be unstable. Summary of the invention

[0003] Based on this, it is necessary to provide a thread priority control method, device, computer equipment, computer-readable storage medium and computer program product that can improve the real-time performance of the system in response to the above technical problems.

[0004] In a first aspect, the present application provides a thread priority control method, comprising:

[0005] Determine the highest priority and the lowest priority of container threads in a plurality of containers through a predetermined container configuration structure, and determine a priority range corresponding to the container according to the highest priority and the lowest priority;

[0006] In response to a thread creation operation, determine the priority parameters of the currently created thread;

[0007] If the priority parameter belongs to the priority range, using the priority parameter as the priority control parameter of the thread in the container;

[0008] If the priority parameter is higher than the highest priority of the container thread, using the highest priority as the priority control parameter of the thread in the container;

[0009] If the priority parameter is lower than the lowest priority of the container thread, the lowest priority is used as the priority control parameter of the thread in the container.

[0010] In one of the embodiments, the method further comprises: determining, by means of the container configuration structure, default priorities of the container threads in a plurality of containers;

[0011] In response to the thread creation operation, in the event that the priority parameter of the thread fails to be determined, the thread is controlled in the container according to a default priority of the container thread.

[0012] In one embodiment, determining the highest priority and the lowest priority of container threads in multiple containers by using a predetermined container configuration structure includes:

[0013] Determine a current running configuration corresponding to the container configuration structure, and adjust the current running configuration through a priority management interface to obtain a target running configuration;

[0014] According to the state of the container, the adjusted target running configuration is applied to the container, and the highest priority and the lowest priority of the container thread are determined.

[0015] In one of the embodiments, applying the adjusted target running configuration to the container according to the state of the container and determining the highest priority and the lowest priority of the container thread include:

[0016] If the state of the container indicates that the container is not started, creating the container according to the target run configuration, and determining the highest priority and the lowest priority of the container thread;

[0017] If the state of the container indicates that the container is running, a new highest priority and a new lowest priority are re-determined according to the target highest priority and the target lowest priority in the target running configuration.

[0018] In one embodiment, the method further comprises:

[0019] Determining a plurality of processing core units corresponding to the container through the container configuration structure;

[0020] The processing core unit to which the thread corresponding to the priority control parameter is bound is determined according to the priority control parameter and the load state of the processing core unit.

[0021] In one of the embodiments, after determining the processing core unit to which the thread corresponding to the priority control parameter is bound according to the priority control parameter and the load state of the processing core unit, the method further includes:

[0022] Performing load status detection on the processing core unit to obtain a load status detection result;

[0023] If the load status detection result indicates that the processing core unit is overloaded, the thread corresponding to the highest priority control parameter is bound to the processing core unit according to the priority control parameter, and the threads other than the thread corresponding to the highest priority control parameter are unbound from the processing core unit.

[0024] In a second aspect, the present application further provides a thread priority control device, comprising:

[0025] A container priority range setting module, used to determine the highest priority and the lowest priority of container threads in multiple containers through a predetermined container configuration structure, and determine the priority range corresponding to the container according to the highest priority and the lowest priority;

[0026] A thread priority parameter determination module is used to respond to a thread creation operation and determine the priority parameter of the currently created thread;

[0027] A priority range matching module, for using the priority parameter as a priority control parameter of the thread in the container if the priority parameter belongs to the priority range;

[0028] A high priority boundary control module, for using the highest priority as a priority control parameter of the thread in the container if the priority parameter is higher than the highest priority of the container thread;

[0029] The low priority boundary control module is used to use the lowest priority as the priority control parameter of the thread in the container if the priority parameter is lower than the lowest priority of the container thread.

[0030] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0031] Determine the highest priority and the lowest priority of container threads in a plurality of containers through a predetermined container configuration structure, and determine a priority range corresponding to the container according to the highest priority and the lowest priority;

[0032] In response to a thread creation operation, determine the priority parameters of the currently created thread;

[0033] If the priority parameter belongs to the priority range, using the priority parameter as the priority control parameter of the thread in the container;

[0034] If the priority parameter is higher than the highest priority of the container thread, using the highest priority as the priority control parameter of the thread in the container;

[0035] If the priority parameter is lower than the lowest priority of the container thread, the lowest priority is used as the priority control parameter of the thread in the container.

[0036] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0037] Determine the highest priority and the lowest priority of container threads in a plurality of containers through a predetermined container configuration structure, and determine a priority range corresponding to the container according to the highest priority and the lowest priority;

[0038] In response to a thread creation operation, determine the priority parameters of the currently created thread;

[0039] If the priority parameter belongs to the priority range, using the priority parameter as the priority control parameter of the thread in the container;

[0040] If the priority parameter is higher than the highest priority of the container thread, using the highest priority as the priority control parameter of the thread in the container;

[0041] If the priority parameter is lower than the lowest priority of the container thread, the lowest priority is used as the priority control parameter of the thread in the container.

[0042] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0043] Determine the highest priority and the lowest priority of container threads in a plurality of containers through a predetermined container configuration structure, and determine a priority range corresponding to the container according to the highest priority and the lowest priority;

[0044] In response to a thread creation operation, determine the priority parameters of the currently created thread;

[0045] If the priority parameter belongs to the priority range, using the priority parameter as the priority control parameter of the thread in the container;

[0046] If the priority parameter is higher than the highest priority of the container thread, using the highest priority as the priority control parameter of the thread in the container;

[0047] If the priority parameter is lower than the lowest priority of the container thread, the lowest priority is used as the priority control parameter of the thread in the container.

[0048] The above-mentioned thread priority control method, device, computer equipment, computer-readable storage medium and computer program product determine the highest priority and the lowest priority of container threads in multiple containers through a predetermined container configuration structure, and determine the priority range corresponding to the container according to the highest priority and the lowest priority; respond to the thread creation operation, determine the priority parameter of the currently created thread; if the priority parameter belongs to the priority range, use the priority parameter as the priority control parameter of the thread in the container; if the priority parameter is higher than the highest priority of the container thread, use the highest priority as the priority control parameter of the thread in the container; if the priority parameter is lower than the lowest priority of the container thread, use the lowest priority as the priority control parameter of the thread in the container. In this application, by pre-setting the highest priority and the lowest priority of each container in the container configuration structure, the priority control range is clarified, avoiding the situation where the thread priority is set too high or too low, resulting in uncontrolled resource competition. When creating a thread, the priority control parameter of the thread can be verified and determined according to the priority range, which not only guarantees the resource occupation right of high-priority tasks, but also reduces the obstruction of low-priority tasks to critical tasks, effectively guarantees the rapid response requirements of important tasks in the system, and improves the real-time performance of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 A diagram of a container architecture in one embodiment;

[0051] Figure 2 A schematic diagram of a process flow of a thread priority control method in one embodiment;

[0052] Figure 3 is a flowchart of a thread priority control method in another embodiment;

[0053] Figure 4 is a structural block diagram of a thread priority control device in one embodiment;

[0054] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0056] In order to enable those skilled in the art to better understand the present application, the relevant technology is first introduced below.

[0057] Container technology is a virtualization technology used to provide a lightweight isolated environment, suitable for software development, deployment and operation. The application of this technology ensures the consistency of the development, testing and deployment environment, allowing the application software to encapsulate its related dependencies and software configurations into a container image, thereby avoiding package dependency conflicts caused by multiple different versions of application software when deployed and run in parallel. Therefore, container technology effectively realizes the decoupling between the software development team and the software users (production and operation and maintenance), allowing developers to focus on the development and iteration process without paying too much attention to the deployment and operation of the software. At the same time, software users can provide problem feedback based on a clear software version (container image), significantly shortening the troubleshooting time. Among them, Docker, as one of the current mainstream container technologies, provides container configuration, execution environment and lifecycle management.

[0058] In one embodiment, the thread priority control method, apparatus, computer device, computer readable storage medium and computer program product of the present application can be applied to Figure 1 In the container architecture shown, the container architecture is a distributed system architecture based on container technology, which is used to deploy, manage and run applications, package the applications and all their dependencies together, so that the applications can run consistently in different environments. The container architecture of the present application includes a priority management interface, a container configuration layer, a real-time container thread layer and a thread scheduling control layer, which can improve the real-time performance of the system during thread scheduling.

[0059] In one embodiment, Figure 2 As shown, a thread priority control method is provided. This embodiment uses the method applied to a server as an example for illustration. It can be understood that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0060] Step S202, determining the highest priority and the lowest priority of container threads in a plurality of containers through a predetermined container configuration structure, and determining a priority range corresponding to the container according to the highest priority and the lowest priority.

[0061] The container configuration structure is a structured data set used to describe the operating parameters in the container. It can exist in the form of a static configuration file (JSON) and is used to pre-set the resource limits and priority parameters (such as the highest priority and the lowest priority) of the threads in the container. The highest priority is to define the highest preemption level that the container thread can reach, which is used to control the maximum preemption capability of the thread. The lowest priority is to define the lowest preemption level of the thread, which limits the minimum response speed of the thread.

[0062] The priority range refers to the numerical interval defined by the highest priority and lowest priority fields in the container configuration structure, which represents the effective limit range of thread priorities in the container to prevent low-priority threads from affecting the response time of high-priority threads. Priority ranges do not interfere with each other between containers to avoid the same threads between containers during thread scheduling and unreasonable CPU resource preemption.

[0063] Exemplarily, the server reads the predefined configuration structure of each container and obtains the thread priority setting parameters contained therein, including the highest priority and the lowest priority. The server determines the priority range of each container based on the highest priority and the lowest priority in the container configuration structure. This range limits the preemption rights of threads in the container to ensure that the priority set when the thread is created remains within a reasonable range. During the configuration initialization of the container, the server sets the priority range to the container environment so that subsequent threads can be created and run within this range.

[0064] Optionally, when setting the priority parameter, the greater the value of the priority parameter, the lower the priority. In one embodiment, when the value of the priority parameter is limited to within the range of 0-255, the highest priority value is 0 and the lowest priority value is 255.

[0065] Step S204, responding to the thread creation operation, determining the priority parameter of the currently created thread.

[0066] The thread creation operation is triggered by a user or system call. The server responds to the thread creation operation and creates a new thread inside the container according to the task requirements and allocates the task execution flow. The priority parameter is a value set by the server when creating a thread. It is used to determine the priority of the thread in resource competition. The priority parameter can affect the order and frequency of the thread obtaining CPU resources.

[0067] Exemplarily, when a system task needs to create a new thread, in response to the thread creation operation, the server analyzes the basic parameters required for establishing the new thread, such as task type, priority parameters, etc. The server assigns the determined priority parameters to the thread, so that it has the corresponding resource competition priority.

[0068] Step S206: If the priority parameter belongs to the priority range, the priority parameter is used as a priority control parameter of the thread in the container.

[0069] The priority control parameter is a priority parameter value that is determined to be effective, and controls the priority performance of the thread in resource scheduling. The priority control parameter and the priority parameter value can be consistent in measurement to ensure that the resource acquisition right of the thread is within a controllable range.

[0070] Exemplarily, the server first reads the priority parameter of the newly created thread, and determines whether the priority parameter meets the range requirement based on the priority range of the container. When the priority parameter is within the priority range, the server directly identifies the priority parameter as the priority control parameter of the thread. The server assigns the determined priority control parameter to the thread, so that its subsequent resource acquisition and scheduling are completely based on this parameter.

[0071] Step S208: If the priority parameter is higher than the highest priority of the container thread, the highest priority is used as the priority control parameter of the thread in the container.

[0072] Exemplarily, the server reads the priority parameter value in the thread creation request and prepares to determine the priority range. If the priority parameter is higher than the highest priority, it means that the parameter exceeds the priority limit range of the container. The server sets the highest priority as the priority control parameter of the thread to ensure that the thread does not exceed the priority upper limit in the container when executing.

[0073] Step S210: If the priority parameter is lower than the lowest priority of the container thread, the lowest priority is used as the priority control parameter of the thread in the container.

[0074] Exemplarily, the server obtains the priority parameter value of the newly created thread and prepares to perform a range judgment. If the priority parameter is lower than the minimum priority, it is determined that the parameter is lower than the priority limit range of the container. The server assigns the minimum priority as the priority control parameter of the thread to ensure that the execution priority of the thread meets the minimum requirement of the container.

[0075] In the above thread priority control method, the highest priority and the lowest priority of the container threads in multiple containers are determined by a predetermined container configuration structure, and the priority range corresponding to the container is determined according to the highest priority and the lowest priority; in response to the thread creation operation, the priority parameter of the currently created thread is determined; if the priority parameter belongs to the priority range, the priority parameter is used as the priority control parameter of the thread in the container; if the priority parameter is higher than the highest priority of the container thread, the highest priority is used as the priority control parameter of the thread in the container; if the priority parameter is lower than the lowest priority of the container thread, the lowest priority is used as the priority control parameter of the thread in the container. In this embodiment, by presetting the highest priority and the lowest priority of each container in the container configuration structure, the priority control range is clarified, and the situation that the thread priority is set too high or too low, resulting in uncontrolled resource competition, is avoided. When creating a thread, the priority control parameter of the thread can be verified and determined according to the priority range, which not only guarantees the resource occupation right of high-priority tasks, but also reduces the obstruction of low-priority tasks to critical tasks, effectively guarantees the rapid response requirements of important tasks in the system, and improves the real-time performance of the system.

[0076] In an exemplary embodiment, the thread priority control method further includes the following steps: determining the default priority of container threads in multiple containers through a container configuration structure; responding to a thread creation operation, and controlling the thread in the container according to the default priority of the container thread when the thread priority parameter determination fails.

[0077] Priority parameter determination failure means that when creating a thread, the server fails to obtain a valid priority parameter because the request does not provide this parameter or the parameter value is not within a reasonable range. The default priority refers to the priority value preset in the container configuration structure, which is used to provide a basic priority setting for the thread when the priority parameter is missing or fails to be determined.

[0078] Specifically, when the server initializes the container, it obtains the default priority value of the thread in the container by reading the container configuration structure. This default priority is loaded when the container is initialized and remains unchanged during the life cycle of the container. When a new thread needs to be created in the container, the server receives a thread creation operation request and attempts to obtain the priority parameter from the request. The server determines whether the priority parameter in the thread creation request is valid. If the priority parameter fails to be determined (for example, the parameter is missing or exceeds a reasonable range), the server will abandon the parameter value and use the default priority as its scheduling basis to ensure that the thread can obtain resource scheduling according to the default priority.

[0079] In this embodiment, by applying the default priority, even if the priority parameter determination fails, effective priority control parameters can still be set for the thread, thereby avoiding scheduling uncertainty caused by the lack of priority parameters and maintaining the priority structure of the thread in the container and the stability of resource scheduling.

[0080] In an exemplary embodiment, in step S202, the highest priority and the lowest priority of container threads in multiple containers are determined through a predetermined container configuration structure, including: determining a current running configuration corresponding to the container configuration structure, adjusting the current running configuration through a priority management interface to obtain a target running configuration; applying the adjusted target running configuration to the container according to the state of the container, and determining the highest priority and the lowest priority of the container thread.

[0081] The current running configuration refers to the configuration state adopted by the container at runtime, including but not limited to the priority range of the current thread and resource allocation parameters. The target running configuration is the new configuration obtained after the server adjusts the current configuration, which is used to better adapt to the current task load. The priority management interface is a multi-channel interface mechanism, including but not limited to adjusting static configuration files (JSON files) and real-time command lines, for configuring and dynamically adjusting the priority range of the container.

[0082] Specifically, the server reads the current running configuration from the container configuration structure, including the currently set highest priority and lowest priority. The server uses the priority management interface to adjust the current running configuration, modify the highest priority and lowest priority values ​​therein, and generate a new target running configuration. The server applies the target running configuration to the container based on the current state of the container, replacing the old priority setting. The server confirms and records the highest priority and lowest priority in the target running configuration to control the resource scheduling priority of the container thread.

[0083] In this embodiment, a priority management method that combines static and dynamic priorities is provided through a priority management interface, which not only ensures that the container has a reasonable priority range when it is initialized, but also allows the container to quickly adapt to new task requirements during operation, thereby improving the scheduling efficiency and responsiveness of system resources.

[0084] In an exemplary embodiment, according to the state of the container, the adjusted target running configuration is applied to the container, and the highest priority and the lowest priority of the container thread are determined, including: if the state of the container indicates that the container is not started, the container is created according to the target running configuration, and the highest priority and the lowest priority of the container thread are determined; if the state of the container indicates that the container is running, the new highest priority and the new lowest priority are re-determined according to the target highest priority and the target lowest priority in the target running configuration.

[0085] Specifically, the server first checks the status of the container to determine whether the container has been started. If the container status indicates that it has not been started, the server creates a new container according to the target running configuration. When creating the container, the server extracts the highest priority and the lowest priority from the target running configuration and uses them as the initial priority range of the container thread. In one embodiment, when the container is not started, the server generates the target running configuration according to the priority settings in the static configuration file in the container configuration structure specified by the administrator.

[0086] If the container status indicates that it is running, the server applies the target highest priority and the target lowest priority in the target running configuration to the container and resets the current priority range. The adjusted priority range takes effect immediately to ensure that the threads in the container schedule resources according to the new priority range. In one embodiment, if the container is running, the administrator can use the command line to modify the priority settings in real time. The server adjusts the highest priority and the lowest priority in the current running configuration according to the command line input to obtain a new target running configuration.

[0087] In this embodiment, depending on whether the container has been started, a new container can be selectively created or the priority range of an existing container can be updated to ensure the rationality and flexibility of the priority configuration. At the same time, regardless of whether the container is newly started or running, by setting or updating the target priority range, it is possible to respond to task requirements in real time and optimize the efficiency of resource allocation.

[0088] In an exemplary embodiment, the thread priority control method also includes determining multiple processing core units corresponding to the container through a container configuration structure; and determining the processing core unit to which the thread corresponding to the priority control parameter is bound based on the priority control parameter and the load status of the processing core unit.

[0089] The load status of the processing core unit refers to the current task load of each core unit, indicating its available resources and processing capacity.

[0090] Specifically, the server determines the multiple processing core units corresponding to the current container through the container configuration structure. The server monitors the load status of each processing core unit in real time and records the status of the current processing task. The server selects a suitable processing core unit based on the priority control parameters of the thread and the load status of the current processing core unit, and binds the thread to the selected processing core unit. When the priority control parameter of the thread is high, the server binds it to a processing core unit with a lighter load or idle. When the priority of the thread is low, it is bound to a processing core unit with a higher load to balance resource usage. After selecting the processing core unit, the server binds the execution of the thread to the processing core unit to ensure that the thread can continue to use the specified processing core during subsequent execution.

[0091] In this embodiment, threads are bound according to the load status of the processing core unit, which effectively avoids overloading of some cores and optimizes the overall resource allocation of the system. At the same time, the thread binding strategy based on priority control parameters and load status makes the system more real-time and flexible in a multi-tasking environment, thereby improving scheduling efficiency.

[0092] In an exemplary embodiment, after determining the processing core unit to which the thread corresponding to the priority control parameter is bound based on the priority control parameter and the load status of the processing core unit, it also includes: performing load status detection on the processing core unit to obtain a load status detection result; if the load status detection result indicates that the load status of the processing core unit is overloaded, according to the priority control parameter, binding the thread corresponding to the highest priority control parameter and the processing core unit, and unbinding the threads except the thread corresponding to the highest priority control parameter from the processing core unit.

[0093] Specifically, the server detects the load status of each processing core unit corresponding to the container and evaluates its current operating pressure, including but not limited to indicators such as CPU usage and task backlog. The server determines whether the processing core unit is in an overloaded state based on the detection results. If the detection result indicates that the processing core unit is overloaded, it means that the processing core unit cannot efficiently handle the current task load and the task binding needs to be adjusted. In the case of an overloaded processing core unit, the server binds the thread corresponding to the highest priority control parameter to the processing core unit based on the priority control parameter to ensure that critical tasks can use the computing resources of the core first. Except for the thread corresponding to the highest priority control parameter, the server unbinds other threads from the processing core unit to release resources and reduce the load pressure on the core.

[0094] In this embodiment, by dynamically adjusting the thread binding strategy, the performance degradation caused by core unit overload is effectively avoided, and the stability and reliability of the system are improved.

[0095] In order to enable those skilled in the art to better understand the above steps, the embodiment of the present application is illustrated below by using an example, but it should be understood that the embodiment of the present application is not limited to this.

[0096] In an exemplary embodiment, Figure 3 As shown, the server reads the setting parameters from the container configuration structure, and the container configuration structure includes information such as the highest priority, the lowest priority, the default priority, and the bindable processing unit core of the container.

[0097] The server determines the highest and lowest priorities of threads in the container based on the parameters in the container configuration structure to form a priority range. When a new thread is created, the server receives the creation request and obtains or calculates the priority parameters of the thread in the request.

[0098] The server compares the thread's priority parameter with the container's priority range to determine whether the parameter is within the priority range. If the priority parameter is within the range, the priority parameter is directly used as the thread's priority control parameter. If the priority parameter is not within the range, the server determines whether the priority parameter is higher than the container's highest priority (i.e., the priority parameter value is less than the highest priority value). If the priority parameter is higher than the highest priority, the container's highest priority is used as the thread's priority control parameter. If the priority parameter is not higher than the highest priority, the server further determines whether the priority parameter is lower than the container's lowest priority (i.e., the priority parameter value is greater than the lowest priority value). If the priority parameter is lower than the lowest priority, the container's lowest priority is used as the thread's priority control parameter. The server finally determines the final priority control parameter, assigns the control parameter to the thread, and controls the thread's resource scheduling based on the priority parameter.

[0099] In this embodiment, by reasonably allocating thread priorities, the server can maximize resource utilization efficiency while ensuring that critical tasks are responded to first. This process ensures that each thread in the system runs according to the preset priority requirements, avoiding the situation where high-priority tasks are delayed due to excessive occupation of low-priority tasks, thereby optimizing overall resource scheduling.

[0100] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0101] Based on the same inventive concept, the embodiment of the present application also provides a thread priority device for implementing the thread priority method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more thread priority device embodiments provided below can refer to the limitations on the thread priority method above, and will not be repeated here.

[0102] In an exemplary embodiment, Figure 4 As shown, a thread priority device is provided, including: a container priority range setting module 410, a thread priority parameter determination module 420, a priority range matching module 430, a high priority boundary control module 440 and a low priority boundary control module 450, wherein:

[0103] The container priority range setting module 410 is used to determine the highest priority and the lowest priority of the container threads in the multiple containers through a predetermined container configuration structure, and determine the priority range corresponding to the container according to the highest priority and the lowest priority;

[0104] The thread priority parameter determination module 420 is used to respond to the thread creation operation and determine the priority parameter of the currently created thread;

[0105] A priority range matching module 430, configured to use the priority parameter as a priority control parameter of the thread in the container if the priority parameter belongs to the priority range;

[0106] A high priority boundary control module 440, configured to use the highest priority as a priority control parameter of the thread in the container if the priority parameter is higher than the highest priority of the container thread;

[0107] The low priority boundary control module 450 is used to use the lowest priority as the priority control parameter of the thread in the container if the priority parameter is lower than the lowest priority of the container thread.

[0108] In one embodiment, the container priority range setting module 410 is further used to determine the default priority of the container thread in multiple containers through the container configuration structure; in response to the thread creation operation, if the priority parameter of the thread fails to be determined, control the thread in the container according to the default priority of the container thread.

[0109] In one embodiment, the container priority range setting module 410 is further used to determine the current running configuration corresponding to the container configuration structure, adjust the current running configuration through the priority management interface to obtain the target running configuration; according to the state of the container, apply the adjusted target running configuration to the container, and determine the highest priority and the lowest priority of the container thread.

[0110] In one embodiment, the container priority range setting module 410 is further used to create the container and determine the highest priority and the lowest priority of the container thread according to the target running configuration if the state of the container indicates that the container has not been started; if the state of the container indicates that the container is running, re-determine the new highest priority and the new lowest priority according to the target highest priority and the target lowest priority in the target running configuration.

[0111] In one embodiment, the container priority range setting module 410 is further used to determine the multiple processing core units corresponding to the container through the container configuration structure; and determine the processing core unit to which the thread corresponding to the priority control parameter is bound according to the priority control parameter and the load status of the processing core unit.

[0112] In one embodiment, the container priority range setting module 410 is also used to perform load status detection on the processing core unit to obtain a load status detection result; if the load status detection result indicates that the load status of the processing core unit is overloaded, according to the priority control parameter, the thread corresponding to the highest priority control parameter is bound to the processing core unit, and the threads other than the thread corresponding to the highest priority control parameter are unbound from the processing core unit.

[0113] Each module in the above thread priority device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0114] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 5As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store container configuration structure data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a thread priority method is implemented.

[0115] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0116] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0117] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0118] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0119] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0120] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0121] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0122] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A thread priority control method, characterized in that: The method comprises: Determine the highest priority and the lowest priority of container threads in a plurality of containers through a predetermined container configuration structure, and determine a priority range corresponding to the container according to the highest priority and the lowest priority; In response to a thread creation operation, determine the priority parameters of the currently created thread; If the priority parameter belongs to the priority range, using the priority parameter as the priority control parameter of the thread in the container; If the priority parameter is higher than the highest priority of the container thread, using the highest priority as the priority control parameter of the thread in the container; If the priority parameter is lower than the lowest priority of the container thread, the lowest priority is used as the priority control parameter of the thread in the container.

2. The method according to claim 1, characterized in that The method further comprises: Determining, by means of the container configuration structure, default priorities of the container threads in a plurality of containers; In response to the thread creation operation, in the event that the priority parameter of the thread fails to be determined, the thread is controlled in the container according to a default priority of the container thread.

3. The method according to claim 1, characterized in that The method of determining the highest priority and the lowest priority of container threads in the plurality of containers by using a predetermined container configuration structure includes: Determine a current running configuration corresponding to the container configuration structure, and adjust the current running configuration through a priority management interface to obtain a target running configuration; According to the state of the container, the adjusted target running configuration is applied to the container, and the highest priority and the lowest priority of the container thread are determined.

4. The method according to claim 3, characterized in that The step of applying the adjusted target running configuration to the container according to the state of the container and determining the highest priority and the lowest priority of the container thread includes: If the state of the container indicates that the container is not started, creating the container according to the target run configuration, and determining the highest priority and the lowest priority of the container thread; If the state of the container indicates that the container is running, a new highest priority and a new lowest priority are re-determined according to the target highest priority and the target lowest priority in the target running configuration.

5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Determining a plurality of processing core units corresponding to the container through the container configuration structure; The processing core unit to which the thread corresponding to the priority control parameter is bound is determined according to the priority control parameter and the load state of the processing core unit.

6. The method according to claim 5, characterized in that After determining the processing core unit to which the thread corresponding to the priority control parameter is bound according to the priority control parameter and the load state of the processing core unit, the method further includes: Performing load status detection on the processing core unit to obtain a load status detection result; If the load status detection result indicates that the processing core unit is overloaded, the thread corresponding to the highest priority control parameter is bound to the processing core unit according to the priority control parameter, and the threads other than the thread corresponding to the highest priority control parameter are unbound from the processing core unit.

7. A thread priority control device, characterized in that: The device comprises: A container priority range setting module, used to determine the highest priority and the lowest priority of container threads in multiple containers through a predetermined container configuration structure, and determine the priority range corresponding to the container according to the highest priority and the lowest priority; A thread priority parameter determination module is used to respond to a thread creation operation and determine the priority parameter of the currently created thread; A priority range matching module, for using the priority parameter as a priority control parameter of the thread in the container if the priority parameter belongs to the priority range; A high priority boundary control module, for using the highest priority as a priority control parameter of the thread in the container if the priority parameter is higher than the highest priority of the container thread; The low priority boundary control module is used to use the lowest priority as the priority control parameter of the thread in the container if the priority parameter is lower than the lowest priority of the container thread.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Processing method based on client request and related device

    CN118445043A

  • Method and device for setting priority of processes in container

    CN118535274A

  • Virtualized hardware support for mobile devices

    US10027351B1

  • Apparatus and method of integrating a workload manager with a system task scheduler

    US20030236815A1

  • Method for prioritizing web service requests

    US20070263650A1