Application program monitoring method, device, and computing equipment
By setting the environment setting program of the operating system's autonomous desktop environment as the ancestor process of the application process, creating a process list and application process tree, the problem of inability to monitor subprocesses without graphic attributes in the existing technology is solved, and unified monitoring and controllable startup of all application processes is achieved.
Patent Information
- Application Number
- CN202210565316.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-08
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2042-03-08
AI Technical Summary
Existing application monitoring methods cannot effectively monitor child processes generated through double fork without graphical attributes, resulting in monitoring failure.
Set the environment setting program of the operating system's autonomous desktop environment as the ancestor process of the application process, create a first application process list to record the PID of the process and its parent-child relationship, and update in response to process changes, and establish an application process tree to monitor the start and exit of the application.
It realizes unified monitoring of all application processes, including processes without graphic attributes, ensuring that the startup process is controllable and the monitoring process is clear and intuitive.
Smart Images

Figure CN114880189B_ABST
Abstract
Description
[0001] This application is a divisional application of invention patent application 2022102180431 filed on March 8, 2022. Technical Field
[0002] The present invention relates to the technical field of application program monitoring, and in particular to a method, apparatus, and computing device for monitoring an application program. Background Art
[0003] One of the design philosophies of desktop operating systems, such as the Unity Operating System (UOS), is to make their desktop environments safer for users. In desktop operating systems, applications live within the desktop environment and must be managed by it to avoid disrupting both the desktop and system environments. To prevent applications from escaping control and to facilitate unified management of all applications within the desktop environment, it is necessary to monitor application startup and exit. When necessary, the desktop environment will proactively exit and destroy illegal applications to ensure user safety.
[0004] Some desktop operating systems (such as UOS) default to having the parent process recycle child processes. To avoid zombie processes, if the parent process exits first, the child process will be orphaned to systemd, which will then clean up the garbage generated by the child process after it exits. Some applications use this orphan mechanism to actively double-fork, and then the parent process exits, entrusting the child process to systemd.
[0005] The conventional method for monitoring applications is to use XCB to analyze the _NET_CLIENT_LIST_STACKING data to obtain the window IDs of all graphics windows. XCB then analyzes each window's _NET_WM_PID to obtain the set of processes corresponding to all graphics windows. This process then intersects the set of processes for all graphics applications, taking the intersection of these two. This method uses the graphics window as the entry point to obtain the process PID (Process Identification) of all graphics window applications. In the operating system, this refers to the process identification number, or process identifier. This process PID is then used to monitor the startup and exit of applications.
[0006] The above method requires the operating system to actively obtain the application process status and uses a timed execution method to monitor application state changes, which is time-consuming and inefficient. While it can acquire and monitor normal graphics applications, if a graphics application double-forks a child process without graphics attributes, it cannot be captured by the above method. This child process is not included in the set of all graphics application processes, resulting in the child process being unmonitored.
[0007] In summary, the above-mentioned existing application monitoring method can only monitor program processes with graphic attributes, while child processes without graphic attributes generated by double fork will not be monitored. Summary of the Invention
[0008] To this end, the present invention provides a method, apparatus, and computing device for monitoring an application program, in an effort to resolve or at least alleviate at least one of the above problems.
[0009] According to one aspect of the present invention, a method for monitoring an application is provided, wherein the startup entry of the application is an environment setting program of an autonomous desktop environment of an operating system, the method comprising the steps of: setting the environment setting program as the ancestor process of the application process; creating a first application process list, and adding the PID of the environment setting program to the first application process list, the first application process list being used to record the PIDs of running processes and the parent-child relationships between the running processes; and updating the first application process list in response to changes in processes monitored in the first application process list.
[0010] Optionally, in the monitoring method of an application according to the present invention, the step of updating the first application process list in response to monitoring changes in the processes in the first application process list includes: generating a child process in response to monitoring the processes in the first application process list, and adding the PID of the child process and the parent-child relationship between the child process and other processes to the first application process list.
[0011] Optionally, in the monitoring method of an application according to the present invention, the step of updating the first application process list in response to monitoring changes in processes in the first application process list includes: in response to monitoring the exit of a process in the first application process list, deleting the PID of the exited process and the parent-child relationship between the exited process and other processes from the first application process list, and using the child process of the exited process as the child process of the parent process of the exited process.
[0012] Optionally, in the monitoring method of an application according to the present invention, the method further includes the steps of: creating an application process tree, wherein the application process tree is used to record the PIDs of all processes in the first application process list and the relationship between the processes in a graphical form; and updating the application process tree according to the first application process list.
[0013] Optionally, in the monitoring method of an application according to the present invention, the method further includes the steps of: creating a second application process list, the second application process list being used to record the PID of the currently running subprocess that serves as the environment setting program; and updating the second application process list.
[0014] Optionally, in the application monitoring method according to the present invention, the application includes: an application launched through a taskbar, an application launched through a launcher, and an application launched through a desktop.
[0015] Optionally, in the method for monitoring an application according to the present invention, the step of setting the environment setting program as the ancestor process of the application process includes: setting the environment setting program as the ancestor process of the application process through the kernel of the operating system.
[0016] According to another aspect of the present invention, a monitoring device for an application is also provided, wherein the startup entry of the application is an environment setting program of the operating system's autonomous desktop environment, and the device includes: an ancestor process setting unit, suitable for setting the environment setting program as the ancestor process of the application process; a first list creation unit, suitable for creating a first application process list and adding the PID of the environment setting program to the first application process list, wherein the first application process list is used to record the PID of the running processes and the parent-child relationship between the running processes; and an update unit, suitable for updating the first application process list in response to changes in the processes monitored in the first application process list.
[0017] According to another aspect of the present invention, a computing device is provided, comprising: at least one processor and a memory storing program instructions; when the program instructions are read and executed by the processor, the computing device executes the above-mentioned method for monitoring the application program.
[0018] According to yet another aspect of the present invention, a readable storage medium storing program instructions is provided. When the program instructions are read and executed by a computing device, the computing device executes the above-mentioned method for monitoring an application program.
[0019] The application monitoring method of the present invention sets the environment setting program of the operating system's autonomous desktop environment as the startup entry for all applications. After the application is started, the environment setting program is set as the ancestor process of the application process, and a first application process list is created. The first application process list is used to record the PIDs of all currently running application processes. An application process tree and a second application process list are derived based on the first application process list. The application process tree records the PIDs of all currently running application processes, and the second application process list only records the child-generation process PIDs of the environment setting program.
[0020] According to the application monitoring method, device and computing device of the present invention, at least one of the following beneficial effects can be achieved: unified startup application entry, no matter whether it is an application started from the taskbar, the launcher or the desktop, it is run through the environment setting program of the operating system's autonomous desktop environment, which can ensure that the startup process is unified and controllable; on this basis, the desktop environment entry startdde is set as the ancestor of all descendant processes, which can ensure that all application processes, including processes without graphic attributes, become descendant processes of startdde, so that the application process cannot escape the process relationship derived from startdde, all application processes and the relationship between each process are recorded in the first application process list, and the startup and exit of the application can be monitored through the first application process list; the first application process list is converted into an application process tree, and the behavior of monitoring the startup and exit of the application is converted into monitoring the application process tree, which is clearer and more intuitive. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] To achieve the above and related purposes, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings, which indicate various ways in which the principles disclosed herein may be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The above and other objects, features, and advantages of the present disclosure will become more apparent by reading the following detailed description in conjunction with the accompanying drawings. Throughout this disclosure, the same reference numerals generally refer to the same parts or elements.
[0022] Figure 1 An application scenario of a method for monitoring an application according to an embodiment of the present invention is shown;
[0023] Figure 2 shows a schematic diagram of a computing device 200 according to one embodiment of the present invention;
[0024] Figure 3 A flowchart of a method 300 for monitoring an application according to an embodiment of the present invention is shown;
[0025] Figure 4A schematic diagram of an application process tree in the prior art is shown;
[0026] Figure 5 A schematic diagram of the updating process of the application process tree in the prior art is shown;
[0027] Figure 6 A schematic diagram of an update process of an application process tree according to an embodiment of the present invention is shown;
[0028] Figure 7 FIG. 7 is a schematic structural diagram of an application monitoring device 700 according to a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0029] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0030] In order to solve the problem that the existing application monitoring method cannot monitor the child process without graphic attributes generated by double fork, the present invention provides a monitoring method, device and computing device for application.
[0031] Figure 1 An application scenario of a method for monitoring an application program according to an embodiment of the present invention is shown.
[0032] like Figure 1 As shown, the application monitoring method is embedded in the desktop operating system, which is an improvement made to the desktop operating system and can monitor the startup and exit of various application programs installed in the desktop operating system.
[0033] In one embodiment, the application monitoring method of the present invention can be executed on a computing device. The computing device can be any device with storage and computing capabilities, and can be implemented as, for example, a server, workstation, or a personal computer such as a desktop computer or laptop computer, or as a terminal device such as a mobile phone, tablet computer, smart wearable device, or IoT device, but is not limited thereto.
[0034] Figure 2 FIG2 shows a schematic diagram of a computing device 200 according to an embodiment of the present invention. It should be noted that, Figure 2 The computing device 200 shown is only an example. In practice, the computing device used to implement the application monitoring method of the present invention can be any type of device, and its hardware configuration can be different from the above. Figure 2The computing device 200 shown is the same as Figure 2 The computing device 200 shown is different. In practice, the computing device used to implement the monitoring method of the application of the present invention can be Figure 2 The hardware components of the computing device 200 shown are added or deleted, and the present invention does not limit the specific hardware configuration of the computing device.
[0035] like Figure 2 As shown, in a basic configuration 202, computing device 200 typically includes system memory 206 and one or more processors 204. A memory bus 208 may be used for communication between processor 204 and system memory 206.
[0036] Depending on the desired configuration, the processor 204 can be any type of processor, including, but not limited to, a microprocessor (μP), a microcontroller (μC), a digital signal processing unit (DSP), or any combination thereof. The processor 204 can include one or more levels of cache, such as a level 1 cache 210 and a level 2 cache 212, a processor core 214, and registers 216. An example processor core 214 can include an arithmetic logic unit (ALU), a floating point unit (FPU), a digital signal processing core (DSP core), or any combination thereof. An example memory controller 218 can be used with the processor 204, or in some implementations, the memory controller 218 can be an internal part of the processor 204.
[0037] Depending on the desired configuration, system memory 206 can be any type of memory, including but not limited to volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 206 can include an operating system 220, one or more applications 222, and program data 224. In some embodiments, application 222 can be arranged to execute instructions on the operating system by one or more processors 204 using program data 224.
[0038] The computing device 200 may also include an interface bus 240 that facilitates communication from various interface devices (e.g., output devices 242, peripheral interfaces 244, and communication devices 246) to the basic configuration 202 via the bus / interface controller 230. Example output devices 242 include a graphics processing unit 248 and an audio processing unit 250. These can be configured to facilitate communication with various external devices such as a display or speakers via one or more A / V ports 252. Example peripheral interfaces 244 may include a serial interface controller 254 and a parallel interface controller 256, which can be configured to facilitate communication with external devices such as input devices (e.g., a keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., a printer, scanner, etc.) via one or more I / O ports 258. Example communication devices 246 may include a network controller 260, which can be arranged to facilitate communication with one or more other computing devices 262 via a network communication link via one or more communication ports 264.
[0039] A network communication link can be an example of a communication medium. Communication media can generally be embodied as computer-readable instructions, data structures, program modules in a modulated data signal such as a carrier wave or other transmission mechanism, and can include any information delivery medium. A "modulated data signal" can be a signal in which one or more of a data set or a change thereof can be performed in a manner that encodes information in the signal. As non-limiting examples, communication media can include wired media such as a wired network or a dedicated line network, and various wireless media such as sound, radio frequency (RF), microwave, infrared (IR) or other wireless media. The term computer-readable medium as used herein can include both storage media and communication media.
[0040] The computing device 200 can be implemented as a server, such as a file server, a database server, an application server, and a web server, or as a personal computer including desktop and notebook computer configurations. Of course, the computing device 200 can also be implemented as part of a small-sized portable (or mobile) electronic device. In an embodiment of the present invention, the computing device 200 is configured to execute the monitoring method 300 of a real-time application according to the present invention. The application 222 of the computing device 200 includes program instructions for various applications installed in a desktop operating system, and the program data 224 can also store various data required during the operation of the application.
[0041] According to an embodiment of the present invention, a method 300 for monitoring an application program is provided, wherein the startup entry of the application is an environment setting program of an autonomous desktop environment of an operating system. The method 300 includes the steps of: setting the environment setting program as the ancestor process of the application process; creating a first application process list, and adding the PID of the environment setting program to the first application process list, wherein the first application process list is used to record the PIDs of running processes and the parent-child relationships between the running processes; and updating the first application process list in response to changes in the processes monitored in the first application process list.
[0042] Figure 3 A flow chart of a method 300 for monitoring an application according to an embodiment of the present invention is shown. The method 300 is executed in a computing device (such as the aforementioned computing device 200) to monitor the startup and exit of an application after the operating system is started.
[0043] Method 300 starts to execute after the operating system is started. The premise for the execution of method 300 is that the startup entry of the application is the environment setting program of the operating system's autonomous desktop environment. There are many ways to start an application, including clicking the application icon on the desktop, clicking the resident application icon on the taskbar, and selecting the application to open through the launcher. Taking the UOS system as an example, the startup entry of its desktop environment is startdde. In order to facilitate the maintenance of the startup process, startdde is set as the startup entry of the application. Regardless of whether the user clicks the application icon from the desktop, clicks the resident application icon from the taskbar, or selects the application to open through the launcher, the specific startup process is ultimately implemented through the interface LaunchApp provided on startdde, that is, all applications are run through the startup interface of startdde.
[0044] like Figure 3 As shown, the method 300 begins at step S310 .
[0045] In step S310 , the environment setting program is set as the ancestor process of the application process.
[0046] By using the operating system's ancestor process setting function (for example, the ancestor process setting function added in the UOS system kernel in Version 3.4), the environment setting program startdde is set as the ancestor process of all descendant processes. Then, when the application exits, its child processes will be entrusted to startdde, thereby ensuring that the descendant processes of the application process will not be separated from startdde. Setting startdde as the ancestor process of the descendant process can be implemented using the following pseudo code:
[0047]
[0048] Next, in step S320, a first application process list is created, and the PID of the environment setting program is added to the first application process list. The first application process list is used to record the PIDs of all currently running application processes and the parent-child relationship between each process.
[0049] Next, in step S330, in response to a monitored change in a process in the first application process list, the first application process list is updated. The process change includes a process generating a child process and a process exiting.
[0050] When a process in the first application process list spawns a new child process, the PID of the new child process and the parent-child relationship between the new child process and its parent process are added to the first application process list. Determining whether a process has spawned child processes can be done by utilizing existing tools, such as query commands, to periodically query the processes in the first application process list to determine whether they have spawned new child processes. Since startdde is the ancestor process of all application processes, after an application is started, startdde will spawn new child processes, which may in turn spawn child processes. These newly spawned processes and their relationships with other processes are retrieved using the query command. The retrieved PIDs of the new processes and their parent-child relationships with other processes are then added to the first application process list. When a process in the first application process list exits, the PID of the exiting process and its parent-child relationship with other processes are removed from the first application process list, and the child processes of the exiting process are treated as children of the parent process of the exiting process.
[0051] When a process exits, it sends an exit signal, the SIGCHLD signal, to its parent process. When a process receives a SIGCHLD signal from its child process, it indicates that the process that sent the child SIGCHLD signal has exited. For example, suppose A is a process in an application, A's child process is B, and B's child process is C. When B exits, it sends a SIGCHLD signal to A. The operating system removes B's PID, the parent-child relationship between B and A, and the parent-child relationship between B and C from the first application process list, and changes the relationship between C and A to a parent-child relationship, making C a child of A.
[0052] The entire process of a computer starting up and shutting down involves the launch and exit of many applications. Each application, in turn, involves many processes. New child processes may be created at any time, and similarly, processes may exit at any time. There is no strict time sequence between the creation of child processes and the exit of processes. Whenever the system detects the emergence or exit of a new process, it updates the first application process list. Application developers can check the first application process list at any time to monitor the launch and exit of applications as needed.
[0053] According to one implementation of the present invention, method 300 further includes the steps of: creating an application process tree, the application process tree being used to graphically record the PIDs of all processes in the first application process list and the relationships between the processes; and updating the application process tree. The relationships between the processes herein refer to parent-child relationships between the processes in the first application process list.
[0054] The application process tree is updated using the first application process list as a data source. Whenever the first application process list changes, the application process tree is updated. For example, when a process receives a SIGCHLD signal from a child process, the first application process list is updated, and then the application process tree is updated based on the first application process list. The application process tree allows application developers to intuitively observe the launch and exit of an application's child processes.
[0055] In the prior art, the application process tree uses systemd as the root node, and all application processes (including startdde) are descendant processes of systemd, such as Figure 4 When a process exits, its child processes are used as child processes of systemd, for example Figure 5 In the application process tree shown, the arrow on the left indicates that process app3 has not exited, and the arrow on the right indicates that process app3 has exited. It can be seen that after process app3 exits, its child process app3_1 becomes a child process of systemd.
[0056] The application process tree of the embodiment of the present invention uses the first application process list as a data source, records the relationship between all application processes with startdde as the root node, and the application process is a child node on the application process tree. Figure 6As shown, the arrow on the left indicates that process app2 has not exited, while the arrow on the right indicates that process app2 has exited. When application process app2 exits, startdde receives a SIGCHLD signal from the application child process app2. Startdde's grandchild process app2_1 is entrusted to startdde and becomes its child process. The parent-child relationship between process app2_1 and its child processes app2_1_1 and app2_1_2 remains unchanged. The first application process list is updated, and the application process tree is updated based on the first application process list.
[0057] According to an implementation of the present invention, method 300 further includes the steps of: creating a second application process list, the second application process list being used to record the PIDs of subprocesses currently running and serving as the environment setting program; and updating the second application process list.
[0058] The second application process list uses the first application process list as the data source, and is used to record the child processes derived from startdde. After the application is started, the application PID is added to the second application process list; when the application exits, the application PID is deleted from the second application process list; if the application process is orphaned, the application process PID is deleted, and its child process PID is added to the second application process list. When an application process exits, there may be child processes spawned by it. If the child process does not exit, then in this case the application has not completely exited. Therefore, when startdde receives a SIGCHLD signal, it checks whether the currently exited process exists in the second application process list. If it does, it means that this is an application exit, and it will be deleted from the second application process list, and its child processes will be placed in the application process list. Figure 6 For example, when process app2 exits, process app2_1 is handed over to startdde, which removes the PID of process app2 from the second application process list and adds the PID of process app2_1 to the second application process list. Application developers can use the second application process list to quickly determine which applications have completely exited and which have not.
[0059] According to one implementation of the present invention, unified application startup, creation of the second application process list, and addition of the application process to the second application process list can be implemented using the following pseudo code:
[0060]
[0061] According to one implementation of the present invention, updating the second process list and the application process tree when a new process appears can be implemented using the following pseudo code:
[0062]
[0063]
[0064]
[0065]
[0066] According to one implementation of the present invention, updating the application process tree when a process exits can be implemented using the following pseudo code:
[0067]
[0068]
[0069]
[0070] The embodiment of the present invention further provides an application monitoring device 700, which can execute the steps of the application monitoring method 300 described above and achieve the same technical effect as the method 300. Figure 7 The monitoring device 700 of the above application program will be described.
[0071] like Figure 7 As shown, the application monitoring device 700 includes an ancestor process setting unit 710 , a first list creating unit 720 , and an updating unit 730 .
[0072] The ancestor process setting unit 710 is adapted to set the environment setting program as an ancestor process of the application process.
[0073] The first list creation unit 720 is adapted to create a first application process list and add the PID of the environment setting program to the first application process list, where the first application process list is used to record the PIDs of running processes and the parent-child relationships between the running processes.
[0074] The updating unit 730 is adapted to update the first application process list in response to monitoring changes in processes in the first application process list.
[0075] According to one implementation of the present invention, the update unit 730 also includes: a process adding unit, adapted to generate a child process in response to monitoring a process in the first application process list, and add the PID of the child process and the parent-child relationship between the child process and other processes to the first application process list.
[0076] According to one implementation of the present invention, the update unit 730 also includes: a process deletion unit, which is adapted to delete the PID of the exited process and the parent-child relationship between the exited process and other processes from the first application process list in response to monitoring the exit of the process in the first application process list, and use the child process of the exited process as the child process of the parent process of the exited process.
[0077] According to one implementation of the present invention, the application monitoring device 700 also includes: an application process tree creation unit, suitable for creating an application process tree, the application process tree is used to record the PIDs of all processes in the first application process list and the relationship between the processes in a graphical form; and an application process tree update unit, suitable for updating the application process tree according to the first application process list.
[0078] According to one implementation of the present invention, the application monitoring device 700 also includes: a second application process list creation unit, suitable for creating a second application process list, the second application process list is used to record the PID of the sub-process that is currently running and serves as the environment setting program; and a second application process list update unit, suitable for updating the second application process list.
[0079] According to an implementation of the present invention, the application includes: an application launched through a taskbar, an application launched through a launcher, and an application launched through a desktop.
[0080] According to an implementation of the present invention, the ancestor process setting unit 710 sets a program as the ancestor process of the application process through a kernel setting environment of the operating system.
[0081] The various techniques described herein may be implemented in conjunction with hardware or software, or a combination thereof. Thus, the methods and apparatus of the present invention, or certain aspects or portions of the methods and apparatus of the present invention, may be implemented in the form of program codes (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, a USB flash drive, a floppy disk, a CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into a machine such as a computer and executed by the machine, the machine becomes an apparatus for practicing the present invention.
[0082] When program code is executed on a programmable computer, the computing device generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store the program code; the processor is configured to execute the application program monitoring method of the present invention according to the instructions in the program code stored in the memory.
[0083] By way of example and not limitation, readable media include readable storage media and communication media. Readable storage media store information such as computer-readable instructions, data structures, program modules, or other data. Communication media typically embody computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and include any information delivery medium. Combinations of any of the above are also included within the scope of readable media.
[0084] In the description provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems may also be used in conjunction with the examples of the present invention. Based on the above description, it is apparent that the structure required for constructing such systems is contemplated. In addition, the present invention is not directed to any specific programming language. It should be understood that various programming languages may be utilized to implement the present invention described herein, and the description of specific languages described above is provided for the purpose of disclosing preferred embodiments of the present invention.
[0085] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.
[0086] Similarly, it should be understood that in order to streamline the present disclosure and help understand one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be interpreted as reflecting the following intention: that is, the claimed invention requires more features than the features clearly stated in each claim. Those skilled in the art should understand that the modules or units or components of the devices in the examples disclosed herein can be arranged in the devices described in the embodiment, or alternatively can be located in one or more devices different from the devices in the example. The modules in the aforementioned examples can be combined into one module or can be divided into multiple sub-modules.
[0087] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition may be divided into multiple submodules or subunits or subcomponents. All features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed herein may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0088] In addition, it will be appreciated by those skilled in the art that although some of the embodiments described herein include certain features included in other embodiments rather than other features, the combination of the features of different embodiments is meant to be within the scope of the present invention and to form different embodiments. In addition, some of the embodiments described herein are described as methods or method elements that can be implemented by a processor of a computer system or by other devices that perform the functions. Therefore, a processor with the necessary instructions for implementing the method or method elements forms a device for implementing the method or method elements. In addition, the elements described herein of the device embodiments are examples of devices that are used to implement the functions performed by the elements for the purpose of implementing the invention.
[0089] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved and are not intended to imply that the objects so described must have a given order in time, space, ranking, or in any other manner.
[0090] Although the present invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of the foregoing description, will appreciate that other embodiments are contemplated within the scope of the invention thus described. Furthermore, it should be noted that the language used in this specification has been selected primarily for readability and instructional purposes, and not for the purpose of explaining or limiting the subject matter of the present invention.
Claims
1. A method for monitoring an application, wherein the application's startup entry is an environment setting program of an operating system's autonomous desktop environment, and the application includes an application launched via a taskbar, an application launched via a launcher, and an application launched via the desktop, the method comprising the steps of: Setting the environment setting program as an ancestor process of the application process through the kernel of the operating system; Creating a first application process list and adding the PID of the environment setting program to the first application process list, wherein the first application process list is used to record the PIDs of running processes and the parent-child relationship between the running processes; and In response to monitoring changes in processes in the first application process list, the first application process list is updated.
2. The application monitoring method according to claim 1, wherein the step of updating the first application process list in response to a monitored change in a process in the first application process list comprises: In response to monitoring that a process in the first application process list generates a child process, a PID of the child process and a parent-child relationship between the child process and other processes are added to the first application process list.
3. The application monitoring method according to claim 1 or 2, wherein the step of updating the first application process list in response to a monitored change in a process in the first application process list comprises: In response to monitoring the exit of a process in the first application process list, the PID of the exited process and the parent-child relationship between the exited process and other processes are deleted from the first application process list, and the child process of the exited process is used as the child process of the parent process of the exited process.
4. The method for monitoring an application according to any one of claims 1 to 3, further comprising the steps of: Creating an application process tree, the application process tree being used to record, in a graphical form, the PIDs of all processes in the first application process list and the relationships between the processes; and The application process tree is updated according to the first application process list.
5. The method for monitoring an application according to any one of claims 1 to 4, further comprising the steps of: Creating a second application process list, the second application process list is used to record the PIDs of subprocesses that are currently running and serve as the environment setting program; and Update the second application process list.
6. A monitoring device for an application, wherein the application's launch entry is an environment setting program for an operating system's autonomous desktop environment, the application including an application launched via a taskbar, an application launched via a launcher, and an application launched via the desktop, the device comprising: an ancestor process setting unit, adapted to set the environment setting program as an ancestor process of the application process through the kernel of the operating system; a first list creating unit, adapted to create a first application process list and add the PID of the environment setting program to the first application process list, wherein the first application process list is used to record the PIDs of running processes and the parent-child relationship between the running processes; as well as The updating unit is adapted to update the first application process list in response to monitoring changes in processes in the first application process list.
7. A computing device comprising: at least one processor and memory storing program instructions; When the program instructions are read and executed by the processor, the computing device executes the method for monitoring an application program according to any one of claims 1 to 5.
8. A readable storage medium storing program instructions, wherein when the program instructions are read and executed by a computing device, the computing device executes the method for monitoring an application according to any one of claims 1 to 5.
Citation Information
Patent Citations
Smooth upgrade method and device for application program
CN108241496A
Method and system for monitoring process
CN1996257A