Disclosure of Invention
The application aims to provide a system resource control method, a system resource control device, a server and a computer readable storage medium based on a terminal process fusing algorithm, so as to improve the effect of controlling system resources.
In order to solve the technical problem, the application provides a system resource control method based on a terminal process fusing algorithm, which comprises the steps of
Fusing processes meeting the conditions in the process group based on the process fusing threshold, and classifying to obtain a fused process list and an unblown process list;
judging whether system resources are idle or not based on a system fusing threshold value;
if so, performing process starting processing based on the fused process list and the process running resource value;
and if not, carrying out process fusing processing based on the unblown process list.
Optionally, fusing the processes meeting the conditions in the process group based on the process fusing threshold, and performing classification processing to obtain a fused process list and an unblown process list, including:
acquiring the resource use condition of each process in the process group based on a preset period;
judging whether the resource use condition of each process is smaller than the process fusing threshold value;
if so, adding the process to the unblown process list;
and if not, fusing the process, and adding the process into the fused process list.
Optionally, before the step of performing fusing processing on the eligible processes in the process group, the method further includes:
acquiring information of a non-emergency task process group and a non-emergency task process group; the non-emergency task process group information comprises a process fusing threshold and priority data;
and marking the non-urgent task process group as the process group.
Optionally, before the step of performing fusing processing on the eligible processes in the process group, the method further includes:
and clearing the unblown process list.
Optionally, determining whether the system resource is idle based on the system fusing threshold includes:
acquiring a system resource threshold value and a current system resource use value;
and judging whether the current system resource usage value is smaller than the system resource threshold value.
Optionally, the process starting processing is performed based on the fused process list and the process running resource value, and includes:
acquiring a process with the highest priority from the fused process list as a first process;
judging whether the process running resource value of the first process is smaller than the current system resource idle value;
and if so, carrying out process starting processing on the first process.
Optionally, performing process fusing processing based on the unblown process list includes:
acquiring a process with the lowest priority from the unblown process list as a second process;
and carrying out process fusing processing on the second process, and adding the second process to the fused process list.
The present application further provides a system resource control device based on a terminal process fusing algorithm, including:
the process monitoring module is used for carrying out fusing processing on the processes meeting the conditions in the process group based on the process fusing threshold value, and classifying the processes to obtain a fused process list and an unblown process list;
the system monitoring module is used for judging whether system resources are idle or not based on a system fusing threshold value;
the process pull-up module is used for carrying out process starting processing based on the fused process list and the process running resource value when the system resource is idle;
and the process fusing module is used for carrying out process fusing processing based on the unblown process list when the system resource is not idle.
The present application further provides a server, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the system resource control method as described above when executing the computer program.
The present application also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the system resource control method as described above.
The system resource control method based on the terminal process fusing algorithm comprises the steps of fusing processes meeting conditions in a process group based on a process fusing threshold value, and obtaining a fused process list and an unblown process list through classification processing; judging whether system resources are idle or not based on a system fusing threshold value; if so, performing process starting processing based on the fused process list and the process running resource value; and if not, carrying out process fusing processing based on the unblown process list.
Fusing the processes meeting the conditions in the process group through the process fusing threshold value, fusing the unsuitable processes, and further continuing to fuse the processes or starting the processes based on the service condition of the system resources, so that the granularity of managing and controlling the system resources is improved, and the control effect of controlling the system resources is improved.
The application also provides a system resource control device, a server and a computer readable storage medium based on the terminal process fusing algorithm, which have the beneficial effects and are not described herein any more.
Detailed Description
The core of the application is to provide a system resource control method, a system resource control device, a server and a computer readable storage medium based on a terminal process fusing algorithm, so as to improve the effect of controlling system resources.
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the related art, system resources are allocated to users based on different usage characteristics and usage situations of the users. However, the system resource allocation effect based on the user is poor, and the resources used by the processes in the system cannot be controlled in more detail, so that the control effect of system resource control is reduced, and the utilization rate of the system resources is reduced.
Therefore, the method for controlling the system resources based on the terminal process fusing algorithm carries out fusing processing on the processes meeting the conditions in the process group through the process fusing threshold value, fuses the unsuitable processes, and selects to further continue fusing the processes or start the processes based on the service condition of the system resources, so that the granularity of managing and controlling the system resources is improved, and the control effect of controlling the system resources is improved.
The following describes a system resource control method based on a terminal process fusing algorithm according to an embodiment.
Referring to fig. 1, fig. 1 is a flowchart of a system resource control method based on a terminal process fusing algorithm according to an embodiment of the present disclosure.
In this embodiment, the method may include:
s101, fusing processes meeting conditions in a process group based on a process fusing threshold value, and classifying to obtain a fused process list and an unblown process list;
therefore, the fusing processing is performed on the processes meeting the conditions in the process group based on the process fusing threshold, and the fused process list and the unblown process list are obtained through classification processing.
Further, the step may include:
step 1, acquiring the resource use condition of each process in a process group based on a preset period;
step 2, judging whether the resource use condition of each process is smaller than a process fusing threshold value;
step 3, if yes, adding the process into the unblown process list;
and 4, if not, fusing the process, and adding the process into the fused process list.
It can be seen that the present alternative scheme mainly explains how to perform the fusing processing on the processes. In the alternative scheme, the resource use condition of each process in the process group is obtained based on a preset period, whether the resource use condition of each process is smaller than a process fusing threshold value or not is judged, if yes, the process is added into an un-fused process list, and if not, the process is fused and added into a fused process list. Obviously, in this alternative, a corresponding judgment operation is performed on each process in the process group to determine whether the process needs to perform a fusing operation, and the process performing the fusing processing is added to the fused process list for subsequent processing. And saving the processes meeting the process fusing threshold in the unblown process list.
Further, the method can further comprise the following steps:
step 1, acquiring information of a non-emergency task process group and a non-emergency task process group; the non-emergency task process group information comprises a process fusing threshold and priority data;
and 2, marking the non-emergency task process group as a process group.
It can be seen that the present alternative scheme mainly describes how to acquire a process group. In the alternative, information of a non-emergency task process group and a non-emergency task process group is obtained; the information of the non-emergency task process group comprises a process fusing threshold value and priority data, and the non-emergency task process group is marked as a process group. Therefore, in the alternative, the non-emergency task process in the system is mainly used as the process in the process group, so that the non-emergency task in the system is regulated and controlled, and the process operation in the system is not influenced.
Further, the method can further comprise the following steps:
and clearing the unblown process list.
Therefore, in the alternative scheme, the processes in the unblown process list are mainly cleared.
S102, judging whether system resources are idle or not based on a system fusing threshold value; if yes, executing S103; if not, executing S104;
on the basis of S101, this step is intended to determine whether there is a vacancy in the system resource based on the system fusing threshold. That is, it is determined whether there is sufficient free system resources currently available to determine whether to start the process or to continue to blow the process.
Further, the step may include:
step 1, acquiring a system resource threshold value and a current system resource use value;
and 2, judging whether the current system resource use value is smaller than a system resource threshold value.
It can be seen that the present alternative scheme is mainly illustrative of how the determination may be made. In this alternative, the system resource threshold and the current system resource usage value are obtained, and it is determined whether the current system resource usage value is less than the system resource threshold. That is, in this alternative, it is determined whether the current system resource usage value is less than the system resource threshold. When less than, it indicates that there is idle system resources at this time. When the value is not less than the threshold value, the system is not idle, and the used resources exceed the threshold value, and the resources need to be controlled.
S103, performing process starting processing based on the fused process list and the process running resource value;
on the basis of S102, this step is intended to perform process start processing based on the blown process list and the process execution resource value.
Further, the step may include:
step 1, acquiring a process with the highest priority from a fused process list as a first process;
step 2, judging whether the process running resource value of the first process is smaller than the current system resource idle value;
and 3, if so, performing process starting processing on the first process.
It can be seen that the present alternative scheme mainly illustrates how the process start-up is performed. In this alternative, the process with the highest priority is obtained from the fused process list and used as the first process, whether the process running resource value of the first process is smaller than the current system resource idle value is judged, and if yes, the process starting processing is performed on the first process. That is, the first process is obtained from the fused process list, and then whether the running resource requirement of the first process meets the current idle value is judged, if yes, the first process can be subjected to line start operation.
And S104, performing process fusing processing based on the unblown process list.
On the basis of S102, this step is intended to perform process blowing processing based on the unblown process list.
Further, the step may include:
step 1, acquiring a process with the lowest priority from an unblown process list as a second process;
and 2, carrying out process fusing processing on the second process, and adding the second process to the fused process list.
It can be seen that the present alternative is primarily illustrative of how process fusing may be performed. In this alternative, the process with the lowest priority is obtained from the unblown process list as the second process, the process fusing process is performed on the second process, and the second process is added to the fused process list. That is, the process in the unblown process list is subjected to the second process for the blowing process.
In summary, in this embodiment, the process meeting the condition in the process group is fused by the process fusing threshold, the improper process is fused, and further fusing or starting the process is selected based on the use condition of the system resource, so that the granularity of managing and controlling the system resource is improved, and the control effect of controlling the system resource is improved.
The following further describes a system resource control method based on a terminal process fusing algorithm, provided by the present application, by a specific embodiment.
In a specific application scenario, a system may run many processes, wherein many processes execute emergency tasks, and the emergency tasks need to be protected to ensure that the processes of the emergency tasks have sufficient system resources to execute. Some processes are non-emergency task processes, and need to manage the maximum use of resources, and when exceeding a maximum threshold, the processes need to be fused. And when the total system resources are deficient, the resources of the non-emergency task process need to be released, and the normal operation of the emergency task process of the system is ensured to the maximum extent. And when the total resources of the system are sufficient, pulling up the fused non-emergency task process to ensure that the non-emergency task can run.
And (3) real-time monitoring: and circulating is needed, and the resource use condition of each process in the non-emergency task process group and the use condition of system font resources are monitored in real time. To process the management and control operation of the resource.
Process resource management and control: setting a maximum resource use threshold value for each non-emergency task process, monitoring the real-time condition of resource use of all the non-emergency task processes, and immediately closing the processes exceeding the threshold value to release the use of the resources.
And (3) system resource management and control: and setting a threshold value for the maximum resource use of the system, monitoring the use condition of the total resources of the system in real time, and fusing the process with the lowest priority in the non-emergency task process group when the use condition of the total resources of the system exceeds the threshold value, so that the total resources of the system are ensured to be abundant. Meanwhile, under the condition of abundant system resources, the process with the highest priority in the non-emergency task process group needs to be pulled up, and the operation of the non-emergency task is considered.
Solving the process oscillation problem: and adopting a mode of waiting for starting and collecting data. Waiting to start means that a non-urgent task process is pulled up, and the starting process may consume more resources, and at this time, the process needs to wait for a period of time before starting to monitor the process. The data acquisition means that the resource use average values of the processes are counted during the process monitoring, and when the processes need to be pulled up, the process can be pulled up only by reserving the average resource use values of the processes. Moreover, each time the system is started, the resource threshold of the system cannot just meet the pull-up condition, but a certain idle resource value should exist, and the idle resource value can be generally set to a value below 10.
Process priority: and setting a priority level 1-9 for the non-urgent task process, wherein the larger the priority number is, the higher the priority level is, and the smaller the number is, the lower the priority level is. Priority ensures that high priority processes run.
Process fusing/Pull strategy: and setting a priority for each process for all non-emergency task processes, and ensuring the process with high priority to run. Therefore, processes with a low priority are blown in a limited manner when blowing, and processes with a high priority are pulled up in a preferential manner when pulling.
Resource usage value comparison: the resource should be a composition that may contain common, sensitive resources such as: CPU, memory, disk IO, network IO, etc. to monitor these resource information. Whenever a sensitive resource exceeds a threshold, it is determined that its resource usage exceeds a threshold and should be blown.
ps: one or more sets of the non-urgent task processes, that is, the process group, may be provided. And different priorities can be set for different processes, the process with the low priority is firstly fused, and the process with the high priority is pulled up preferentially.
SysMax: and a threshold value representing the use of system resources, and fusing the process with the lowest priority in the process group when the total system resources exceed the threshold value, so as to ensure that the system resources are abundant.
SysCur: the current resource utilization value of the system is represented, and the real-time acquisition should be circulated.
ProcMax [ p ]: and representing a resource threshold value of the process p in the process group, and fusing the process p to release the process to occupy the resource when the real-time resource usage value of the process p exceeds the value.
ProcCur [ p ]: representing the current resource usage of the process p, should be acquired in real time in a loop.
KillList: the process queue is a fused process list, stores all processes fused due to the fact that the use of the resources of the processes exceeds a threshold value and the system resources are deficient, and the queue is sequenced according to the priority of the processes from high to low, so that the processes with high priority are guaranteed to be pulled up preferentially.
Avg [ p ]: the average resource usage value of the process p in the process group is shown, and the resource of the process p should be calculated into Avg [ p ] every time the resource usage condition of the process in the steady state is obtained.
SysFree: for example, when determining whether the blowing process p satisfies the pull-up condition, the idle value of the system resource with respect to SysMax needs to satisfy the condition (SysCur + Avg [ p ] + SysFree) < SysMax, so that the process p can be pulled up. And may be set to 5% in general.
CurProcAlive: the queue should be sorted according to the priority of the processes from low to high, so that the process with the lowest priority can be fused at the first time when the system resource exceeds a threshold value.
The process of monitoring the process group may include:
step 1, starting a monitoring process, acquiring non-emergency task process group information, including data such as a process threshold value, a priority and the like, and marking the information as a process group ps.
And 2, resetting the CurProcAlive list to be empty, and waiting for storing the information of the survival non-emergency task process.
And step 3, traversing the processes in the process group ps and marking as the current process p.
And step 4, acquiring the real-time resource use condition of the process p, and marking the real-time resource use condition as ProcCur [ p ].
And step 5, updating the average resource utilization value Avg [ p ] of the process p by using the ProcCur [ p ].
And 6, judging whether the process p needs to be fused, wherein the fusing condition is ProcMax [ p ] > ProcCur [ p ], if the condition is true, adding the process p into a CurProcAlive list, continuing to execute the step 3, and monitoring the next process. If the condition is false, go to step 7 to prepare for the fusing process.
And 7, fusing the process p, putting the process p into the KillList, and waiting for the idle resources to pull up the process.
And 8, circularly executing the steps 3-7 until all the processes in the process group ps are traversed.
And 9, executing a system monitoring flow.
The process of system monitoring may include:
step 1, starting system resource monitoring and obtaining a system resource threshold SysMax.
And 2, acquiring the use value SysCur of the current system resource.
And step 3, judging the fusing condition, wherein SysCur is less than SysMax. If the condition is true, the process pull flow is executed. If the condition is false, executing the process fusing flow.
The process fusing process may include:
step 1, acquiring a process p with the lowest priority of the processes in the CurProcAlive, fusing the process p, putting the process p into a KillList, and waiting for the resources to be free to pull up the process.
And 2, acquiring the use value SysCur of the current system resource.
And step 3, judging the fusing condition, wherein SysCur is less than SysMax. If the condition is true, executing the process group monitoring flow.
And 4, circularly executing the steps 1-3. And executing a process group monitoring flow until the CurProcAlive is empty.
The process pull-up process may include:
step 1, acquiring the process p with the highest priority from the KillList.
And step 2, judging whether the process p meets a pull-up condition (SysCur + Avg [ p ] + SysFree) < SysMax, and executing the step 3 if the condition is true. If the condition is false, executing the process group monitoring flow.
And 3, pulling up the process p and deleting the process p from the killList.
And 4, acquiring the use value SysCur of the current system resource.
And 5, circularly executing the steps 1-4. And executing the process group monitoring process until the KillList is empty.
Therefore, in the embodiment, the processes meeting the conditions in the process group are fused through the process fusing threshold, the improper processes are fused, and further fusing or starting the processes is selected based on the service condition of the system resources, so that the granularity of managing and controlling the system resources is improved, and the control effect of controlling the system resources is improved.
In the following, the system resource control device based on the terminal process fusing algorithm provided in the embodiment of the present application is introduced, and the system resource control device based on the terminal process fusing algorithm described below and the system resource control method based on the terminal process fusing algorithm described above may be referred to correspondingly.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a system resource control device based on a terminal process fusing algorithm according to an embodiment of the present disclosure.
In this embodiment, the apparatus may include:
theprocess monitoring module 100 is configured to perform fusing processing on processes meeting conditions in the process group based on a process fusing threshold, and perform classification processing to obtain a fused process list and an unblown process list;
thesystem monitoring module 200 is configured to determine whether system resources are idle based on a system fusing threshold;
the process pull-upmodule 300 is configured to, when system resources are idle, perform process starting processing based on the fused process list and the process running resource value;
and theprocess fusing module 400 is configured to perform process fusing processing based on the unblown process list when the system resource is not idle.
An embodiment of the present application further provides a server, including:
a memory for storing a computer program;
a processor for implementing the steps of the system resource control method as described in the above embodiments when executing the computer program.
The present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the system resource control method according to the foregoing embodiment are implemented.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above provides a system resource control method, a system resource control device, a server and a computer readable storage medium based on a terminal process fusing algorithm. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.