CN110928596A - Method and device for killing resident process - Google Patents

Method and device for killing resident process Download PDF

Info

Publication number
CN110928596A
CN110928596A CN201811028165.4A CN201811028165A CN110928596A CN 110928596 A CN110928596 A CN 110928596A CN 201811028165 A CN201811028165 A CN 201811028165A CN 110928596 A CN110928596 A CN 110928596A
Authority
CN
China
Prior art keywords
resident process
target
target resident
killing
specific identifier
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.)
Granted
Application number
CN201811028165.4A
Other languages
Chinese (zh)
Other versions
CN110928596B (en
Inventor
张久龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
3600 Technology Group Co ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201811028165.4A priority Critical patent/CN110928596B/en
Publication of CN110928596A publication Critical patent/CN110928596A/en
Application granted granted Critical
Publication of CN110928596B publication Critical patent/CN110928596B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44594Unloading

Abstract

The invention provides a method and a device for killing a resident process, wherein the method comprises the following steps: after a user-defined signal carrying a specific identifier is received, adding a receiving mark for indicating that the specific identifier is received at a specified position of a target resident process, wherein the specific identifier is used for identifying and killing the target resident process; after the task in the target resident process is executed, detecting whether a receiving mark is added at the designated position of the target resident process; if yes, executing killing operation on the target resident process. Therefore, the receiving mark used for indicating whether the signal carrying the specific identifier is received or not is added at the designated position of the target resident process, so that the resident process can not be killed immediately after the resident process receives the self-defined signal carrying the specific identifier, but the resident process is killed after the script is executed, and the problem that the script in execution is interrupted due to the fact that the process exits immediately can be effectively avoided.

Description

Method and device for killing resident process
Technical Field
The invention relates to the technical field of computer application, in particular to a method and a device for killing a resident process.
Background
In general, after a new item comes online, its real code directory is a differentiated version number, and then a soft connection is made to point to an item directory configured by nginx (i.e., engine x, a high-performance HTTP and reverse proxy server), some resident scripts inevitably need to be written in the item directory, and since there are different changes in the new item when it comes online, it is necessary to kill these resident scripts in the old item directory and then start up the scripts in the new item directory in order to ensure the normal operation of the program.
In the prior art, in the process of killing the old script, the old script is usually deleted directly, namely the script process is ended directly, and thus the script in operation is often interrupted.
Disclosure of Invention
In view of the above, the present invention has been developed to provide a method and apparatus for killing resident processes that overcome, or at least partially solve, the above-discussed problems.
According to one aspect of the invention, a method for killing a resident process is provided, which comprises the steps of adding a receiving mark for indicating that a specific identifier is received at a specified position of a target resident process after receiving a self-defined signal carrying the specific identifier, wherein the specific identifier is used for identifying and killing the target resident process;
when the task in the target resident process is executed, detecting whether the receiving mark is added at the designated position of the target resident process;
and if so, executing a killing operation on the target resident process.
Optionally, when the task in the target resident process is executed completely, if it is not detected that the receiving mark is added to the designated position of the target resident process, the target resident process is continuously utilized to execute the corresponding task.
Optionally, the resident process includes a resident process executing a PHP script.
Optionally, the method further comprises: defining a specific identifier for identifying the killing of the target resident process;
and registering the user-defined semaphore and a corresponding processing function in the target resident process, wherein the processing function is used for analyzing the user-defined signal, and after the user-defined signal is analyzed to carry the specific identifier, the receiving mark is added at the specified position of the target resident process.
Optionally, registering the custom semaphore in the target resident process comprises: the SIGUSR2 semaphore is registered in the target-resident process.
Optionally, adding a receiving tag of a specific identifier at a specified position of the target resident process, including:
adding a receipt marker of the specific identification at a process start position of the target resident process.
Optionally, after the killing operation is performed on the target resident process, the method further includes:
and starting a new resident process, and replacing the target resident process with the new resident process to execute a task.
According to another aspect of the present invention, there is also provided an apparatus for killing a resident process, comprising:
the adding module is suitable for adding a receiving mark for indicating that the specific identifier is received at the specified position of the target resident process after receiving a self-defined signal carrying the specific identifier, wherein the specific identifier is used for identifying and killing the target resident process;
the detection module is suitable for detecting whether the receiving mark is added at the designated position of the target resident process or not when the task in the target resident process is executed;
and the process killing module is suitable for executing killing operation on the target resident process when the detection module detects that the receiving mark is added at the specified position of the target resident process.
Optionally, the apparatus further comprises:
and the execution module is suitable for continuing to execute the corresponding task by utilizing the target resident process if the receiving mark is not detected to be added at the specified position of the target resident process when the task in the target resident process is executed.
Optionally, the resident process includes a resident process executing a PHP script.
Optionally, the apparatus further comprises:
a definition module adapted to define a specific identifier for identifying killing of the target resident process;
and the registration module is suitable for registering the user-defined semaphore and a corresponding processing function in the target resident process, wherein the processing function is used for analyzing the user-defined signal, and after the user-defined signal is analyzed to carry the specific identifier, the receiving mark is added at the specified position of the target resident process.
Optionally, the registration module is further adapted to:
the SIGUSR2 semaphore is registered in the target-resident process.
Optionally, the adding module is further adapted to:
adding a receipt marker of the specific identification at a process start position of the target resident process.
Optionally, the apparatus further comprises:
and the starting module is suitable for starting a new resident process after the process killing module performs killing operation on the target resident process, and replacing the target resident process with the new resident process to execute a task.
According to yet another aspect of the present invention, there is also provided a computer storage medium having computer program code stored thereon, which when run on a computing device, causes the computing device to perform a method of killing resident processes as described in any of the above.
In accordance with yet another aspect of the present invention, there is also provided a computing device comprising: a processor; a memory storing computer program code; the computer program code, when executed by the processor, causes the computing device to perform any of the above methods of killing resident processes.
In the embodiment of the invention, after the target resident process receives the self-defined signal carrying the specific identifier, a receiving mark indicating that the specific identifier is received is added at the specified position of the target resident process, after the task in the target resident process is executed, whether the receiving mark is added at the specified position of the target resident process is detected, if the receiving mark is added at the specified position of the target resident process, the signal carrying the specific identifier is received, and the specific identifier is used for identifying and killing the target resident process, so that the killing operation can be executed on the target resident process. Therefore, in the embodiment of the invention, the receiving mark used for indicating whether the signal carrying the specific identifier is received is added at the specified position of the target resident process, so that the resident process can not be killed immediately after the resident process receives the self-defined signal carrying the specific identifier, but the resident process is killed after the script is executed, and the problem that the script in execution is interrupted because the process exits immediately can be effectively avoided. Furthermore, the scheme can effectively ensure that the items related to the script are performed in an iterative and orderly manner.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
The above and other objects, advantages and features of the present invention will become more apparent to those skilled in the art from the following detailed description of specific embodiments thereof, taken in conjunction with the accompanying drawings.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 illustrates a flow diagram of a method of killing a resident process in accordance with one embodiment of the present invention;
FIG. 2 illustrates a flow diagram of a method of killing a resident process, in accordance with another embodiment of the present invention;
FIG. 3 illustrates a schematic structural diagram of an apparatus for killing a resident process according to one embodiment of the present invention;
FIG. 4 illustrates a schematic structural diagram of an apparatus for killing a resident process according to another embodiment of the present invention; and
figure 5 shows a schematic structural diagram of an apparatus for killing a resident process according to yet another embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Currently, when a topic or other content needs to be created, a resident process is often started, because a real-time message may come and need to be consumed, so the process cannot hang up, and the resident process (such as while true) is usually adopted to always loop to read the topic or other content. When the code of the system or the application program of the old version is updated, a new version is issued, and at the moment, a new resident process needs to be started to quit the old resident process, namely, the prior resident process is killed. How to not influence the normal operation of tasks in the process of killing the resident process, so that the generated data result is the technical problem to be solved by the application.
To solve the above technical problem, an embodiment of the present invention provides a method for killing a resident process. Figure 1 shows a flow diagram of a method of killing a resident process, in accordance with one embodiment of the present invention. Referring to fig. 1, the method includes at least steps S102 to S108.
And S102, after receiving the self-defined signal carrying the specific identifier, adding a receiving mark for indicating that the specific identifier is received at the specified position of the target resident process, wherein the specific identifier is used for identifying and killing the target resident process.
And step S104, after the task in the target resident process is executed, detecting whether a receiving mark is added at the designated position of the target resident process. If yes, go to step S106; if not, step S108 is executed and the process is ended.
And step S106, executing killing operation on the target resident process.
In the embodiment of the invention, after the target resident process receives the self-defined signal carrying the specific identifier, a receiving mark indicating that the specific identifier is received is added at the specified position of the target resident process, after the task in the target resident process is executed, whether the receiving mark is added at the specified position of the target resident process is detected, if the receiving mark is added at the specified position of the target resident process, the signal carrying the specific identifier is received, and the specific identifier is used for identifying and killing the target resident process, so that the killing operation can be executed on the target resident process. Therefore, in the embodiment of the invention, the receiving mark used for indicating whether the signal carrying the specific identifier is received is added at the specified position of the target resident process, so that the resident process can not be killed immediately after the resident process receives the self-defined signal carrying the specific identifier, but the resident process is killed after the script is executed, and the problem that the script in execution is interrupted because the process is immediately exited can be effectively avoided. Furthermore, the scheme can effectively ensure that the items related to the script are performed in an iterative and orderly manner.
Referring to step S102, in an embodiment of the present invention, before the target resident process receives the custom signal, a specific identifier for identifying the target resident process to be killed needs to be defined, for example, a specific identifier for "kill" is defined as the identifier for killing the target resident process. Of course, other forms of specific identifiers may also be used, such as an identifier using letters, character strings, and the like as a specific identifier indicating that the target resident process is killed, which is not specifically limited in the embodiment of the present invention.
In the embodiment of the invention, before the target resident process receives the custom signal, the custom semaphore and the corresponding processing function are registered in the target resident process. The processing function is used for executing corresponding analysis and processing operations after the target resident process receives the custom signal subsequently. For example, the custom signal received by the target bedpost process is analyzed, and when the custom signal is analyzed to carry a specific identifier, a receiving mark is added at the specified position of the target resident process.
In an embodiment of the present invention, the registered custom semaphore may be the SIGUSR2 semaphore. For example, when an old version of an item has a code update and a new version of the item comes online, a SIGURSR 2 semaphore (i.e., custom information volume) can be launched for the resident Process by executing the kill-USR2 Process PID (Process Identifier).
Continuing with step S102, in an embodiment of the present invention, it is critical to choose a designated location to add a receive tag in the target resident process. Because, the target resident process is subsequently determined to exit or not exit by detecting whether a receive flag is added to the target resident process. Therefore, in order to avoid the task (i.e. script) in the process detecting the receiving mark during the execution process, the embodiment of the present invention selects to add the receiving mark with a specific identifier at the process starting position of the target resident process, i.e. subsequently when the script in the process completes a cycle or the task completes the execution, it detects whether the receiving mark is added at the starting position of the process when returning to the starting position of the process.
In addition, the embodiment of the present invention may further add a receiving flag at another designated location of the target resident process, for example, add the receiving flag at the end of the process, that is, subsequently, after the script in the process completes one cycle of execution or when the task completes execution, it may detect whether the receiving flag is added at the end of the process, and the situation that the receiving flag is detected in the task execution process does not occur, thereby avoiding the problem that the task is forced to be interrupted in the execution process.
In this embodiment, a reception flag "true" indicating that a specific identification has been received, i.e., a flag "true" for kill, may be set. Of course, other labels may be used to represent the receiving label, and the embodiment of the present invention is not limited in this respect.
In this embodiment of the present invention, the resident process may include a resident process that executes a Hypertext Preprocessor (PHP) script, and may also include other resident processes such as a shell process.
Referring to step S104 and step S106, in the embodiment of the present invention, after the task in the target resident process is executed, it is detected whether a receiving flag is added at the specified position of the target resident process, and when it is detected that the receiving flag is added at the specified position of the target resident process, a killing operation may be performed on the target resident process, that is, the target resident process exits. And when the receiving mark is not detected to be added at the specified position of the target resident process, continuing to execute the corresponding task by utilizing the target resident process.
For example, in conjunction with the above embodiment, if the mark "true" of kill in the target resident process is detected after the task execution of the target resident process is completed and the process returns to the start position, the target resident process break is dropped, i.e., the target resident process exits. If the flag "true" of kill in the target resident process is not detected, the current target resident process is continuously used, and the corresponding task is executed by using the current target resident process.
In an embodiment of the present invention, after the killing operation is performed on the target resident process, in order to ensure that the subsequent task can be normally executed, a new resident process needs to be started, so that the started new resident process is used to replace the target resident process to execute the task.
Embodiments of the present invention provide another method for killing resident processes. Figure 2 shows a flow diagram of a method of killing a resident process, in accordance with one embodiment of the present invention. Referring to fig. 2, the method includes at least steps S202 to S212.
In step S202, a specific identifier for identifying the killing of the target resident process is defined.
In this step, for example, "kill" may be defined as a specific identifier for killing the target resident process, or other identifiers, letters, etc. may also be used as specific identifiers, which is not specifically limited by the embodiment of the present invention.
Step S204, registering the self-defined semaphore and the corresponding processing function in the target resident process.
For example, the registered custom semaphore may be the SIGUSR2 semaphore.
In the step, the processing function is used for analyzing the user-defined signal, and after the user-defined signal is analyzed to carry the specific identifier, a receiving mark is added at the specified position of the target resident process.
Step S206, after receiving the self-defined signal carrying the specific identifier, adding a receiving mark indicating that the specific identifier is received at the specified position of the target resident process, wherein the specific identifier is used for identifying and killing the target resident process.
Step S208, after the task in the target resident process is executed, detecting whether a receiving mark is added at the designated position of the target resident process. If yes, go to step S210; if not, go to step S212.
Step S210, a killing operation is performed on the target resident process.
In step S212, the target resident process is used to execute the corresponding task.
In an embodiment of the present invention, after the killing operation is performed on the target resident process, in order to ensure that the subsequent task can be normally executed, a new resident process needs to be started, so that the started new resident process is used to replace the target resident process to execute the task.
Based on the same inventive concept, an embodiment of the present invention further provides an apparatus for killing a resident process, and fig. 3 illustrates a schematic structural diagram of an apparatus for killing a resident process according to an embodiment of the present invention. Referring to fig. 3, an apparatus 300 for killing a resident process includes at least an adding module, a detecting module, and a process killing module.
The functions of the components or devices of the apparatus 300 based on killing resident processes and the connection relationships between the components of the present embodiment will now be described:
the adding module 310 is adapted to add a receiving mark indicating that the specific identifier is received at a specified position of the target resident process after receiving the self-defined signal carrying the specific identifier, wherein the specific identifier is used for identifying and killing the target resident process;
the detection module 320 is coupled with the adding module 310 and is adapted to detect whether a receiving mark is added to a designated position of the target resident process after the task in the target resident process is executed;
and the process killing module 330 is coupled with the detection module 320 and is adapted to perform a killing operation on the target resident process when the detection module 320 detects that the receiving mark is added at the specified position of the target resident process.
In one embodiment of the invention, the resident process may comprise a resident process executing the PHP script.
In an embodiment of the present invention, the registration module 360 is further adapted to register the SIGUSR2 semaphore in the target resident process.
In an embodiment of the invention, the adding module 310 is further adapted to add a specifically identified receipt tag at the process start position of the target resident process.
Another device for killing the resident process is further provided in the embodiment of the present invention, and fig. 4 is a schematic structural diagram of the device for killing the resident process according to an embodiment of the present invention. Referring to fig. 4, an apparatus 300 for killing a resident process includes at least an adding module 310, a detecting module 320, a process killing module 330, an executing module 340, a defining module 350, and a registering module 360.
The executing module 340, coupled to the detecting module 320, is adapted to continue to execute the corresponding task by using the target resident process if it is not detected that the receiving flag is added at the designated location of the target resident process after the task in the target resident process is executed.
A definition module 350, coupled to the adding module 310, adapted to define a specific identifier for identifying the killing of the target resident process;
and the registering module 360 is coupled with the adding module 310 and is suitable for registering the user-defined semaphore and a corresponding processing function in the target resident process, wherein the processing function is used for analyzing the user-defined semaphore and adding a receiving mark at a specified position of the target resident process after the user-defined semaphore is analyzed to carry a specific identifier.
The embodiment of the present invention further provides another device for killing a resident process, and referring to fig. 5, the device 300 for killing a resident process may further include a start module 370 in addition to the above modules.
The starting module 370, coupled to the process killing module 330, is adapted to start the new resident process after the process killing module 330 performs the killing operation on the target resident process, and to execute the task by replacing the target resident process with the new resident process.
According to yet another aspect of the present invention, there is also provided a computer storage medium having computer program code stored thereon, which when run on a computing device, causes the computing device to perform the method of killing resident processes of any of the above.
In accordance with yet another aspect of the present invention, there is also provided a computing device comprising: a processor; a memory storing computer program code; the computer program code, when executed by the processor, causes the computing device to perform any of the above methods of killing resident processes.
According to any one or a combination of the above preferred embodiments, the following advantages can be achieved by the embodiments of the present invention:
in the embodiment of the invention, after the target resident process receives the self-defined signal carrying the specific identifier, a receiving mark indicating that the specific identifier is received is added at the specified position of the target resident process, after the task in the target resident process is executed, whether the receiving mark is added at the specified position of the target resident process is detected, if the receiving mark is added at the specified position of the target resident process, the signal carrying the specific identifier is received, and the specific identifier is used for identifying and killing the target resident process, so that the killing operation can be executed on the target resident process. Therefore, in the embodiment of the invention, the receiving mark used for indicating whether the signal carrying the specific identifier is received is added at the specified position of the target resident process, so that the resident process can not be killed immediately after the resident process receives the self-defined signal carrying the specific identifier, but the resident process is killed after the script is executed, and the problem that the script in execution is interrupted because the process exits immediately can be effectively avoided. Furthermore, the scheme can effectively ensure that the items related to the script are performed in an iterative and orderly manner.
It is clear to those skilled in the art that the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and for the sake of brevity, further description is omitted here.
In addition, the functional units in the embodiments of the present invention may be physically independent of each other, two or more functional units may be integrated together, or all the functional units may be integrated in one processing unit. The integrated functional units may be implemented in the form of hardware, or in the form of software or firmware.
Those of ordinary skill in the art will understand that: the integrated functional units, if implemented in software and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computing device (e.g., a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention when the instructions are executed. And the aforementioned storage medium includes: u disk, removable hard disk, Read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disk, and other various media capable of storing program code.
Alternatively, all or part of the steps of implementing the foregoing method embodiments may be implemented by hardware (such as a computing device, e.g., a personal computer, a server, or a network device) associated with program instructions, which may be stored in a computer-readable storage medium, and when the program instructions are executed by a processor of the computing device, the computing device executes all or part of the steps of the method according to the embodiments of the present invention.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments can be modified or some or all of the technical features can be equivalently replaced within the spirit and principle of the present invention; such modifications or substitutions do not depart from the scope of the present invention.
The embodiment of the invention provides A1 and a method for killing a resident process, which comprises the following steps:
after a user-defined signal carrying a specific identifier is received, adding a receiving mark for indicating that the specific identifier is received at a specified position of a target resident process, wherein the specific identifier is used for identifying and killing the target resident process;
when the task in the target resident process is executed, detecting whether the receiving mark is added at the designated position of the target resident process;
and if so, executing a killing operation on the target resident process.
A2, the method according to A1, wherein,
and when the task in the target resident process is executed, if the receiving mark is not detected to be added at the specified position of the target resident process, continuing to execute the corresponding task by utilizing the target resident process.
A3, the method of A1 or A2, wherein the resident process comprises a resident process executing a PHP script.
A4, the method according to A1 or A2, further comprising:
defining a specific identifier for identifying the killing of the target resident process;
and registering the user-defined semaphore and a corresponding processing function in the target resident process, wherein the processing function is used for analyzing the user-defined signal, and after the user-defined signal is analyzed to carry the specific identifier, the receiving mark is added at the specified position of the target resident process.
A5, the method of A4, wherein registering the custom semaphore in the target resident process comprises:
the SIGUSR2 semaphore is registered in the target-resident process.
A6, the method according to A1 or A2, wherein adding a specifically identified receipt tag at a designated location of the target resident process comprises:
adding a receipt marker of the specific identification at a process start position of the target resident process.
A7, the method according to A1 or A2, wherein after the killing operation is performed on the target resident process, further comprising:
and starting a new resident process, and replacing the target resident process with the new resident process to execute a task.
B8, an apparatus for killing a resident process, comprising:
the adding module is suitable for adding a receiving mark for indicating that the specific identifier is received at the specified position of the target resident process after receiving a self-defined signal carrying the specific identifier, wherein the specific identifier is used for identifying and killing the target resident process;
the detection module is suitable for detecting whether the receiving mark is added at the designated position of the target resident process or not when the task in the target resident process is executed;
and the process killing module is suitable for executing killing operation on the target resident process when the detection module detects that the receiving mark is added at the specified position of the target resident process.
B9, the device according to B8, wherein further comprising:
and the execution module is suitable for continuing to execute the corresponding task by utilizing the target resident process if the receiving mark is not detected to be added at the specified position of the target resident process when the task in the target resident process is executed.
B10, the apparatus according to B8 or B9, wherein the resident process comprises a resident process executing a PHP script.
B11, the device according to B8 or B9, wherein further comprising:
a definition module adapted to define a specific identifier for identifying killing of the target resident process;
and the registration module is suitable for registering the user-defined semaphore and a corresponding processing function in the target resident process, wherein the processing function is used for analyzing the user-defined signal, and after the user-defined signal is analyzed to carry the specific identifier, the receiving mark is added at the specified position of the target resident process.
B12, the apparatus of B11, wherein the registration module is further adapted to:
the SIGUSR2 semaphore is registered in the target-resident process.
B13, the apparatus according to B8 or B9, wherein the adding module is further adapted to:
adding a receipt marker of the specific identification at a process start position of the target resident process.
B14, the device according to B8 or B9, wherein further comprising:
and the starting module is suitable for starting a new resident process after the process killing module performs killing operation on the target resident process, and replacing the target resident process with the new resident process to execute a task.
C15, a computer storage medium storing computer program code which, when run on a computing device, causes the computing device to perform the method of killing a resident process of any one of a1-a 7.
D16, a computing device, comprising: a processor; a memory storing computer program code; the computer program code, when executed by the processor, causes the computing device to perform the method of killing resident processes of any of a1-a 7.

Claims (10)

1. A method of killing a resident process, comprising:
after a user-defined signal carrying a specific identifier is received, adding a receiving mark for indicating that the specific identifier is received at a specified position of a target resident process, wherein the specific identifier is used for identifying and killing the target resident process;
when the task in the target resident process is executed, detecting whether the receiving mark is added at the designated position of the target resident process;
and if so, executing a killing operation on the target resident process.
2. The method of claim 1, wherein,
and when the task in the target resident process is executed, if the receiving mark is not detected to be added at the specified position of the target resident process, continuing to execute the corresponding task by utilizing the target resident process.
3. The method of claim 1 or 2, wherein the resident process comprises a resident process executing a PHP script.
4. The method of claim 1 or 2, further comprising:
defining a specific identifier for identifying the killing of the target resident process;
and registering the user-defined semaphore and a corresponding processing function in the target resident process, wherein the processing function is used for analyzing the user-defined signal, and after the user-defined signal is analyzed to carry the specific identifier, the receiving mark is added at the specified position of the target resident process.
5. The method of claim 4, wherein registering the custom semaphore in the target resident process comprises:
the SIGUSR2 semaphore is registered in the target-resident process.
6. The method of claim 1 or 2, wherein adding a specifically identified receipt tag at a specified location of the target resident process comprises:
adding a receipt marker of the specific identification at a process start position of the target resident process.
7. The method of claim 1 or 2, wherein after performing the kill operation on the target resident process, further comprising:
and starting a new resident process, and replacing the target resident process with the new resident process to execute a task.
8. An apparatus to kill a resident process, comprising:
the adding module is suitable for adding a receiving mark for indicating that the specific identifier is received at the specified position of the target resident process after receiving a self-defined signal carrying the specific identifier, wherein the specific identifier is used for identifying and killing the target resident process;
the detection module is suitable for detecting whether the receiving mark is added at the designated position of the target resident process or not when the task in the target resident process is executed;
and the process killing module is suitable for executing killing operation on the target resident process when the detection module detects that the receiving mark is added at the specified position of the target resident process.
9. A computer storage medium having computer program code stored thereon which, when run on a computing device, causes the computing device to perform a method of killing a resident process as claimed in any one of claims 1 to 7.
10. A computing device, comprising: a processor; a memory storing computer program code; the computer program code, when executed by the processor, causes the computing device to perform a method of killing resident processes as claimed in any of claims 1-7.
CN201811028165.4A 2018-09-04 2018-09-04 Method and device for killing resident process Active CN110928596B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811028165.4A CN110928596B (en) 2018-09-04 2018-09-04 Method and device for killing resident process

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811028165.4A CN110928596B (en) 2018-09-04 2018-09-04 Method and device for killing resident process

Publications (2)

Publication Number Publication Date
CN110928596A true CN110928596A (en) 2020-03-27
CN110928596B CN110928596B (en) 2024-02-06

Family

ID=69855746

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811028165.4A Active CN110928596B (en) 2018-09-04 2018-09-04 Method and device for killing resident process

Country Status (1)

Country Link
CN (1) CN110928596B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0944376A (en) * 1995-07-27 1997-02-14 Nec Software Ltd Process state management system
CN101226487A (en) * 2008-01-30 2008-07-23 中国船舶重工集团公司第七〇九研究所 Method for implementing inner core level thread library based on built-in Linux operating system
CN103455380A (en) * 2012-06-05 2013-12-18 上海斐讯数据通信技术有限公司 Multi-process communication system and establishment and communication method thereof
CN105843675A (en) * 2016-04-01 2016-08-10 腾讯科技(深圳)有限公司 Thread exiting method and device
CN106648704A (en) * 2017-01-05 2017-05-10 广东欧珀移动通信有限公司 Process management method and device and mobile terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0944376A (en) * 1995-07-27 1997-02-14 Nec Software Ltd Process state management system
CN101226487A (en) * 2008-01-30 2008-07-23 中国船舶重工集团公司第七〇九研究所 Method for implementing inner core level thread library based on built-in Linux operating system
CN103455380A (en) * 2012-06-05 2013-12-18 上海斐讯数据通信技术有限公司 Multi-process communication system and establishment and communication method thereof
CN105843675A (en) * 2016-04-01 2016-08-10 腾讯科技(深圳)有限公司 Thread exiting method and device
CN106648704A (en) * 2017-01-05 2017-05-10 广东欧珀移动通信有限公司 Process management method and device and mobile terminal

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
于红 等: "《计算机操作系统》", 31 May 2017, pages: 80 - 83 *
张伟 等: "UNIX系统中常驻进程的一个应用实例", 《计算机技术与发展》, 31 May 1999 (1999-05-31), pages 50 - 52 *
王铁军 等: "Linux编程实战", pages: 42 - 45 *

Also Published As

Publication number Publication date
CN110928596B (en) 2024-02-06

Similar Documents

Publication Publication Date Title
CN108665297B (en) Method and device for detecting abnormal access behavior, electronic equipment and storage medium
CN102647414B (en) Protocol analysis method, protocol analysis device and protocol analysis system
CN111917740A (en) Abnormal flow alarm log detection method, device, equipment and medium
CN107704604B (en) Message persistence method, server and computer readable storage medium
CN110210218B (en) Virus detection method and related device
CN111639101A (en) Method, device and system for correlating rule engine system of internet of things and storage medium
CN112866261A (en) Flow detection method and storage medium based on cloud computing and user behavior analysis
CN104080016B (en) The method and apparatus that audio/video information is shown are carried out in a kind of browser
CN106909486B (en) Method, device and system for processing business exception
CN113094625B (en) Page element positioning method and device, electronic equipment and storage medium
CN110210216B (en) Virus detection method and related device
CN109558548B (en) Method for eliminating CSS style redundancy and related product
CN110928596A (en) Method and device for killing resident process
US20220027340A1 (en) System and method for detecting changes in webpages and generating metric correlations therefrom
CN111259398B (en) Virus defense method, device, equipment and readable storage medium
CN110706035B (en) Updating effect evaluation method and device, storage medium and electronic equipment
CN110069506B (en) Service data maintenance method, device and server
CN110210215B (en) Virus detection method and related device
CN116545701A (en) HTTP message rule matching method, system, equipment and medium
US9443221B2 (en) Physical location tagging via image recognition
CN113872980B (en) Identification method and device of industrial control equipment information, storage medium and equipment
US20160253374A1 (en) Data file writing method and system, and data file reading method and system
CN114900492A (en) Abnormal mail detection method, device, system and computer readable storage medium
CN113282209A (en) Electronic book information display method, electronic equipment and computer storage medium
CN114006706A (en) Network security detection method, system, computer device and readable storage medium

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20240114

Address after: Room 03, 2nd Floor, Building A, No. 20 Haitai Avenue, Huayuan Industrial Zone (Huanwai), Binhai New Area, Tianjin, 300450

Applicant after: 3600 Technology Group Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Applicant before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant