CN114385329B - Process management method and device, electronic device and readable storage medium - Google Patents
Process management method and device, electronic device and readable storage medium Download PDFInfo
- Publication number
- CN114385329B CN114385329B CN202111488847.5A CN202111488847A CN114385329B CN 114385329 B CN114385329 B CN 114385329B CN 202111488847 A CN202111488847 A CN 202111488847A CN 114385329 B CN114385329 B CN 114385329B
- Authority
- CN
- China
- Prior art keywords
- monitoring
- main
- main process
- monitoring process
- instruction
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/485—Task life-cycle, e.g. stopping, restarting, resuming execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3003—Monitoring arrangements specially adapted to the computing system or computing system component being monitored
- G06F11/302—Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3051—Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Software Systems (AREA)
- Mathematical Physics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application relates to a process management method, a process management device, an electronic device and a readable storage medium, wherein the method comprises the following steps: if the starting of the main process is detected, judging whether a first monitoring process corresponding to the main process exists or not; if the first monitoring process corresponding to the main process does not exist, calling a creating instruction to create the first monitoring process, monitoring the main process through the first monitoring process, and if the first monitoring process corresponding to the main process exists, monitoring the main process through the first monitoring process; and if the first monitoring process detects that the main process is ended, calling a starting process instruction to restart the main process. The first monitoring process is established for the main process, the main process is continuously monitored to know the running state of the main process in real time, and when the main process is detected to be finished, the main process is restarted, so that the continuous running state of the main process is ensured.
Description
Technical Field
The present application relates to the field of computer processing, and in particular, to a process management method, an apparatus, an electronic apparatus, and a readable storage medium.
Background
The existing computer needs to create different processes to realize different functions during running, and because computer hardware such as a memory is small, or when processes running at the same time are too many, some processes can be ended accidentally, however, in some cases, a specific process is required to keep a background running state, otherwise, the function realization can be influenced.
Disclosure of Invention
The application provides a process management method, a process management device, an electronic device and a readable storage medium, and aims to solve the technical problem of how to keep processes running continuously in the prior art.
In order to solve the above technical problem or at least partially solve the above technical problem, the present application provides a process management method, including the steps of:
if the starting of the main process is detected, judging whether a first monitoring process corresponding to the main process exists or not;
if the first monitoring process corresponding to the main process does not exist, calling a creating instruction to create the first monitoring process, monitoring the main process through the first monitoring process, and if the first monitoring process corresponding to the main process exists, monitoring the main process through the first monitoring process;
and if the first monitoring process detects that the main process is ended, calling a starting process instruction to restart the main process.
Optionally, the step of monitoring the host process by the first monitoring process includes:
presetting monitoring time at intervals, and acquiring a process list, wherein all running processes are recorded in the process list;
judging whether the process list contains the main process or not through the first monitoring process;
if the process list does not contain the main process, determining that the main process is ended.
Optionally, the step of calling the start process instruction to restart the main process includes:
acquiring a process path of the main process;
and calling a starting process command, transmitting the process path to the starting process command, and executing the starting process command.
Optionally, the step of invoking a create instruction to create the first monitoring process is followed by:
establishing a second monitoring process at intervals of preset replacement time, and monitoring the main process through the second monitoring process;
and ending the first monitoring process, and updating the second monitoring process into the first monitoring process.
Optionally, the step of determining whether there is a first monitoring process corresponding to the host process includes:
acquiring a process list and a process identifier corresponding to the first monitoring process;
judging whether the process list comprises a process corresponding to the process identifier;
and if the process list does not comprise the process corresponding to the process identifier, the first monitoring process corresponding to the main process does not exist.
Optionally, the step of invoking a create instruction to create a first monitoring process is followed by:
and if receiving a termination instruction, ending the first monitoring process.
Optionally, the step of calling a creation instruction to create the first monitoring process includes:
acquiring guard time in the creation instruction;
and creating a first monitoring process with the life cycle of the daemon time, so that the first monitoring process is ended when the runtime reaches the daemon time.
In order to achieve the above object, the present invention further provides a process management apparatus, including:
the first judgment module is used for judging whether a first monitoring process corresponding to a main process exists or not if the main process is detected to be started;
the first establishing module is used for calling an establishing instruction to establish the first monitoring process if the first monitoring process corresponding to the main process does not exist, monitoring the main process through the first monitoring process, and monitoring the main process through the first monitoring process if the first monitoring process corresponding to the main process exists;
and the first starting module is used for restarting the main process by calling a starting process instruction if the first monitoring process detects that the main process is ended.
Optionally, the first creating module includes:
the system comprises a first acquisition unit, a second acquisition unit and a monitoring unit, wherein the first acquisition unit is used for acquiring a process list at intervals of preset monitoring time, and all running processes are recorded in the process list;
a first judging unit, configured to judge, by the first monitoring process, whether the process list includes the host process;
a first determining unit, configured to determine that the host process is ended if the host process is not included in the process list.
Optionally, the first starting module comprises:
a second obtaining unit, configured to obtain a process path of the host process;
and the first calling unit is used for calling a process starting command, transmitting the process path to the process starting command and then executing the process starting command.
Optionally, the process management apparatus further includes:
the second establishing module is used for establishing a second monitoring process every preset replacement time interval and monitoring the main process through the second monitoring process;
and the first ending module is used for ending the first monitoring process and updating the second monitoring process into the first monitoring process.
Optionally, the first determining module further includes:
a third obtaining unit, configured to obtain a process list and a process identifier corresponding to the first monitoring process;
a second judging unit, configured to judge whether a process corresponding to the process identifier is included in the process list;
and the first execution unit is used for determining whether the process list comprises a process corresponding to the process identifier or not, and if the process list does not comprise the process corresponding to the process identifier, determining that a first monitoring process corresponding to the main process does not exist.
Optionally, the process management apparatus further includes:
and the second ending module is used for ending the first monitoring process if a termination instruction is received.
Optionally, the first creating module includes:
the fourth acquisition unit is used for acquiring the guard time in the creation instruction;
and the first creating unit is used for creating a first monitoring process with the life cycle of the daemon time so that the first monitoring process is ended when the running time reaches the daemon time.
To achieve the above object, the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the process management method as described above.
To achieve the above object, the present invention also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the process management method as described above.
The invention provides a process management method, a process management device, an electronic device and a readable storage medium,
if the starting of the main process is detected, judging whether a first monitoring process corresponding to the main process exists or not; if the first monitoring process corresponding to the main process does not exist, calling a creating instruction to create the first monitoring process, monitoring the main process through the first monitoring process, and if the first monitoring process corresponding to the main process exists, monitoring the main process through the first monitoring process; and if the first monitoring process detects that the main process is ended, calling a starting process instruction to restart the main process. The first monitoring process is established for the main process, the main process is continuously monitored so as to know the running state of the main process in real time, and when the main process is detected to be finished, the main process is restarted, so that the continuous running state of the main process is ensured.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a flowchart illustrating a process management method according to a first embodiment of the present invention;
FIG. 2 is a detailed flowchart of step S20 of the process management method according to the second embodiment of the present invention;
fig. 3 is a schematic block diagram of an electronic device according to the present invention.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The invention provides a process management method, referring to fig. 1, fig. 1 is a schematic flow chart of a first embodiment of the process management method of the invention, and the method comprises the following steps:
step S10, if the starting of a main process is detected, judging whether a first monitoring process corresponding to the main process exists or not;
a process is a running activity of a program in a computer on a data set, is a basic unit for resource allocation and scheduling of a system, and is the basis of an operating system structure. The master process is the process that needs to be monitored. The first monitoring process is used for monitoring the running state of the main process, and the first monitoring process detects the running state of the main process continuously or at intervals of preset monitoring time to judge whether the main process is ended or not.
Specifically, monitoring operation can be triggered through a process daemon instruction, and when the process daemon instruction is received, a first monitoring process is established for a main process; the process daemon instruction may be sent or automatically triggered by a user, specifically, the user may send the process daemon instruction for one or more running host processes, or the user may perform daemon setting on a running or non-running host process in advance, and when the host process with the daemon setting starts to run, the corresponding process daemon instruction is automatically triggered; specifically, the user selects a process daemon option in the corresponding trigger interface, at this time, a currently running process or an un-running process may be displayed, and the user selects one or more processes therein to trigger a process daemon instruction. The process daemon instruction comprises a process name, a process path, a process number and the like of a main process; the process path can be input by a user or acquired by the user, and can be obtained by inquiring a process number or the process name in a process list, wherein the process number is a number distributed to the process by the system after the process is started, and the number is unique in all processes operated by the current system; therefore, different processes can be distinguished through the process daemon instruction to acquire the main process corresponding to the process daemon instruction, and it should be noted that, because the process number is allocated by the system when the process is started, in general, the process number is different when the process is started, so the process number can be acquired before the process daemon instruction is sent out, and after the process number is acquired, the process number is sent together with the process daemon instruction, or acquired after the process daemon instruction is received.
Step S20, if the first monitoring process corresponding to the main process does not exist, calling a creating instruction to create the first monitoring process, monitoring the main process through the first monitoring process, and if the first monitoring process corresponding to the main process exists, monitoring the main process through the first monitoring process;
when the main process is started, if the corresponding first monitoring process exists, the main process is directly monitored, and if the corresponding first monitoring process does not exist, the first monitoring process needs to be created.
Step S30, if the first monitoring process detects that the main process is ended, a starting process instruction is called to restart the main process.
And when detecting that the main process is ended, executing restart operation on the ended main process.
In this embodiment, the first monitoring process is created for the main process, and the main process is continuously monitored to know the running state of the main process in real time, and when it is detected that the main process is finished, the main process is restarted, so that the continuous running state of the main process is ensured.
Further, referring to fig. 2, in a second embodiment of the process management method according to the present invention proposed based on the first embodiment of the present invention, the step S20 includes the steps of:
step S21, acquiring a process list at intervals of preset monitoring time, wherein all running processes are recorded in the process list;
step S22, judging whether the process list contains the main process or not through the first monitoring process;
step S23, if the process list does not include the host process, determining that the host process is ended.
The process list contains information of all processes currently running in the system. Acquiring a process list from a background through a first monitoring process, traversing all processes in the process list to judge whether a main process is in the process list, specifically, acquiring a process number or a process name and the like of the process when each process in the process list is compared, explaining the process number serving as an example, comparing the process number of the process with the process number of the main process, considering the process as the main process when the process number of the process is consistent with the process number of the main process, considering the process as the main process when the process number of the process is inconsistent with the process number of the main process, considering the process as the main process when the process exists in the process list, and determining that the main process is not ended when the process is in the process list; and when all the processes in the process list are not the main process, the main process is not considered to be in the process list, and the main process is determined to be ended.
When the number of the main processes is multiple, multiple first monitoring processes may be set, for example, one first monitoring process is set for each main process, or one first monitoring process is set for each main process of each preset number, or only one first monitoring process may be set to monitor all the main processes; when a first monitoring process needs to monitor a plurality of main processes, when all the processes in the process list are traversed to judge whether the main processes are in the process list, different main processes can be sequentially judged, namely after whether one main process is in the process list is judged, the next main process is judged, and the process can be directly compared with all the main processes in the process list, namely a plurality of main processes are simultaneously judged; the specific determination method can be selected and set according to the actual application scenario and the need, which is not limited herein.
The embodiment can accurately judge whether the main process is ended.
Further, in a third embodiment of the process management method according to the present invention based on the first embodiment of the present invention, the step S30 includes the steps of:
step S31, acquiring a process path of the main process;
step S32, a starting process command is called, and the starting process command is executed after the process path is transmitted into the starting process command.
The start process command is a command for performing a start operation on a process, such as a star command in a windows system, it should be noted that corresponding start process commands of different systems, such as a DOS system, a UNIX system, a Linux system, and the like, are different, and a specific start process command may be adjusted according to an actually applied system, which is not described herein again, and a process path refers to a storage directory of a program corresponding to a main process, so that the corresponding main process can be started through the process path of the main process.
In the embodiment, the main process can be reasonably restarted.
Further, in a fourth embodiment of the process management method according to the present invention based on the first embodiment of the present invention, after the step S20, the method includes the steps of:
step S40, establishing a second monitoring process at intervals of preset replacement time, and monitoring the main process through the second monitoring process;
and S50, ending the first monitoring process, and updating the second monitoring process into the first monitoring process.
It can be understood that there is a possibility that the first monitoring process is ended, so to avoid such a situation, which may result in that the running state of the main process cannot be monitored, a protection operation is performed on the first monitoring process every preset replacement time, specifically, the protection operation is to create a second monitoring process to replace the first monitoring process, and end the first process; by continuously creating and ending, the problem that the first monitoring process is ended can be avoided. It should be noted that the preset replacement time can be as short as possible to ensure the stability and effectiveness of the protection operation. In order to avoid the first monitoring process being ended, the first monitoring process may also be set as a system process.
The embodiment can ensure the continuous operation of the first monitoring process, and avoid the problem that the first monitoring process is ended and cannot monitor the main process.
Further, in a fifth embodiment of the process management method according to the present invention based on the first embodiment of the present invention, the step S10 includes the steps of:
step S11, acquiring a process list and a process identifier corresponding to the first monitoring process;
step S12, judging whether the process list comprises a process corresponding to the process identification;
step S13, if the process list does not include the process corresponding to the process identifier, the first monitoring process corresponding to the main process does not exist.
The process identifier may include a process name or a process label, the process list is obtained from the background, and all processes in the process list are traversed to determine whether the first monitoring process is in the process list, specifically, when one process in the process list is obtained by comparison, the process identifier of the process is obtained, and the process identifier of the process is compared with the process identifier of the first monitoring process, when the process identifier of the process is consistent with the process identifier of the first monitoring process, the process is considered as the first monitoring process, and when the process identifier of the process is inconsistent with the process identifier of the first monitoring process, the process is considered as not the first monitoring process.
The embodiment can accurately judge whether the first monitoring process corresponding to the main process exists or not.
Further, in a sixth embodiment of the process management method according to the present invention based on the first embodiment of the present invention, after the step S20, the method includes the steps of:
step S60, if a termination instruction is received, ending the first monitoring process.
The termination instruction can be sent by a user or can be triggered by the user, and when the user does not have the requirement on the continuous running of the main process, the termination instruction can be sent; the user may also execute the monitoring plan, such as setting the running time of the first monitoring process, and when the running time of the first monitoring process reaches the running time, triggering a termination instruction; and when receiving the termination instruction, terminating the first monitoring process to terminate the monitoring of the main process, so as to prevent the first monitoring process from continuously occupying the memory.
According to the embodiment, when the main process is not required to be monitored, the first monitoring process is ended so as to reduce the memory occupation.
Further, in a seventh embodiment of the process management method according to the present invention based on the first embodiment of the present invention, the step S20 includes the steps of:
step S24, obtaining the guard time in the creation instruction;
and S25, creating a first monitoring process with the life cycle of the daemon time, so that the first monitoring process is ended when the running time reaches the daemon time.
The guard time is used for representing the life cycle of the first monitoring process, the user can set the monitoring plan, the first monitoring process is operated to monitor the main process only in the cycle of the monitoring plan, and when the cycle is finished, the operation of the first monitoring process is stopped. Therefore, the first monitoring process does not need to be manually closed by a user, and the user experience is improved; the guard time can be a time period, namely the life cycle of the first monitoring process is from the time when the first monitoring process starts to run to the time when the guard time is continuously run; the guard time may also be a time, that is, a life cycle of the first monitoring process from a time when the first monitoring process starts to run to the time. Further, a monitoring process closing condition can be set, when the monitoring process closing condition is reached, the first monitoring process is closed, the monitoring process closing condition can be running time, the number of times that the main process is ended, system time reaches a fixed time, the main process runs to a certain stage or receives a specific instruction and the like, and the monitoring service of the main process can be provided for users more intelligently by setting the monitoring process closing condition. It should be noted that the setting of the specific monitoring process closing condition may also be selected according to the actual application scenario and the need, which is not described herein again.
According to the embodiment, the first monitoring process can be closed without manual operation of a user, and the user experience is improved.
It should be noted that for simplicity of description, the above-mentioned embodiments of the method are described as a series of acts, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.
The present application further provides a process management apparatus for implementing the process management method, where the process management apparatus includes:
the first judgment module is used for judging whether a first monitoring process corresponding to a main process exists or not if the main process is detected to be started;
the first establishing module is used for calling an establishing instruction to establish the first monitoring process if the first monitoring process corresponding to the main process does not exist, monitoring the main process through the first monitoring process, and monitoring the main process through the first monitoring process if the first monitoring process corresponding to the main process exists;
and the first starting module is used for calling a starting process instruction to restart the main process if the first monitoring process detects that the main process is ended.
The process management device establishes the first monitoring process for the main process and continuously monitors the main process so as to know the running state of the main process in real time, and restarts the main process when detecting that the main process is finished, thereby ensuring the continuous running state of the main process.
It should be noted that the first determining module in this embodiment may be configured to execute step S10 in this embodiment, the first creating module in this embodiment may be configured to execute step S20 in this embodiment, and the first starting module in this embodiment may be configured to execute step S30 in this embodiment.
Further, the first creating module includes:
the system comprises a first acquisition unit, a second acquisition unit and a monitoring unit, wherein the first acquisition unit is used for acquiring a process list at intervals of preset monitoring time, and all running processes are recorded in the process list;
a first judging unit, configured to judge, by the first monitoring process, whether the process list includes the host process;
a first determining unit, configured to determine that the host process is ended if the host process is not included in the process list.
Further, the first enabling module comprises:
a second obtaining unit, configured to obtain a process path of the host process;
and the first calling unit is used for calling a process starting command, transmitting the process path to the process starting command and then executing the process starting command.
Further, the process management device further includes:
the second establishing module is used for establishing a second monitoring process every preset replacement time interval and monitoring the main process through the second monitoring process;
and the first ending module is used for ending the first monitoring process and updating the second monitoring process into the first monitoring process.
Further, the first determining module further includes:
a third obtaining unit, configured to obtain a process list and a process identifier corresponding to the first monitoring process;
a second determining unit, configured to determine whether a process corresponding to the process identifier is included in the process list;
and the first execution unit is used for determining whether the process list comprises a process corresponding to the process identifier or not, and if the process list does not comprise the process corresponding to the process identifier, determining that a first monitoring process corresponding to the main process does not exist.
Further, the process management device further includes:
and the second ending module is used for ending the first monitoring process if a termination instruction is received.
Further, the first creating module includes:
the fourth acquisition unit is used for acquiring the guard time in the creation instruction;
and the first establishing unit is used for establishing a first monitoring process with the life cycle of the daemon time so that the first monitoring process is ended when the running time reaches the daemon time.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules as part of the apparatus may be implemented by software or hardware, where the hardware environment includes a network environment.
Referring to fig. 3, the electronic device may include components such as a communication module 10, a memory 20, and a processor 30 in a hardware structure. In the electronic device, the processor 30 is connected to the memory 20 and the communication module 10, respectively, the memory 20 stores thereon a computer program, which is executed by the processor 30 at the same time, and when executed, implements the steps of the above-mentioned method embodiments.
The communication module 10 may be connected to an external communication device through a network. The communication module 10 may receive a request from an external communication device, and may also send a request, an instruction, and information to the external communication device, where the external communication device may be another electronic apparatus, a server, or an internet of things device, such as a television.
The memory 20 may be used to store software programs as well as various data. The memory 20 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as monitoring the main process by the first monitoring process), and the like; the storage data area may include a database, and the storage data area may store data or information created according to use of the system, or the like. Further, the memory 20 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 30, which is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the electronic device and processes data by operating or executing software programs and/or modules stored in the memory 20 and calling data stored in the memory 20, thereby performing overall monitoring of the electronic device. Processor 30 may include one or more processing units; alternatively, the processor 30 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 30.
Although not shown in fig. 3, the electronic device may further include a circuit control module, which is used for connecting with a power supply to ensure the normal operation of other components. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 3 is not meant to be limiting of the electronic device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The invention also proposes a computer-readable storage medium on which a computer program is stored. The computer-readable storage medium may be the Memory 20 in the electronic apparatus in fig. 3, and may also be at least one of a ROM (Read-Only Memory)/RAM (Random Access Memory), a magnetic disk, and an optical disk, and the computer-readable storage medium includes instructions for enabling a terminal device (which may be a television, an automobile, a mobile phone, a computer, a server, a terminal, or a network device) having a processor to execute the method according to the embodiments of the present invention.
In the present invention, the terms "first", "second", "third", "fourth" and "fifth" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance, and those skilled in the art can understand the specific meanings of the above terms in the present invention according to specific situations.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although the embodiment of the present invention has been shown and described, the scope of the present invention is not limited thereto, it should be understood that the above embodiment is illustrative and not to be construed as limiting the present invention, and that those skilled in the art can make changes, modifications and substitutions to the above embodiment within the scope of the present invention, and that these changes, modifications and substitutions should be covered by the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (9)
1. A method for process management, the method comprising:
if the starting of the main process is detected, judging whether a first monitoring process corresponding to the main process exists or not;
if the first monitoring process corresponding to the main process does not exist, calling a creation instruction to create the first monitoring process, setting the first monitoring process as a system process, monitoring the main process through the first monitoring process, and if the first monitoring process corresponding to the main process exists, monitoring the main process through the first monitoring process;
if the first monitoring process detects that the main process is ended, calling a starting process instruction to restart the main process;
the step of invoking a create instruction to create the first monitor process may be followed by:
establishing a second monitoring process at intervals of preset replacement time, and monitoring the main process through the second monitoring process;
and ending the first monitoring process, and updating the second monitoring process into the first monitoring process.
2. The process management method according to claim 1, wherein the step of monitoring the host process by the first monitoring process comprises:
presetting monitoring time at intervals, and acquiring a process list, wherein all running processes are recorded in the process list;
judging whether the process list contains the main process or not through the first monitoring process;
and if the process list does not contain the main process, determining that the main process is ended.
3. The process management method according to claim 1, wherein the step of invoking a start process instruction to restart the host process comprises:
acquiring a process path of the main process;
and calling a process starting command, and after the process path is transmitted to the process starting command, executing the process starting command.
4. The process management method according to claim 1, wherein the step of determining whether the first monitoring process corresponding to the host process exists comprises:
acquiring a process list and a process identifier corresponding to the first monitoring process;
judging whether the process list comprises a process corresponding to the process identifier or not;
and if the process list does not comprise the process corresponding to the process identifier, the first monitoring process corresponding to the main process does not exist.
5. The process management method of claim 1, wherein the step of invoking a create instruction to create a first monitor process is followed by:
and if receiving a termination instruction, ending the first monitoring process.
6. The process management method of claim 1, wherein the step of invoking a create instruction to create a first monitor process comprises:
acquiring guard time in the creation instruction;
and creating a first monitoring process with the life cycle of the daemon time, so that the first monitoring process is ended when the runtime reaches the daemon time.
7. A process management apparatus, characterized in that the process management apparatus comprises:
the first judgment module is used for judging whether a first monitoring process corresponding to a main process exists or not if the main process is detected to be started;
a first creating module, configured to invoke a creating instruction to create the first monitoring process if there is no first monitoring process corresponding to the main process, set the first monitoring process as a system process, and monitor the main process through the first monitoring process if there is a first monitoring process corresponding to the main process;
the first starting module is used for calling a starting process instruction to restart the main process if the first monitoring process detects that the main process is ended;
the process management apparatus further includes:
the second establishing module is used for establishing a second monitoring process every preset replacement time interval and monitoring the main process through the second monitoring process;
and the first ending module is used for ending the first monitoring process and updating the second monitoring process into the first monitoring process.
8. Electronic device, characterized in that it comprises a memory, a processor and a computer program stored on said memory and executable on said processor, said computer program, when executed by said processor, implementing the steps of the process management method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, carries out the steps of the process management method according to one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111488847.5A CN114385329B (en) | 2021-12-06 | 2021-12-06 | Process management method and device, electronic device and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111488847.5A CN114385329B (en) | 2021-12-06 | 2021-12-06 | Process management method and device, electronic device and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114385329A CN114385329A (en) | 2022-04-22 |
CN114385329B true CN114385329B (en) | 2023-03-28 |
Family
ID=81196043
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111488847.5A Active CN114385329B (en) | 2021-12-06 | 2021-12-06 | Process management method and device, electronic device and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114385329B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106874077A (en) * | 2015-12-11 | 2017-06-20 | 腾讯科技(深圳)有限公司 | process operation method and device |
CN109445927A (en) * | 2018-11-12 | 2019-03-08 | 郑州云海信息技术有限公司 | A kind of task management method and device of storage cluster |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101290587B (en) * | 2008-06-12 | 2010-06-16 | 中兴通讯股份有限公司 | Realization progress start-up and control process |
CN104216795A (en) * | 2013-06-04 | 2014-12-17 | 上海联影医疗科技有限公司 | Multiprocess protection system and implementation method thereof |
CN112527589A (en) * | 2019-09-17 | 2021-03-19 | 比亚迪股份有限公司 | Process monitoring method and process monitoring device |
CN111913851A (en) * | 2020-07-31 | 2020-11-10 | 平安科技(深圳)有限公司 | Process monitoring method, system, terminal and storage medium |
CN113672471A (en) * | 2021-08-27 | 2021-11-19 | 中国第一汽车股份有限公司 | Software monitoring method, device, equipment and storage medium |
-
2021
- 2021-12-06 CN CN202111488847.5A patent/CN114385329B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106874077A (en) * | 2015-12-11 | 2017-06-20 | 腾讯科技(深圳)有限公司 | process operation method and device |
CN109445927A (en) * | 2018-11-12 | 2019-03-08 | 郑州云海信息技术有限公司 | A kind of task management method and device of storage cluster |
Also Published As
Publication number | Publication date |
---|---|
CN114385329A (en) | 2022-04-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9336054B2 (en) | Method and apparatus for configuring resource | |
CN106992903B (en) | Data acquisition system and method based on network equipment | |
CN101510167A (en) | Plug-in component operation method, apparatus and system | |
CN112783725B (en) | Index collection method and device | |
CN105721203B (en) | Upgrade processing method and device | |
CN113407383B (en) | Main and standby system switching method and device, server and main and standby system | |
CN111078471A (en) | System fault recovery method and device for display device and computer storage medium | |
CN112769652A (en) | Node service monitoring method, device, equipment and medium | |
CN111459676B (en) | Node resource management method, device and storage medium | |
CN112566078A (en) | Device connection method and apparatus, storage medium, and electronic apparatus | |
CN114385329B (en) | Process management method and device, electronic device and readable storage medium | |
CN107729207B (en) | Application program main thread monitoring method and device | |
CN110913416B (en) | Terminal, networking method thereof and computer-readable storage medium | |
CN107425994B (en) | Method, terminal and server for realizing remote parameter management | |
CN114302351B (en) | Short message service processing method and device, computer equipment and storage medium | |
CN112527589A (en) | Process monitoring method and process monitoring device | |
CN110555009A (en) | processing method and device for Network File System (NFS) service | |
CN114666397B (en) | Client version updating method and system | |
US20090083747A1 (en) | Method for managing application programs by utilizing redundancy and load balance | |
CN108121545A (en) | The unloading feedback method and device of application program | |
CN106776119A (en) | The method for restarting of Service Instance, device and server | |
CN112332998B (en) | Network allocation method and system for equipment and computer readable storage medium | |
CN104683308B (en) | The method and apparatus executed instruction | |
CN110308943B (en) | Program running method and device, computing equipment and storage medium | |
CN107484150B (en) | EV-DO network connection method, device and terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |