Process control method and device, electronic equipment and storage medium
By dynamically managing the process according to the control function configuration, the process's unlimited occupation of system resources is solved, and the system operation efficiency and user experience are improved.
Patent Information
- Application Number
- CN202510470030.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-15
- Publication Date
- 2025-08-19
AI Technical Summary
When existing operating systems face greedy tasks or tasks with high resource utilization, the process will occupy a large amount of system resources without limitation, resulting in system lag and low operational efficiency.
By determining the target control function items according to the control function configuration, and performing control operations when their corresponding conditions are met, such as freezing the process, and releasing the control operations on the target process to optimize resource use.
It realizes flexible management of processes, avoids excessive system resources, and improves system operation efficiency and user experience.
Smart Images

Figure CN120508358A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a process control method, device, electronic device, and storage medium. Background Art
[0002] A process is the execution of a program in an operating system and the basic unit for resource allocation and scheduling. Composed of a program segment, a data segment, and a process control block, a process implements specific functions. However, the execution of a process consumes system resources, necessitating process management.
[0003] In related technologies, most operating systems (such as GNU or Linux) use a fair scheduling algorithm to manage processes, schedule each process fairly, and do not differentiate the priorities of the processes to ensure that all processes can be processed.
[0004] However, due to the use of fair scheduling, when there are greedy tasks, tasks with high resource utilization or other situations, the related processes will occupy a large amount of system resources, causing system lag and low system operation efficiency. Summary of the Invention
[0005] In view of the above problems, an embodiment of the present application is proposed to provide a process control method that overcomes the above problems or at least partially solves the above problems, which can avoid the situation where related processes occupy a large amount of system resources without restriction and improve the system operation efficiency.
[0006] Correspondingly, the embodiments of the present application also provide a process control device, an electronic device, and a storage medium to ensure the implementation and application of the above method.
[0007] In a first aspect, an embodiment of the present application discloses a process control method, the method comprising:
[0008] Determine the target control function item that is in the on state according to the control function configuration; the control function configuration is used to indicate the on / off state of each control function item; different control function items correspond to different control conditions;
[0009] When the control condition corresponding to the target control function item is met, determining the target process corresponding to the target control function item, and performing a control operation to control the target process;
[0010] When the control condition corresponding to the target control function item changes from satisfied to unsatisfied, a process release operation is performed to release the control of the target process.
[0011] In a second aspect, an embodiment of the present application discloses a process control device, the device comprising:
[0012] A function configuration module is used to determine the target control function items in the on state according to the control function configuration; the control function configuration is used to indicate the on / off state of each control function item; different control function items correspond to different control conditions;
[0013] A process control module is used to determine a target process corresponding to the target control function item and perform a control operation to control the target process when a control condition corresponding to the target control function item is met;
[0014] The process decontrol module is used to execute a process decontrol operation to release the control of the target process when the control condition corresponding to the target control function item changes from satisfied to not satisfied.
[0015] In a third aspect, an embodiment of the present application discloses an electronic device comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the steps of any process control method described above.
[0016] In a fourth aspect, an embodiment of the present application discloses a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the process control method described in any one of the embodiments of the present application can be implemented.
[0017] The process control method, device, electronic device, and storage medium provided by the embodiments of the present application have the following advantages:
[0018] The present application provides a process control method that can be used to control processes. The present application determines the target control function item that is in the open state according to the control function configuration, and when the control conditions corresponding to the target control function item are met, determines the target process corresponding to the target control function item, executes the control operation to control the target process, and when the control conditions corresponding to the target control function item are converted from satisfied to unsatisfied, executes the process release operation to release the control of the target process. The control function can be flexibly turned on or off based on the control function configuration, and then the process can be flexibly managed according to the control conditions corresponding to different target control function items. It can be controlled according to specific needs, avoiding the problems of system freezes and high power consumption caused by system processes occupying a large amount of system resources, thereby improving the system operation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 This is a flowchart of a process control method embodiment provided by an embodiment of the present application;
[0020] Figure 2 This is a flowchart of a process freezing when a window focus changes event provided by an embodiment of the present application;
[0021] Figure 3 This is a flowchart of process whitelist comparison provided by an embodiment of the present application;
[0022] Figure 4 This is a flow chart of control based on focus control items provided in an embodiment of the present application;
[0023] Figure 5 This is a flowchart of the control release process provided by the embodiment of the present application;
[0024] Figure 6 This is a flowchart of a first-stage static state corresponding to no input event within a first preset time period provided by an embodiment of the present application;
[0025] Figure 7 This is a flow chart of control based on static control items provided in an embodiment of the present application;
[0026] Figure 8 This is a flow chart of control based on fixed control items provided in an embodiment of the present application;
[0027] Figure 9 This is a flow chart of control based on automatic control items provided in an embodiment of the present application;
[0028] Figure 10 This is a flowchart of the collaborative work of multiple functional items provided in the embodiment of the present application;
[0029] Figure 11 This is a structural block diagram of an embodiment of a process control device provided in an embodiment of the present application;
[0030] Figure 12 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0032] The terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, the term "and / or" in the specification and claims is used to describe the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In the embodiments of this application, the term "multiple" refers to two or more, and other quantifiers are similar.
[0033] Figure 1 A flowchart of an embodiment of a process control method of the present application is shown. The method may include the following steps:
[0034] Step 101: Determine the target control function item that is in an on state according to the control function configuration; the control function configuration is used to indicate the on / off state of each control function item; different control function items correspond to different control conditions;
[0035] Step 102: If the control condition corresponding to the target control function item is met, determine the target process corresponding to the target control function item, and perform a control operation to control the target process;
[0036] Step 103: When the control condition corresponding to the target control function item changes from satisfied to unsatisfied, a process release operation is performed to release the control of the target process.
[0037] The process control method of the embodiment of the present application can be applied to computer devices running an operating system, and the computer devices may include but are not limited to any of the following: servers, smart phones, tablet computers, e-book readers, laptop computers, car computers, desktop computers, smart TVs, wearable devices, etc.
[0038] The embodiments of the present application do not limit the type of operating system, for example, it may include but is not limited to GUN, Linux, X11 system (or X Window system, which is a window system with bitmap display), UOS (Unicom Desktop Operating System), Kylin Operating System, Fangde Operating System and others.
[0039] In the embodiment of the present application, the control function configuration can be understood as a switch set, which records whether each control function item is on or off. When the system starts, the control function configuration can be read to filter out the function item in the on state, namely the target control function item.
[0040] The specific content of the management and control function configuration can be modified by the user. The user can operate on an interactive interface provided by the system, such as a control interface, to turn on or off a specific management and control function item.
[0041] For example, suppose a user sets the switches of control function item A and control function item B to "On" and control function item C to "Off" in the control interface of the system settings. By reading the control function configuration, control function item A and control function item B can be determined as the target control function items.
[0042] Each target control function item has a corresponding control condition, which is used to determine whether a process needs to be controlled. When the control condition of a target control function item is detected to be met, the corresponding target process can be found and the control operation can be performed. The target process corresponding to each control function item can be preset or determined in real time based on the operating parameters corresponding to each process, such as the utilization rate of various resources. The method of determining the target process corresponding to the target control function item is not specifically limited here.
[0043] After finding the target process, the system can perform corresponding control operations, including but not limited to freezing the process, limiting the resource usage of the process, etc., in order to manage the process's use of system resources. Among them, the execution of the control operation can be based on the kernel mechanism. For example, when freezing the process, it can be based on the cgroup (control group) provided by the Linux kernel. The cgroup is a mechanism that can manage and control resources for a group of processes. The freezer subsystem of the cgroup provides the function of freezing and thawing the process. The process identifier (PID, Process Identification) of a specific process can be written into the file of the cgroup group, thereby moving the specific process to the cgroup group with the freezing parameters set to freeze the process. The freezer subsystem can suspend the execution of all target processes in the group, making the target process in an inoperable state, but all resources and states of the process can be retained.
[0044] The system can continuously monitor the control conditions of the target control function item. When the condition changes from a satisfied state to an unsatisfied state, it means that the control previously applied to the target process is no longer necessary. The system can perform a process decontrol operation, which corresponds to the control operation, to restore the normal operation of the target process, allowing the target process to continue to use resources according to normal system scheduling rules, ensuring the flexibility of system operation and the continuity of process execution. For example, when the control condition corresponding to the target control function item is satisfied, the control operation performed on the target process is to freeze the process; when the control condition of the target control function item changes from a satisfied state to an unsatisfied state, a decontrol operation can be performed on the target process, such as performing a thawing operation.
[0045] The unfreezing operation includes, but is not limited to, unfreezing a process and removing restrictions on resource usage of a process. Similarly, the unfreezing operation can be performed based on the process ID of the target process and by utilizing the unfreezing process mechanism provided by the kernel. The target process can then continue to run, ensuring that user operations are responded to in a timely manner.
[0046] Optionally, the target control function item includes a focus control item; and the control condition corresponding to the focus control item includes the occurrence of a window focus change event.
[0047] The step 102 of determining a target process corresponding to the target control function item when the control condition corresponding to the target control function item is satisfied includes:
[0048] Step 1021: When the window focus change event occurs, determine the process corresponding to the target window that has lost focus as the target process.
[0049] In this embodiment of the present application, the target control function item is a set of functions that can be enabled in the system and used to control the process. The target control function item can include the focus control item. The focus control item can be understood as focusing on changes in window focus and triggering subsequent control operations based on this.
[0050] A window focus change event occurs in a graphical user interface (GUI) when the window currently receiving input focus changes, such as by a mouse click or keyboard shortcut. For example, switching from a text editor window to a browser window triggers a window focus change event.
[0051] When the control condition corresponding to the focus control item is met, that is, when a window focus change event occurs, it is necessary to determine the target process to be controlled. In the embodiment of the present application, the target process is the process corresponding to the target window that lost focus. Since different windows are usually supported by different processes, the target process can be found through the corresponding relationship between windows and processes.
[0052] For example, in an operating system, each window is managed and displayed by one or more processes. The operating system can maintain a mapping table between windows and processes, through which the corresponding process can be found based on the window information.
[0053] When a window focus change event occurs, the data of the window focus change event may carry window information such as a window ID (Identification). The corresponding process ID can be found in the mapping table based on the window ID that lost focus, thereby determining the target process.
[0054] In addition, the window information (eg, window handle) may be input into a preset function (eg, XGetWindowProperty) based on the window information to obtain the corresponding process information. How to determine the target process corresponding to the target window is not specifically limited here.
[0055] Figure 2 This is a flowchart of a process freezing when a window focus changes event provided by an embodiment of the present application;
[0056] Step 201: Obtain window focus change event data carrying the window ID;
[0057] Step 202, determining the window ID in the window focus change event data;
[0058] Step 203, determining the process ID corresponding to the window ID;
[0059] Step 204, record the window ID and the corresponding process ID;
[0060] Step 205: Freeze the target process corresponding to the process ID.
[0061] For example, in a multitasking operating system, a user has three windows open simultaneously: a text editor, a browser, and a music player. While the user is typing in the text editor, they click on the browser window, triggering a window focus change event. The target window that loses focus is the text editor window. The operating system can query the window-process mapping table to find the process ID corresponding to the text editor window (assuming the process ID is 1234). The process with process ID 1234 is then the target process that requires process control.
[0062] The system can control the target process according to preset rules, such as reducing the central processing unit (CPU) usage time of the target process, or temporarily freezing the target process until the window regains focus, and then restore the process corresponding to the window to normal operation.
[0063] In implementing the embodiments of the present application, when a window loses focus, the window may no longer need to respond to some operations immediately. Therefore, in the event of a window focus change event, the process corresponding to the target window that lost focus is determined to be the target process, and the target process can be managed and controlled, so that more system resources can be allocated to the process corresponding to the window currently having focus and other processes, thereby improving the overall performance and response speed of the system, and dynamically managing system resources based on changes in window focus, thereby improving the system's operating efficiency and user experience.
[0064] Optionally, when the window focus change event occurs, step 1021 of determining the process corresponding to the target window that has lost focus as the target process includes:
[0065] Step 10211: When the window focus change event occurs, determine the first application corresponding to the window that loses focus and the second application corresponding to the window that gains focus.
[0066] Step 10212: If the first application and the second application are different, determine the window that has lost focus as a target window;
[0067] Step 10213: Determine the target process corresponding to the target window according to the window information of the target window.
[0068] In an embodiment of the present application, the type of the target window can be a main window or a child window. The main window is generally the main interface container of the application and represents a complete application instance; the child window is usually an auxiliary window that depends on the existence of the main window, such as a dialog box, a floating toolbar, etc. The child window is mainly used to provide users with more detailed interactive functions.
[0069] For example, consider a text editor and a browser currently open. A user was originally entering text in the text editor's window (either the main window or a subwindow) when they clicked on the browser window (either the main window or a subwindow), shifting the window focus from the text editor to the browser window. The first application corresponding to the window that lost focus is different from and inconsistent with the second application corresponding to the window that gained focus. Therefore, the text editor's window is the target window that lost focus in this window focus change event, i.e., the target window.
[0070] It is understandable that if the window focus changes only between subwindows of the same application, or between a subwindow and the main window of the same application, then the first application corresponding to the window that loses focus and the second application corresponding to the window that gains focus are the same. This means that the application currently used by the user has not changed, and the corresponding process can continue to run normally.
[0071] In a specific implementation, each window has a main process, and this application freezes the main process. For example, after a text editing application is running, a series of processes can be started, but there is only one window main process. Furthermore, this application is aimed at the scenario of switching between different applications. If the focus changes between windows of the same application, the window of the application will not be frozen because the main process of these windows is the same. For example, if you use a text editing application to edit text and switch the focus between the sub-windows of the text editing application, the freezing operation of this application will not be triggered. If you switch the focus to other applications, such as switching to an email application, the text editing application will be frozen.
[0072] Among them, if the target window is the main window, the target process can be determined directly based on the main window ID; if the target window is a child window, the main window ID can be determined first based on the child window information, such as the window ID, and then the target process can be determined based on the main window ID, where the target process can refer to the main process of the window corresponding to the application. Freezing the main process can freeze the corresponding application.
[0073] In an embodiment of the present application, when a window focus change event occurs, it is first determined whether the first application corresponding to the window that lost focus and the second application corresponding to the window that gained focus are consistent. If they are different, it indicates that the application currently used by the user has changed. The process corresponding to the previous first application can be managed, and the target process can be determined based on the target window that lost focus. It can accurately judge whether the user's application usage has changed, and then determine the target process and perform subsequent management, thereby improving the accuracy of process management.
[0074] Optionally, the step 102 of performing a control operation to control the target process includes:
[0075] Step 1022: Compare the process information of the target process with a preset process whitelist; the process whitelist includes process information corresponding to at least one process;
[0076] Step 1023: When the process information of the target process does not match the process information of any process in the process whitelist, a control operation is performed to control the target process.
[0077] In the embodiments of the present application, process control is beneficial for managing and optimizing system resources, but not all processes are suitable for strict control. Among them, some processes are more important for the normal operation of the system, and strict control of such processes may cause system failures or malfunctions.
[0078] Therefore, a process whitelist can be pre-built. This can be a predefined list that can be empty or contain the process information of at least one process. This process information can be the process name, process ID (PID), or other information that uniquely identifies the process. For example, applications such as players and browsers often have background operations to maintain normal operation. The process information of these applications can be included in the process whitelist.
[0079] The target process's process information is compared against each process in the process whitelist. This comparison can be done by string matching (e.g., using the process name as the identifier) or by numerical comparison (e.g., using the process ID as the identifier). The matching method is not limited here. Note that if the process ID is subject to change, matching can be performed based on the process name.
[0080] If the process information of the target process matches a process in the process whitelist, it means that the target process is a process that should not be strictly controlled. The control operation on the target process can be skipped to maintain the normal operation of the target process.
[0081] If the process information of the target process does not match any process in the process whitelist, it means that the target process is not in the whitelist and control operations can be performed on it.
[0082] For example, if the "Music.exe" process is controlled, music will not play properly; if the "chrome.exe" process is controlled, browser-related background operations, such as downloads, will not be able to proceed. Therefore, the process whitelist can include the following process names: ["Music.exe", "chrome.exe"]. When the target process name is determined to be "AA.exe", the system compares "AA.exe" with "Music.exe" and "chrome.exe" in the whitelist and finds no match. At this point, the system will perform control operations on the "AA.exe" process based on the preset control operations, such as reducing CPU usage to reduce its system resource usage, thereby freeing up resources for other processes. If the target process name is "Music.exe" and the comparison determines that the name matches a process name in the whitelist, the system can skip the control operation on the target process, allowing music to play normally in the background.
[0083] Figure 3 This is a flowchart of process whitelist comparison provided by an embodiment of the present application;
[0084] Step 301, determining the target process corresponding to the main window of the current window;
[0085] Step 302: Check whether the target process is in the process whitelist (whether the match is successful);
[0086] Step 303, return result: in the process whitelist, it is a non-freezable window;
[0087] Step 304, return result: not in the process whitelist, and is a freezable window.
[0088] By implementing the embodiments of the present application, by introducing a process whitelist mechanism, processes that can be exempted from strict control are included in the whitelist, and by comparing the target process with the process whitelist, processes that can be strictly controlled can be screened out, thereby achieving accurate control of processes and optimizing the use of system resources while ensuring stable system operation.
[0089] It is understandable that the whitelist is used to identify some processes that have background operations but do not need to be controlled. However, when there is a need to save battery, the user can also not set a whitelist, so that the processes with background operations are also strictly controlled. For example, when the name of the target process is "Music.exe", the target process is still controlled so that music cannot be played in the background.
[0090] Figure 4 This is a flow chart of control based on focus control items provided in an embodiment of the present application;
[0091] Step 401: The focus control item is in the open state;
[0092] Step 402: Check if a window focus change event occurs. If yes, proceed to step 403.
[0093] Step 403: Check whether the target process is a freezable process. If yes, proceed to step 404; if no, proceed to step 405.
[0094] Step 404, freezing the target process to freeze the window;
[0095] Step 405: Check whether the window with focus is frozen. If yes, proceed to step 406; if not, proceed to step 407.
[0096] Step 406, unfreezing the focused window, that is, unfreezing the main process corresponding to the window to unfreeze the window;
[0097] Step 407, end.
[0098] Figure 5 This is a flowchart of the control release process provided by the embodiment of the present application;
[0099] Step 501, determining the window ID of the window that has acquired focus in the window focus change event data;
[0100] Step 502: Determine the process ID of the process to be released based on the window ID and the corresponding process ID recorded by the operating system during control.
[0101] Step 503: De-control the process to be de-controlled based on the process ID.
[0102] The above steps indicate that an operating system such as X11 can record the corresponding window and process during control, so that when the focus is regained, the corresponding process can be found in the record and released.
[0103] Optionally, the target control function item includes a static control item; the control conditions corresponding to the static control item include no input events within a first preset time period and the system entering a screen saver state.
[0104] The step 102 of determining a target process corresponding to the target control function item when the control condition corresponding to the target control function item is satisfied includes:
[0105] Step 1024: If there is no input event within a first preset time period, determine the preset control process corresponding to the static control item as the target process;
[0106] Step 1025: When the system enters the screen saver state, determine that the process corresponding to each window of the system is the target process.
[0107] In the embodiment of the present application, the static control item is a function item for controlling the process when the system is in a static state. The static state may refer to a period of time when the system has no user input operation or enters the screen saver state.
[0108] Correspondingly, the control conditions may include two sub-control conditions: no input events within the first preset time period and the system entering the screen saver state. Although both can represent a static state, "no input events within the first preset time period" may be the first stage corresponding to a lighter degree of static, and "the system entering the screen saver state" may be the second stage corresponding to a deeper degree of static.
[0109] The system can monitor user input operations, such as voice input, screen touch, keyboard tapping, mouse movement or click, etc. When no input events are detected within a pre-set period of time (i.e., the first preset duration), the sub-control condition is met. For example, if the first preset duration is set to 10 minutes, if the user does not perform any keyboard or mouse operations within 10 minutes, then "no input events within the first preset duration" is met.
[0110] The screen saver is a screen protection mechanism that is automatically activated when the system has been idle for a period of time. When the system enters the screen saver state, the sub-control conditions of the static control item are also met. In fact, if the duration of the static state is long enough, "no input events within the first preset time period" will occur earlier than "the system enters the screen saver state". When "the system enters the screen saver state" occurs, it means that "no input events within the first preset time period" has occurred, but the occurrence of "no input events within the first preset time period" does not necessarily lead to the occurrence of "the system enters the screen saver state". This is because the user may still perform operations after "no input events within the first preset time period" occurs.
[0111] When the system does not receive any user input events within the first preset time period, it indicates that the user has no temporary need to use the system. At this point, the system can determine the preset control process corresponding to the static control item as the target process. These preset control processes can be those that can be suspended or have resource usage restricted when the user is not operating, such as some background automatic update programs, real-time monitoring programs, etc. Such processes continue to run when the user is not using the system, consuming unnecessary resources.
[0112] For example, a pre-defined list of controlled processes might include a music player background process and a file synchronization software process. If the system detects no input for 10 minutes, it identifies the music player background process and the file synchronization software process as target processes. These processes can then be controlled, such as by freezing them or reducing CPU usage.
[0113] Figure 6 This is a flowchart of a first-stage static state corresponding to no input event within a first preset time period provided by an embodiment of the present application;
[0114] Step 601, monitoring the system to see if there is an input event;
[0115] Step 602: Is the condition "no input event within the first preset time period" satisfied? If yes, proceed to step 603; if not, return to step 601;
[0116] Step 603, return result: in the first stage static state.
[0117] When the system enters screen saver mode, meaning the user has not actively operated for a longer period of time, the processes associated with all windows in the system can be controlled. Because the processes associated with windows are often related to applications previously used by the user, when the user is not operating any windows, the activities of the processes associated with these windows can be restricted to save resources.
[0118] For example, if a text editor, browser, and image viewer window are open on a system, each corresponding to a process. When the system enters screen saver mode, the text editor process, browser process, and image viewer process can all be identified as target processes. The system can then take appropriate control measures for these processes, such as pausing background tasks and reducing CPU usage.
[0119] Similarly, when the system is in a first stage of inactivity corresponding to no input event within a first preset time period, a freezable list can be constructed based on preset freezable processes. When it is determined that the system has entered the first stage of inactivity, the processes recorded in the freezable list are frozen.
[0120] Figure 7 This is a flow chart of control based on static control items provided in an embodiment of the present application;
[0121] Step 701: The static control item is in the open state;
[0122] Step 702: Is the condition "no input event within the first preset time period" satisfied? If not, proceed to step 703; if yes, proceed to step 704;
[0123] Step 703: Unfreeze the currently frozen process that is on the freezable list, and proceed to step 707;
[0124] Step 704: Freeze the processes on the freezable list and proceed to step 705.
[0125] Step 705: Whether the "system enters screen saver state" is satisfied, if yes, proceed to step 706; if not, proceed to step 707;
[0126] Step 706: Freeze the processes corresponding to all windows;
[0127] Step 707, end.
[0128] In an embodiment of the present application, for the idle state, the idle state is distinguished based on the control conditions including no input events within a first preset time period and the system entering the screen saver state. The preset control process corresponding to the idle control item can be controlled first, and then the process corresponding to each window can be controlled. The process can be managed in stages when the system is idle, so as to achieve the purpose of optimizing resource utilization and reducing power consumption.
[0129] Optionally, the target control function item includes a fixed control item; the control condition corresponding to the fixed control item includes that the running time of the preset control process reaches a second preset time.
[0130] The step 102 of determining a target process corresponding to the target control function item when the control condition corresponding to the target control function item is satisfied includes:
[0131] Step 1026: When the running time of the preset control process reaches a second preset time within each fixed time, determine the preset control process as the target process.
[0132] In an embodiment of the present application, the control condition corresponding to the fixed control item is that the running time of the preset control process in each fixed time period reaches the second preset time period, and the fixed control item indicates the control of the fixed preset control process. It can be understood that the meaning of fixed does not mean that the preset control process cannot change at all. If the processes included in the preset control process itself have not been adjusted for a long period of time, then during this period of time, the control triggered based on the fixed control item is for these preset control processes; if the processes included in the preset control process itself have been adjusted, then in the subsequent time, the control triggered based on the fixed control item is for these adjusted preset control processes.
[0133] Preset controlled processes can be pre-defined processes that consume significant system resources or significantly impact system performance. Examples include processes that abuse CPU resources, energy-intensive processes, and processes that abnormally occupy the CPU but cannot be frozen. These processes include flawed antivirus software and security suites. Preset controlled processes corresponding to fixed control items can also be pre-built into a process list for subsequent comparison.
[0134] The second preset duration is a pre-set time threshold. When the system is started and the running time of the preset control process reaches the second preset duration, the control condition of the fixed control item is met.
[0135] The system can continuously monitor the running time of the preset control process corresponding to the fixed control item. When the running time of at least part of the preset control process within each fixed time reaches the second preset time, the relevant preset control process becomes the target process.
[0136] For example, the following preset control processes are pre-set in the operating system: process A, process B and process C, and a second preset duration is set for each process. Among them, the second preset duration corresponding to each process can be the same or different. For example, the second preset duration of process A is 10 milliseconds, the second preset duration of process B is 15 milliseconds, and the second preset duration of process C is 20 milliseconds. The running duration of these preset control processes is continuously monitored. In the first fixed duration (i.e., unit duration), for example, 200 milliseconds, when process B has run for 15 milliseconds, its running duration reaches the corresponding second preset duration. Process B can be identified as the target process, and the corresponding control operation is performed on process B until the next fixed duration is entered and process B is released. Similarly, in the next fixed duration, the running duration of the preset control process is also monitored to see whether it has reached the second preset duration in the current fixed duration. If it has, the process is controlled.
[0137] Among them, it can be understood that, since different process scheduling algorithms will allocate CPU time slices to each process according to different rules, if a process with a longer second preset duration is allocated more CPU time slices, then this process can also be controlled first compared to a process with a shorter second preset duration. Therefore, the second preset duration in the embodiment of the present application is the cumulative maximum running time that the process can run. For each individual process, it is controlled separately. If the number of CPU time slices allocated to any process within a fixed duration reaches the corresponding second preset duration, then the process can be controlled.
[0138] Figure 8 This is a flow chart of control based on fixed control items provided in an embodiment of the present application;
[0139] Step 801: The fixed control item is in the open state;
[0140] Step 802: Read the process list that records the preset control process;
[0141] Step 803: Limit the maximum running time of all processes on the process list within a fixed time period (i.e., control the process after the running time reaches a second preset time period);
[0142] Step 804, end;
[0143] Step 805: After a fixed period of time, check whether the process on the process list is running. If so, execute step 803.
[0144] In the above step 805, the fixed time length can be 200 milliseconds, 500 milliseconds or 1 second, etc. After the current fixed time length has passed, the next fixed time length will be entered, and then the process on the process list will be checked to see if it is running. If it is running and the cumulative running time within the next fixed time length has reached the corresponding second preset time length, then the control will continue.
[0145] In implementing the embodiments of the present application, within a fixed time period (unit time period), when the running time of any preset control process reaches the corresponding second preset time period, the preset control process is determined as the target process, so as to avoid some processes that cannot be frozen from occupying a large amount of system resources during long-term operation, resulting in other processes being unable to obtain sufficient resources, thereby affecting the overall performance of the system, thereby improving the operating efficiency of the system.
[0146] Optionally, the target control function item includes an automatic control item; the control condition corresponding to the automatic control item includes that the system resource pressure reaches a preset pressure threshold.
[0147] The step 102 of determining a target process corresponding to the target control function item when the control condition corresponding to the target control function item is satisfied includes:
[0148] Step 1027: When the system resource pressure reaches a preset pressure threshold, obtain the resource usage rate corresponding to each running process.
[0149] Step 1028: Determine a target process among the running processes based on the resource usage of each process.
[0150] In an embodiment of the present application, the target control function item includes an automatic control item, and the control condition includes that the system resource pressure reaches a preset pressure threshold, that is, the automatic control item means that when the preset pressure threshold is reached, it automatically triggers the control of the relevant process.
[0151] System resource pressure can be measured through various indicators, such as CPU usage, disk IO busyness, etc. The preset pressure threshold can be a pre-set standard. When the system resource pressure exceeds the threshold (threshold value), it indicates that the system resources are under pressure and process control is required.
[0152] Resource pressure monitoring can be achieved through the kernel's built-in pressure status indicator (PSI, Pressure Stall Information) monitoring interface. When the system resource pressure is too high, the resource usage rate of each running process is obtained, and the target process is determined based on the resource usage rate.
[0153] Resource utilization can include: CPU utilization, which indicates the proportion of time a process occupies the CPU over a period of time. For example, if process A uses the CPU for 30 seconds within a minute, the CPU utilization of process A is 50%; and disk I / O utilization, which reflects the level of disk read and write operations performed by the process, such as the amount of data read or written from the disk per unit time. Resource utilization can also be determined from other perspectives, which are not specifically limited here.
[0154] After obtaining the resource usage of each running process, the target process can be determined based on the size of these usage rates. Different strategies can be used to determine the target process.
[0155] For example, the top N processes with the highest resource usage are selected; or processes with usage exceeding a certain proportion are selected, such as processes with CPU usage and / or disk IO usage exceeding 30% are selected as target processes; or, under a certain indicator, such as CPU usage, the process with the highest usage and the processes whose difference with the highest usage is within a preset threshold, such as 0.5, are all target processes. For example, if the CPU usage of process A is 39.6%, the CPU usage of process B is 20%, the CPU usage of process C is 40%, and the CPU usage of process D is 10%, then process C with a CPU usage of 40% is first selected as the target process, and since the CPU usage of process A is 39.6%, which is only 0.4% different from that of process C, process A is also selected as the target process.
[0156] Figure 9 This is a flow chart of control based on automatic control items provided in an embodiment of the present application;
[0157] Step 901: The automatic control item is turned on;
[0158] Step 902, monitor CPU usage and IO usage;
[0159] Step 903: CPU usage reaches a preset threshold;
[0160] Step 904, determining the target process with the highest CPU usage;
[0161] Step 905, determining other target processes whose CPU usage is within 0.5 of the highest CPU usage;
[0162] Step 906: The IO usage reaches a preset threshold;
[0163] Step 907, determining the target process with the highest IO usage;
[0164] Step 908, determining other target processes whose IO usage is within 0.5 of the highest IO usage;
[0165] Step 909: Control the target process (e.g., limit resource usage);
[0166] Step 910, end.
[0167] It is understandable that the CPU usage and IO usage used in the above process are only for illustration and can be flexibly adjusted according to actual needs.
[0168] The embodiments of the present application obtain the resource usage rate of each running process when the system resource pressure reaches a preset pressure threshold. Based on the resource usage rate of each process, the target process is identified among the running processes and subsequently managed. This allows for dynamic and real-time process management based on system resource pressure, improving the flexibility of process management.
[0169] Figure 10 This is a flowchart of the collaborative work of multiple functional items provided in the embodiment of the present application;
[0170] Step A1: Start system services (used to monitor system operation, perform freezing or other process control operations);
[0171] Step A2: Initialize and create cgroups corresponding to process freezing, automatic control, and fixed control;
[0172] Step A3: The focus control item is in the open state;
[0173] Step A4, the window loses focus;
[0174] Step A5: Control the target process corresponding to the window that has lost focus;
[0175] Step A6, the window gets the focus;
[0176] Step A7: releasing the target process corresponding to the focused window;
[0177] Step A8: Leave the control item in the open state;
[0178] Step A9: There is no input event within a first preset time period or the system enters a screen saver state;
[0179] Step A10: Control the corresponding target process;
[0180] Step A11: When an input event occurs during a user operation, the corresponding target process is released;
[0181] Step A12: Automatic control items are turned on;
[0182] Step A13: monitoring system resource pressure to see if it reaches a preset pressure threshold;
[0183] Step A14: manage and control the corresponding target process;
[0184] Step A15: The fixed control item is in the open state;
[0185] Step A16: The preset control process whose cumulative running time within each fixed time period reaches the corresponding second preset time period is set as the target process;
[0186] Step A17: manage and control the corresponding target process.
[0187] In the above step A2, since cgroup is a mechanism for controlling a group of processes, different cgroups may correspond to different control operations. In step A2, the cgroup corresponding to the process freeze may be used to perform the freeze operation. For example, when the control is based on the focus control item and the static control item, the control operation may be freezing, and the process may be frozen through this cgroup; the cgroup corresponding to the automatic control may be used to limit the resource utilization rate to a first ratio. When the control is based on the automatic control item, the resource utilization rate of the target process is limited to the first ratio; the cgroup corresponding to the fixed control may be used to limit the resource utilization rate to a second ratio. When the control is based on the fixed control item, the resource utilization rate of the target process is limited to the second ratio. The sizes of the first ratio and the second ratio can be adjusted based on demand without specific restrictions.
[0188] Figure 10 The above process shown is terminated after the system is restarted, hibernated, shut down, or the system service is shut down, and can be started again after the system resumes operation.
[0189] Optionally, when the control condition corresponding to the target control function item is met, step 102 of determining a target process corresponding to the target control function item and performing a control operation to control the target process includes:
[0190] Step 1029: When there are at least two target control function items, determine the control conditions corresponding to each target control function item; the control operations corresponding to different control function items are at least partially different;
[0191] Step 10210: When the control conditions corresponding to at least two target control function items are met, determine the target process corresponding to each target control function item;
[0192] Step 10211: For the target process corresponding to each target control function item, execute the control operation corresponding to the target control function item to respectively control the target processes corresponding to different target control function items.
[0193] In an embodiment of the present application, there may be at least two target control function items in the open state, for example, 2, 3 or 4 target control function items. For example, the target control function items can be the focus control items, automatic control items and fixed control items in the above embodiments, and there is no limitation here.
[0194] Different target control items have different control conditions. When the control conditions corresponding to at least two target control function items are met, the control of the process is triggered based on the at least two target control function items.
[0195] Determine the target processes corresponding to different target control function items. The process of determining the target processes will not be repeated here. You can refer to the process of determining the corresponding target processes of focus control items, automatic control items and other control items in the above embodiment.
[0196] Because the control operations corresponding to different target function control items differ at least in part, the target processes of different target function control items may require different control operations. For example, a target process corresponding to a focus control item may be frozen; a target process corresponding to an automatic control item may have its resource usage limited to a first percentage; and a target process corresponding to a fixed control item may have its resource usage limited to a second percentage.
[0197] By implementing the embodiments of the present application, process control can be performed from different perspectives based on at least two target control function items. Different target processes correspond to different control operations, which can improve the richness and flexibility of process control.
[0198] Optionally, when the control condition corresponding to the target control function item is met, step 102 of determining a target process corresponding to the target control function item and performing a control operation to control the target process includes:
[0199] Step 10212: If there are at least two target control function items, determine the target process corresponding to each target control function item; the control operations corresponding to different control function items have different priorities;
[0200] Step 10213: If the target processes corresponding to at least two target management and control function items are partially identical, determine a common target process; the common target process is the target process corresponding to the at least two target management and control function items;
[0201] Step 10214: Determine the priorities of the control operations corresponding to at least two target control function items and the target control operation with the highest priority, and execute the target control operations to control the common target process.
[0202] In the embodiment of the present application, similarly, if there are at least two target management and control function items, the target process corresponding to each target management and control function item can be determined separately.
[0203] The control operations corresponding to different control function items have different priorities. For example, the control operation corresponding to the focus control item can be freezing the process, and the control operation corresponding to the automatic control item and the fixed control item can be limiting resource usage.
[0204] Different control operations may have different priorities, and the priority may be determined based on the degree of impact of the control operation on the process. For example, compared to freezing a process and limiting resource usage, the process cannot run normally after being frozen, which has the greatest impact on the process, while limiting resource usage only limits the system resources that the process can use and does not seriously affect the operation of the process. Therefore, the priority of the control operation of freezing the process can be higher than limiting resource usage. In addition, with respect to limiting resource usage, the higher the resource usage ratio based on which the control is specifically executed, the higher the priority can be. There is no specific restriction on how to determine the priority of the control operation here.
[0205] Since a corresponding target process can be determined for each target control function item, and each target control function item may have multiple target processes, there may be duplication between the target processes of different target control function items, that is, a target process belongs to the target process of at least two target control function items at the same time, that is, the process is a common target process.
[0206] At the same time, since different control functions correspond to different control operations, the control operation that is ultimately executed on the common target process can be determined based on the priority of the control operations of the relevant target control functions, and the control operation with the highest priority can be selected for execution.
[0207] For example, the target processes corresponding to the focus control item include processes A, B, and C; the target processes corresponding to the automatic control item include processes A, E, and F; the control operation corresponding to the focus control item is freezing the process, with a priority of 3; the control operation corresponding to the automatic control item is limiting resource usage to the first proportion, with a priority of 2; then process A is the common target process, and the control operation of freezing the process needs to be executed.
[0208] In implementing the embodiment of the present application, if there are at least two target control function items, the targets are determined separately, and then the common target process is determined. Based on the control operations of different priorities corresponding to the control function items, the control operation with the highest priority is selected for execution, thereby avoiding control operation conflicts in the case of a common target process and improving the orderliness of process control.
[0209] In summary, the present application provides a process control method, which determines the target control function item in the open state according to the control function configuration, and when the control condition corresponding to the target control function item is met, determines the target process corresponding to the target control function item, executes the control operation to control the target process, and when the control condition corresponding to the target control function item changes from satisfied to unsatisfied, executes the process release operation to release the control of the target process. As a result, the control function can be flexibly turned on or off based on the control function configuration, and then the process can be flexibly managed according to the control conditions corresponding to different target control function items. It can be controlled according to specific needs, avoiding the problem of system lag and high power consumption caused by system processes occupying a large amount of system resources, thereby improving system operation efficiency.
[0210] Especially in the use scenario of laptop computers with limited system resources, it can reduce power consumption, increase standby events, improve system response speed, and improve the smoothness of system operation.
[0211] It should be noted that for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the order of the actions described, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0212] Reference Figure 11 , shows a structural block diagram of a process control device of the present application, the device comprising:
[0213] Function configuration module 1101, used to determine the target control function item in the on state according to the control function configuration; the control function configuration is used to indicate the on / off state of each control function item; different control function items correspond to different control conditions;
[0214] A process control module 1102 is configured to determine a target process corresponding to the target control function item and execute a control operation to control the target process if a control condition corresponding to the target control function item is satisfied;
[0215] The process decontrol module 1103 is used to execute a process decontrol operation to release the control of the target process when the control condition corresponding to the target control function item changes from satisfied to unsatisfied.
[0216] Optional process control module, including:
[0217] A first multiple-item submodule is configured to determine, when there are at least two target control function items, a control condition corresponding to each target control function item; the control operations corresponding to different control function items are at least partially different;
[0218] A first multi-process submodule is configured to determine a target process corresponding to each target control function item when control conditions corresponding to at least two target control function items are met;
[0219] The respective control submodule is used to execute the control operation corresponding to the target control function item for the target process corresponding to each target control function item, so as to respectively control the target processes corresponding to different target control function items.
[0220] Optional process control module, including:
[0221] A second multiple sub-module is configured to determine, when there are at least two target control function items, a target process corresponding to each target control function item; the control operations corresponding to different control function items have different priorities;
[0222] A second multi-process submodule is configured to determine a common target process when target processes corresponding to at least two target management and control function items are partially identical; the common target process is the target process corresponding to the at least two target management and control function items;
[0223] The common control submodule is used to determine the priorities of the control operations corresponding to at least two target control function items and the target control operation with the highest priority, and execute the target control operations to control the common target process.
[0224] Optionally, the target control function item includes a focus control item; the control condition corresponding to the focus control item includes the occurrence of a window focus change event;
[0225] Process control module, including:
[0226] The focus change submodule is used to determine, when the window focus change event occurs, the process corresponding to the target window that has lost focus as the target process.
[0227] Optional, focus change submodule, including:
[0228] a program determining unit, configured to determine, when the window focus change event occurs, a first application corresponding to the window that loses focus and a second application corresponding to the window that gains focus;
[0229] a program comparison unit, configured to determine, when the first application program and the second application program are different, that the window that has lost focus is a target window;
[0230] The window main process unit is used to determine the target process corresponding to the target window according to the window information of the target window.
[0231] Optionally, the target control function item includes a static control item; the control conditions corresponding to the static control item include no input events within a first preset time period and the system entering a screen saver state;
[0232] Process control module, including:
[0233] A first static submodule, configured to determine, when there is no input event within a first preset time period, a preset control process corresponding to the static control item as a target process;
[0234] The second static module is used to determine that the process corresponding to each window of the system is a target process when the system enters the screen saver state.
[0235] Optionally, the target control function item includes a fixed control item; the control condition corresponding to the fixed control item includes that the running time of the preset control process reaches a second preset time;
[0236] Process control module, including:
[0237] The time limit submodule is used to determine the preset control process as the target process when the running time of the preset control process reaches a second preset time within each fixed time.
[0238] Optionally, the target control function item includes an automatic control item; the control condition corresponding to the automatic control item includes that the system resource pressure reaches a preset pressure threshold;
[0239] Process control module, including:
[0240] The resource pressure submodule is used to obtain the resource usage rate of each running process when the system resource pressure reaches a preset pressure threshold;
[0241] The resource process submodule is used to determine the target process among the running processes based on the resource usage of each process.
[0242] Optional process control module, including:
[0243] A process screening submodule, configured to compare the process information of the target process with a preset process whitelist; the process whitelist includes process information corresponding to at least one process;
[0244] The screening and determining submodule is used to perform a control operation to control the target process when the process information of the target process does not match the process information of any process in the process whitelist.
[0245] In summary, the present application provides a process control device that, based on the control function configuration, determines the target control function item that is in an open state. When the control condition corresponding to the target control function item is met, determines the target process corresponding to the target control function item, executes a control operation to control the target process, and executes a process release operation to release the control of the target process when the control condition corresponding to the target control function item changes from satisfied to unsatisfied. The control function can be flexibly turned on or off based on the control function configuration, and then the process can be flexibly managed according to the control conditions corresponding to different target control function items. The control can be carried out according to specific needs, avoiding the problem of system lag and high power consumption caused by system processes occupying a large amount of system resources, thereby improving the system operation efficiency.
[0246] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0247] Reference Figure 12 , is a schematic diagram of the structure of the electronic device provided in the embodiment of the present application. Figure 12 As shown, the electronic device includes: a processor, a memory, a communication interface and a communication bus, and the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the steps of the process control method of the aforementioned embodiment.
[0248] An embodiment of the present application provides a non-temporary computer-readable storage medium, which stores a program or instruction. When the program or instruction is executed by a processor, the terminal can execute the steps of the process control method of the aforementioned embodiment.
[0249] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0250] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0251] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0252] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a predictable manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0253] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1The steps for the function specified in one or more boxes.
[0254] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
[0255] This document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A process control method, characterized in that: The method comprises: Determine the target control function item that is in the on state according to the control function configuration; the control function configuration is used to indicate the on / off state of each control function item; different control function items correspond to different control conditions; When the control condition corresponding to the target control function item is met, determining the target process corresponding to the target control function item, and performing a control operation to control the target process; When the control condition corresponding to the target control function item changes from satisfied to unsatisfied, a process release operation is performed to release the control of the target process.
2. The method according to claim 1, characterized in that When a control condition corresponding to the target control function item is satisfied, determining a target process corresponding to the target control function item and performing a control operation to control the target process includes: In the case where there are at least two target control function items, determining a control condition corresponding to each target control function item; the control operations corresponding to different control function items are at least partially different; When the control conditions corresponding to at least two target control function items are met, determine the target process corresponding to each target control function item respectively; For the target process corresponding to each target control function item, the control operation corresponding to the target control function item is executed to respectively control the target processes corresponding to different target control function items.
3. The method according to claim 1, characterized in that When a control condition corresponding to the target control function item is satisfied, determining a target process corresponding to the target control function item and performing a control operation to control the target process includes: When there are at least two target control function items, the target process corresponding to each target control function item is determined respectively; the control operations corresponding to different control function items have different priorities; In the case where target processes corresponding to at least two target management and control function items are partially identical, determining a common target process; the common target process is the target process corresponding to the at least two target management and control function items; Determine the priorities of the control operations corresponding to the at least two target control function items and the target control operation with the highest priority, and execute the target control operations to control the common target process.
4. The method according to claim 1, wherein The target control function item includes a focus control item; the control condition corresponding to the focus control item includes a window focus change event; The step of determining a target process corresponding to the target control function item when the control condition corresponding to the target control function item is satisfied includes: When the window focus change event occurs, the process corresponding to the target window that has lost focus is determined as the target process.
5. The method according to claim 4, characterized in that The step of determining, when the window focus change event occurs, the process corresponding to the target window that has lost focus as the target process comprises: When the window focus change event occurs, determining a first application corresponding to the window that loses focus and a second application corresponding to the window that gains focus; In a case where the first application and the second application are different, determining the window that has lost focus as a target window; A target process corresponding to the target window is determined according to the window information of the target window.
6. The method according to claim 1, characterized in that The target control function item includes a static control item; the control conditions corresponding to the static control item include no input events within a first preset time period and the system entering a screen saver state; The step of determining a target process corresponding to the target control function item when the control condition corresponding to the target control function item is satisfied includes: When there is no input event within a first preset time period, determining a preset control process corresponding to the static control item as a target process; When the system enters the screen saver state, it is determined that the process corresponding to each window of the system is the target process.
7. The method according to claim 1, characterized in that The target control function item includes a fixed control item; the control condition corresponding to the fixed control item includes that the running time of the preset control process reaches a second preset time; The step of determining a target process corresponding to the target control function item when the control condition corresponding to the target control function item is satisfied includes: When the running time of the preset control process within each fixed time period reaches a second preset time period, the preset control process is determined to be a target process.
8. The method according to claim 1, characterized in that The target control function item includes an automatic control item; the control condition corresponding to the automatic control item includes that the system resource pressure reaches a preset pressure threshold; The step of determining a target process corresponding to the target control function item when the control condition corresponding to the target control function item is satisfied includes: When the system resource pressure reaches a preset pressure threshold, for each running process, obtain the resource usage rate corresponding to each process; A target process is determined from among the running processes based on the resource usage of each process.
9. The method according to claim 1, characterized in that The step of performing a control operation to control the target process includes: Comparing the process information of the target process with a preset process whitelist; the process whitelist includes process information corresponding to at least one process; In a case where the process information of the target process does not match the process information of any process in the process whitelist, a control operation is performed to control the target process.
10. A process control device, characterized in that: The device comprises: A function configuration module is used to determine the target control function items in the on state according to the control function configuration; the control function configuration is used to indicate the on / off state of each control function item; different control function items correspond to different control conditions; A process control module is used to determine a target process corresponding to the target control function item and perform a control operation to control the target process when a control condition corresponding to the target control function item is met; The process decontrol module is used to execute a process decontrol operation to release the control of the target process when the control condition corresponding to the target control function item changes from satisfied to not satisfied.
11. An electronic device, characterized in that: include: A processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the steps of the process control method according to any one of claims 1 to 9.
12. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the process control method according to any one of claims 1 to 9 are implemented.