CN108984212B - Method for closing process and electronic equipment - Google Patents

Method for closing process and electronic equipment Download PDF

Info

Publication number
CN108984212B
CN108984212B CN201710398808.3A CN201710398808A CN108984212B CN 108984212 B CN108984212 B CN 108984212B CN 201710398808 A CN201710398808 A CN 201710398808A CN 108984212 B CN108984212 B CN 108984212B
Authority
CN
China
Prior art keywords
target
target process
closing
electronic device
service
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
Application number
CN201710398808.3A
Other languages
Chinese (zh)
Other versions
CN108984212A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201710398808.3A priority Critical patent/CN108984212B/en
Publication of CN108984212A publication Critical patent/CN108984212A/en
Application granted granted Critical
Publication of CN108984212B publication Critical patent/CN108984212B/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/4401Bootstrapping
    • G06F9/442Shutdown

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses a process closing method and electronic equipment, wherein the method comprises the steps of receiving a target process closing instruction, and determining a target process type to which a target process belongs according to the target process closing instruction; and acquiring target closing indication information corresponding to the target process type, and closing the target process according to the target closing indication information. In the method for closing a process shown in this embodiment, a type of a target process to which a target process that needs to be closed currently belongs is determined, and the target process is closed according to the type of the target process, so that the target processes with different types of target processes adopt different manners for closing the target process, thereby successfully closing the target process and effectively avoiding a restart condition of the target process.

Description

Method for closing process and electronic equipment
Technical Field
The present invention relates to the field of computer application technologies, and in particular, to a method for closing a process and an electronic device.
Background
Various processes running on the electronic device can enable the electronic device to provide various functions. However, in order to ensure the operating speed of the electronic device, unnecessary processes running on the electronic device need to be shut down.
In the prior art, a process is generally closed by sending a specific signal for closing the process to be closed, and closing the process after the process receives the specific signal.
However, the method shown in the prior art is disadvantageous in that different processes all adopt the same closing method, if the processes have a restart attribute, the processes can be restarted even if the processes are closed, and if the processes can be mutually started with the associated processes in the background, the associated processes can be restarted even if the processes are closed, for example, the processes can be a jinshan mobile phone assistant, and the associated processes can be jinshan toxamax, so that even if the jinshan mobile phone assistant is closed, the jinshan mobile phone assistant can be restarted by the jinshan mobile phone running in the background. Therefore, the prior art cannot effectively guarantee the successful closing of the process.
Disclosure of Invention
The embodiment of the invention provides a process closing method capable of ensuring successful process closing and electronic equipment.
A first aspect of an embodiment of the present invention provides a method for closing a process, including:
receiving a target process closing instruction, wherein the target process closing instruction is used for indicating to close a target process;
determining the target process type of the target process according to the target process closing instruction;
acquiring target closing indication information corresponding to the target process type, wherein the target closing indication information is used for indicating a mode of closing the target process, and different target process types correspond to different target closing indication information;
and closing the target process according to the target closing indication information.
A second aspect of an embodiment of the present invention provides an electronic device, including:
the system comprises a first receiving unit, a second receiving unit and a third receiving unit, wherein the first receiving unit is used for receiving a target process closing instruction which is used for indicating to close a target process;
the first determining unit is used for determining the target process type of the target process according to the target process closing instruction;
an obtaining unit, configured to obtain target closing indication information corresponding to the target process type, where the target closing indication information is used to indicate a manner of closing the target process, and different target process types correspond to different target closing indication information;
and the closing unit is used for closing the target process according to the target closing indication information.
A third aspect of an embodiment of the present invention provides an electronic device, including:
one or more processor units, a storage unit, a bus system, and one or more programs, the processor units and the storage unit being connected by the bus system;
wherein the one or more programs are stored in the storage unit, the one or more programs comprising instructions which, when executed by the electronic device, cause the electronic device to perform the method as provided by the first aspect of an embodiment of the present invention.
A fourth aspect of embodiments of the present invention provides a computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by an electronic device, cause the electronic device to perform the method provided by the first aspect of embodiments of the present invention.
According to the technical scheme, the embodiment of the invention has the following advantages:
in the method for closing a process shown in this embodiment, a type of a target process to which a target process that needs to be closed currently belongs is determined, and the target process is closed according to the type of the target process, so that the target processes with different types of target processes adopt different manners for closing the target process, thereby successfully closing the target process and effectively avoiding a restart condition of the target process.
Drawings
Fig. 1 is a schematic structural diagram of an embodiment of an electronic device provided in the present invention;
FIG. 2 is a flowchart illustrating steps of a method for shutting down a process according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a prompt interface according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an embodiment of a communication system provided in the present invention;
FIG. 5 is a flowchart illustrating steps of another embodiment of a method for shutting down a process;
fig. 6 is a schematic structural diagram of another embodiment of an electronic device provided in the present invention;
fig. 7 is a schematic structural diagram of another embodiment of an electronic device provided in the present invention.
Detailed Description
In order to better understand the method shown in the embodiment of the present invention, first, a structure of an electronic device capable of implementing the method shown in the embodiment of the present invention is described below with reference to fig. 1.
The electronic device includes an input unit 105, a processor unit 103, an output unit 101, a communication unit 107, a storage unit 104, a radio frequency circuit 108, and the like.
These components communicate over one or more buses. Those skilled in the art will appreciate that the configuration of the electronic device shown in fig. 1 is not intended to limit the present invention, and may be a bus or star configuration, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
In the embodiment of the present invention, the electronic device includes, but is not limited to, a desktop computer, a smart phone, a mobile computer, a tablet computer, a Personal Digital Assistant (PDA), a media player, a smart television, and the like.
The electronic device includes:
an output unit 101 for outputting an image to be displayed.
Specifically, the output unit 101 includes, but is not limited to, an image output unit 1011 and an audio output unit 1012.
The image output unit 1011 is used for outputting characters, pictures and/or videos. The image output unit 1011 may include a Display panel, for example, a Display panel configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), a Field Emission Display (FED), and the like. Alternatively, the image output unit 1011 may include a reflective display, such as an electrophoretic (electrophoretic) display, or a display using an Interferometric Modulation (Light) technique.
The image output unit 1011 may include a single display or a plurality of displays of different sizes. In the embodiment of the present invention, the touch screen may also be used as a display panel of the output unit 101.
For example, when the touch screen detects a gesture operation of touch or proximity thereon, the gesture operation is transmitted to the processor unit 103 to determine the type of the touch event, and then the processor unit 103 provides a corresponding visual output on the display panel according to the type of the touch event. Although in fig. 1, the input unit 105 and the output unit 101 are two independent components to implement the input and output functions of the electronic device, in some embodiments, the touch screen may be integrated with the display panel to implement the input and output functions of the electronic device. For example, the image output unit 1011 may display various Graphical User Interfaces (GUI) as virtual control components, including but not limited to windows, scroll bars, icons, and scrapbooks, for a User to operate in a touch manner.
In the embodiment of the present invention, the image output unit 1011 includes a filter and an amplifier for filtering and amplifying the video output from the processor unit 103. The sound output unit 1012 includes a digital-to-analog converter for converting the audio signal output from the processor unit 103 from a digital format to an analog format.
And the processor unit 103 is used for executing corresponding codes, processing the received information and generating and outputting a corresponding interface.
Specifically, the processor unit 103 is a control center of the electronic device, connects various parts of the whole electronic device by using various interfaces and lines, and executes various functions of the electronic device and/or processes data by running or executing software programs and/or modules stored in the storage unit and calling data stored in the storage unit. The processor unit 103 may be composed of an Integrated Circuit (IC), for example, a single packaged IC, or a plurality of packaged ICs connected with the same or different functions.
For example, the Processor Unit 103 may include only a Central Processing Unit (CPU), or a combination of a Graphics Processor (GPU), a Digital Signal Processor (DSP), and a control chip (e.g., baseband chip) in the communication Unit. In the embodiment of the present invention, the CPU may be a single operation core, or may include multiple operation cores.
A memory unit 104 for storing code and data, the code for execution by the processor unit 103.
Specifically, the storage unit 104 may be used to store software programs and modules, and the processor unit 103 executes various functional applications of the electronic device and implements data processing by running the software programs and modules stored in the storage unit 104. The storage unit 104 mainly includes a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, such as a sound playing program, an image playing program, and the like; the data storage area may store data (such as audio data, a phonebook, etc.) created according to the use of the electronic device, and the like.
In an embodiment of the invention, the Memory unit 104 may include a volatile Memory, such as a non-volatile dynamic Random Access Memory (NVRAM), a Phase Change Random Access Memory (PRAM), a Magnetoresistive Random Access Memory (MRAM), and the like, and may further include a non-volatile Memory, such as at least one disk Memory, an Electrically Erasable Programmable Read-Only Memory (EEPROM), and a flash Memory device, such as a flash Memory or a flash Memory (NOR-flash Memory) or a flash Memory.
The non-volatile memory stores an operating system and application programs executed by the processor unit 103. The processor unit 103 loads operating programs and data from the non-volatile memory into memory and stores digital content in mass storage devices. The operating system includes various components and/or drivers for controlling and managing conventional system tasks, such as memory management, storage device control, power management, etc., as well as facilitating communication between various hardware and software components.
In the embodiment of the present invention, the operating system may be an Android system developed by Google, an iOS system developed by Apple, a Windows operating system developed by Microsoft, or an embedded operating system such as Vxworks.
The application programs include any application installed on the electronic device including, but not limited to, browser, email, instant messaging service, word processing, keyboard virtualization, Widget (Widget), encryption, digital rights management, voice recognition, voice replication, positioning (e.g., functions provided by the global positioning system), music playing, and so forth.
An input unit 105 for enabling user interaction with the electronic device and/or information input into the electronic device.
For example, the input unit 105 may receive numeric or character information input by a user to generate a signal input related to user setting or function control. In the embodiment of the present invention, the input unit 105 may be a touch screen, other human-computer interaction interfaces, such as an entity input key, a microphone, and other external information capturing devices, such as a camera.
The touch screen disclosed by the embodiment of the invention can collect the operation actions touched or approached by the user. For example, the user can use any suitable object or accessory such as a finger, a stylus, etc. to operate on or near the touch screen, and drive the corresponding connection device according to a preset program. Alternatively, the touch screen may include two parts, a touch detection device and a touch controller. The touch detection device detects touch operation of a user, converts the detected touch operation into an electric signal and transmits the electric signal to the touch controller; the touch controller receives the electrical signal from the touch sensing device and converts it to touch point coordinates, which are fed to the processor unit 103.
The touch controller can also receive and execute commands sent by the processor unit 103. In addition, the touch screen can be realized by various types such as a resistive type, a capacitive type, an infrared ray, a surface acoustic wave and the like.
In other embodiments of the present invention, the physical input keys used by the input unit 105 may include, but are not limited to, one or more of a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a track ball, a mouse, a joystick, etc. The input unit 105 in the form of a microphone may collect speech input by a user or the environment and convert it into commands in the form of electrical signals executable by the processor unit 103.
In some other embodiments of the present invention, the input unit 105 may also be various sensing devices, such as hall devices, for detecting physical quantities of the electronic device, such as force, moment, pressure, stress, position, displacement, speed, acceleration, angle, angular velocity, number of rotations, rotation speed, and time of change of operating state, and converting the physical quantities into electric quantities for detection and control. Other sensing devices may include gravity sensors, three-axis accelerometers, gyroscopes, electronic compasses, ambient light sensors, proximity sensors, temperature sensors, humidity sensors, pressure sensors, heart rate sensors, fingerprint identifiers, and the like.
A communication unit 107 for establishing a communication channel through which the electronic device connects to a remote server and downloads media data from the remote server. The communication unit 107 may include a Wireless Local Area Network (wlan) module, a bluetooth module, a baseband module, and other communication modules, and a Radio Frequency (RF) circuit corresponding to the communication module, and is configured to perform wlan communication, bluetooth communication, infrared communication, and/or cellular communication system communication, such as Wideband Code Division Multiple Access (W-CDMA) and/or High Speed Downlink Packet Access (HSDPA) for example. The communication module is used for controlling communication of each component in the electronic equipment and can support direct memory access.
In different embodiments of the present invention, the various communication modules in the communication unit 107 are generally in the form of Integrated Circuit chips (Integrated Circuit chips), and can be selectively combined without including all the communication modules and corresponding antenna groups. For example, the communication unit 107 may comprise only a baseband chip, a radio frequency chip and a corresponding antenna to provide communication functions in a cellular communication system. The electronic device may be connected to a Cellular Network or the internet via a wireless communication connection established by the communication unit 107, such as a wireless local area Network access or a WCDMA access. In some alternative embodiments of the present invention, the communication module, such as the baseband module, in the communication unit 107 may be integrated into the processor unit 103, typically as the APQ + MDM family of platforms provided by the high-pass (Qualcomm) corporation.
And the radio frequency circuit 108 is used for receiving and sending signals in the process of information transceiving or conversation. For example, after receiving downlink information of the base station, the downlink information is processed by the processor unit 103; in addition, the data for designing uplink is transmitted to the base station. Generally, the radio frequency circuitry 108 includes well-known circuitry for performing these functions, including but not limited to an antenna system, a radio frequency transceiver, one or more amplifiers, a tuner, one or more oscillators, a digital signal processor, a Codec (Codec) chipset, a Subscriber Identity Module (SIM) card, memory, and so forth. In addition, the radio frequency circuitry 108 may also communicate with networks and other devices via wireless communications.
The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), High Speed Uplink Packet Access (HSUPA), Long Term Evolution (Long Term Evolution), LTE, e-mail, Short Message Service (SMS), and the like.
A power supply 109 for powering the various components of the electronic device to maintain operation thereof. As a general understanding, the power supply 109 may be a built-in battery, such as a common lithium ion battery, a nickel metal hydride battery, and the like, and also includes an external power supply for directly supplying power to the electronic device, such as an AC adapter, and the like. In some embodiments of the invention, the power supply 109 may be more broadly defined and may include, for example, a power management system, a charging system, a power failure detection circuit, a power converter or inverter, a power status indicator (e.g., a light emitting diode), and any other components associated with power generation, management, and distribution of an electronic device.
Based on the electronic device shown in fig. 1, the following describes in detail a specific execution flow of the method for closing a process provided in this embodiment with reference to fig. 2:
step 201, receiving a target process closing instruction.
The target process closing instruction is used for indicating the closing of the target process.
In this embodiment, after the electronic device receives the target process closing instruction, the electronic device may determine that the target process needs to be closed.
The process shown in this embodiment is: a running application, i.e. an instance of a running program, mainly contains process kernel objects and process address spaces.
Each process has its own independent memory space. An application may start multiple processes simultaneously. For example, for an IE browser program, a new process is initiated every time an IE browser window is opened. Similarly, each time a java.exe program of JDK is executed, a separate Java virtual machine process is started, which is tasked with parsing and executing Java program code.
Specifically, a process may be composed of multiple threads, where a thread refers to an execution flow in a process, where a thread is a minimum scheduling unit of an operating system, and mainly includes a thread kernel object, a register, and a stack, that is, multiple different threads may be simultaneously run in a process, and each of the multiple different threads executes different tasks.
In this embodiment, it is determined that the target process needs to be closed through the received target process closing execution, where the number of the target processes shown in this embodiment is one or more, that is, the specific number of the target processes is not limited in this embodiment.
How to receive the target process shutdown instruction is explained as follows:
the electronic device shown in this embodiment may generate a prompt interface, where the prompt interface is used to receive the target process closing instruction.
The following describes an optional structure of the prompt interface with reference to fig. 3, and it should be understood that the description of the prompt interface shown in fig. 3 is an optional example, and is not limited thereto, as long as the electronic device receives the target process closing instruction through the prompt interface.
Fig. 3 is a schematic structural diagram of an embodiment of a prompt interface provided in the present invention.
As shown in fig. 3, the electronic device may display the generated prompt interface on a display screen of the electronic device, where multiple processes may be displayed on the prompt interface.
In this embodiment, a user of the prompt interface receives a selection operation input by the user, and at least one process to be selected is displayed on the prompt interface, so that the user can input the selection operation through the prompt interface and select the target process on the prompt interface through the selection operation.
Specifically, when the user determines that the target process is desired to be closed, the user may click a selected frame corresponding to the target process on the operation region 301 on the prompt interface, so that the selected frame corresponding to the target process on the operation region 301 on the prompt interface is selected, and the prompt interface may generate the target process closing instruction for indicating the target process after receiving a selected operation input by the user.
For example, if the user wishes to close the process media player, the user may click a selected frame corresponding to the media player on the operation area 301 of the prompt interface, and the selected frame may be selected, and as a specific example, please refer to fig. 3 in detail, the prompt interface may determine that the target process selected by the user is the media player according to the click operation input by the user, and the prompt interface may generate a target process closing instruction, where the target process closing instruction is used to instruct to close the process of the media player.
It should be clear that, in this embodiment, the description of the target process selected by the user is an optional example, and is not limited, and in a specific application, the user may also input the selection operation by touching to select the target process.
How the electronic device shown in this embodiment generates the prompt interface is described below:
it should be clear that, in this embodiment, the description that the process to be selected is pushed to the user in the target interface mode is an optional example, and is not limited, that is, the electronic device shown in this embodiment may also push the process to be selected to the user in other modes, for example, push the process to be selected to the user in the form of a floating window, for example, push the process to be selected to the user in the form of a prompt box, and the like.
The electronic device shown in this embodiment may traverse the currently running process in real time or periodically, so as to determine whether the currently running process is a process that has to be run.
The processes that have to be run are shown in this embodiment as system processes.
The system process shown in this embodiment is a process necessary for normal operation of the system of the electronic device, and the system of the electronic device can normally operate only when the system process is in an active state, so that the system process cannot be closed.
The system process shown in this embodiment may be:
winlogon. exe: and the system process is used for managing user login.
Exe in csrss: this is the subsystem server process, which is responsible for controlling Windows create or delete threads and a 16-bit virtual DOS environment.
System Idle Process: this process is run as a single thread on each processor and dispatches the processor's time when the system is not processing other threads.
Exe: this is a session management subsystem responsible for initiating user sessions.
services. exe: this is a system service management tool, which contains many system services.
2, lsass. exe: this is a local security authorization service that manages the IP security policy and initiates ISAKMP/Oakley (IKE) and IP security drivers.
exe: a resource manager.
Spoolsv. exe: and managing the printing and fax jobs in the buffer area, and loading the file into the memory so as to print the file later.
System process svchost. exe: exe will check the location in the registry to create a list of services that need to be loaded when the system is started. Exe, if running simultaneously, indicates that there are currently multiple groups of services active and multiple DLL files calling it.
It should be clear that the above description of the system process that cannot be shut down is an optional example and is not limiting.
If the currently running progress is determined to be a system progress, the electronic equipment does not add the system progress to the prompt interface;
the additional system processes are described below:
the additional system process is not required to be operated, and the normal operation of the electronic equipment system is not influenced even if the additional system process is closed.
Specifically, the additional system process shown in this embodiment may be:
exe in mstask: allowing the program to run at the specified time.
regsvc.exe: allowing remote registry operations.
winmgmt.exe: system management information is provided.
Exe: FTP connection and management are provided through a management unit of an Internet information service.
tlntsvr. exe: allowing a remote user to log into the system and run the console program using the command line.
Extpd.exe: implementing the TFTP Internet standard. The standard does not require a username and password. A portion of the service is remotely installed.
termsrv. exe: providing a multi-session environment allows a client device to access a virtual Windows 2000Professional desktop session and Windows-based programs running on a server.
Exe: the query and update request for the domain name system DNS name is answered. A
It should be clear that the above description of the additional system process is an optional example, and is not limited, as long as the additional system process is closed, and the normal operation of the system of the electronic device is not affected.
And if the currently running system process is determined to be the additional system process, the electronic equipment can add the additional system process to the prompt interface.
It should be further understood that the above description of how to determine the prompt interface is an optional example, and is not limited, as long as all processes included in the prompt interface are currently running processes, and even if the processes are closed, the normal running processes of the system of the electronic device are not affected.
Step 202, obtaining a target process control symbol corresponding to the target process.
In this embodiment, after the electronic device determines that a target Process that needs to be currently closed is performed, a target Process control Identifier (Process Identifier, PID for short) corresponding to the target Process may be obtained.
The process control identifier PID shown in this embodiment is a code number of each process, and each process has a unique PID number.
The process controller PID is randomly assigned by the system when the process runs, does not represent a special process, and does not change the identifier when the PID runs.
Specifically, once a process is running, the system of the electronic device assigns a process control identifier PID to the process.
Therefore, a one-to-one corresponding relation is established between the process control character PID and each process running in the electronic equipment system.
Optionally, the electronic device shown in this embodiment may be pre-created with a correspondence list, where the correspondence list establishes correspondence between different process controllers PID and different processes.
In this embodiment, after the electronic device determines the target process through step 201, the target process controller PID corresponding to the target process may be queried through the correspondence list.
Step 203, determining whether the target process is a process for processing the user data, if yes, executing step 204.
Specifically, the electronic device shown in this embodiment may determine the target process according to the target process closing instruction, and further identify whether the target process is a process type for processing user data.
More specifically, the target process for processing the user data shown in this embodiment may be an editing process.
For example, the edit class process can be a Word process, an Excel process, a PPT process, and the like.
As can be seen, if the electronic device shown in this embodiment determines that the target process belongs to an editing process, it indicates that the target process is a process for processing user data.
The following describes how the electronic device specifically determines that the target process category is a process category for processing user data:
the electronic device shown in this embodiment may traverse a process running on a system of the electronic device in real time or periodically, so as to obtain an edit list.
Specifically, if the system of the electronic device traverses the Word process, it is determined that the Word process is a process for processing user data, and a process controller PID of the Word process may be set in the edit list.
It can be seen that the edit list created by the electronic device shown in this embodiment includes a plurality of process control symbols PID, and each of the process control symbols PID corresponds to a process that is running and is used for processing user data.
In this embodiment, when the electronic device determines the target process control symbol PID of the target process, the electronic device may query the edit list, determine whether the target process control symbol PID is located in the edit list, and if so, indicate that the target process is a process for processing user data.
For example, if the electronic device shown in this embodiment determines that the target process is an Excel process, it is determined whether a target process controller PID of the Excel process is located in the edit list, and if so, it indicates that the Excel process is a process for processing user data.
And step 204, storing the user data of the target process.
Optionally, when the electronic device shown in this embodiment determines that the target process is a process for processing user data, the electronic device may automatically store the user data of the target process.
Optionally, when the electronic device shown in this embodiment determines that the target process is a process for processing user data, the electronic device may generate a prompt window, where the prompt window is used to prompt a user whether to store the user data of the target process;
if the prompt window receives a first prompt operation input by a user, wherein the first prompt operation is used for indicating that the user data of the target process needs to be operated, the electronic equipment can store the user data of the target process according to the first prompt operation.
If the prompt window receives a second prompt operation input by the user, wherein the second prompt operation is used for indicating that the user data of the target process does not need to be operated, the electronic equipment does not store the user data of the target process according to the second prompt operation.
Step 205, determining whether the target PID is located in a preset service process list, if not, performing step 206, and if so, performing step 215.
In this embodiment, the electronic device may determine the target process category to which the target process belongs according to the target PID, so as to implement different closing schemes based on different target process categories to which the target process belongs, which is specifically described in the following:
in this embodiment, the electronic device may be created with a service process list in advance.
The service process list shown in this embodiment includes at least one PID.
Specifically, the process corresponding to any PID included in the service process list is a service process.
The present embodiment does not limit the specific number of PIDs included in the service process list.
The following describes how the electronic device shown in this embodiment specifically creates the server list.
The electronic device shown in this embodiment may identify categories to which all processes in the electronic device system belong, and set a PID corresponding to a determined service process in the service process list if the identified process is a service process.
As can be seen, any PID located in the service process list corresponds to a service process.
The service process is explained below:
the service process shown in this embodiment is automatically completed by the system of the electronic device, and does not need a process of interacting with the user.
For example, the service process may be a process for managing a power supply of an electronic device, or for example, the service process may be a process for managing a mobile storage device connected to the electronic device, or for example, the service process may be a firewall process, or for example, the service process may be a process related to a date, and the like, which is not described in detail in this embodiment.
In this embodiment, if the electronic device is according to the determined target PID corresponding to the target process, the electronic device may query, through the service process list, whether the target PID is located in the service process list, if so, it indicates that the target process is the service process, and if not, it indicates that the target process is the non-service process.
In this embodiment, an example that the electronic device determines whether the target process is a service process through the service process list stored in the electronic device is described, without limitation, as long as the electronic device can determine whether the target process is a service process.
The above description of determining, by the electronic device, whether the target process is a service process is an optional example, and is not limited as long as the electronic device can determine whether the target process is a service process.
In this embodiment, an example is given in which the electronic device determines whether the target process is a service process through a service process list stored in the electronic device.
Optionally, the electronic device shown in this embodiment may be created with a non-service process queue and a service process queue.
Specifically, if the target process is determined to be a service process, the target process may be placed in the service process queue, and as a result, any process in the service process queue is a service process.
Specifically, if it is determined that the target process is a non-service process, the target process may be placed in the non-service process queue, and as a result, any process in the non-service process queue is a non-service process.
The description of the specific processes included in the service process queue and the non-service process queue is not limited in this embodiment.
And step 206, acquiring target closing indication information corresponding to the non-service process type.
The target closing indication information generated by the electronic device shown in this embodiment is used to indicate a manner of closing a non-service process if a target process type to which the target process belongs is a non-service process type.
As can be seen, the target closing indication information shown in this embodiment can indicate the manner of closing processes of different categories.
The detailed request for closing the non-service process is shown in the above steps:
and step 207, acquiring a handle to which the target process belongs according to the target closing indication information.
Specifically, the electronic device opens the target process according to the target closing indication information to obtain a handle to which the target process belongs.
An API (Application Programming Interface, full chinese name) of the electronic device shown in this embodiment obtains an OpenProcess function according to the target closing instruction information.
The function prototype of the OpenProcess function shown in this embodiment is a portable OpenProcess.
The OpenProcess function shown in this embodiment is used to open the target process, and the OpenProcess function can return a handle to which the target process belongs according to the opened target process.
In this embodiment, the description of obtaining the handle to which the target function belongs is an optional example, and is not limited, as long as the handle to which the target process belongs can be obtained.
And step 208, calling the target function.
Specifically, the electronic device shown in this embodiment may call an objective function for closing the target process, where the objective function shown in this embodiment is a process termination function TerminateProcess.
The description of the objective function in this embodiment is an optional example, and is not limited as long as the objective function can close the objective process.
In this embodiment, the closing the target process refers to: and all the threads in the target process are stopped running, namely closing the process is to close all the threads in the process.
And step 209, closing the handle of the target process by using the called target function.
The target function TerminateProcess shown in this embodiment can close the target process.
Specifically, the electronic device may close the handle to which the target process belongs by using the called target function, and may further close the target process.
The advantage of closing the target process by the target function TerminateProcess shown in this embodiment is that the target process can be closed at the first time, which improves the efficiency of closing the target process.
Step 210, detecting whether the target process is successfully closed, if not, executing step 211 of this embodiment.
Specifically, in practical applications, because some processes may perform self-protection, a target process with self-protection capability cannot be closed through a target function TerminateProcess, and in order to avoid that the self-protected process cannot be successfully closed, in this embodiment, after a closing process of the target process is executed through the target function TerminateProcess, step 210 shown in this embodiment may be executed to detect whether the target process is successfully closed.
In this embodiment, if it is detected that the target process fails to be closed, the self-protected target process is closed in step 211.
And step 211, opening the handle to which the target process belongs through the kernel mode.
In this embodiment, if it is detected that the target process fails to be closed, the electronic device shown in this embodiment may implement closing of the target process through a bottom driver of the electronic device.
Specifically, the electronic device according to this embodiment may open the handle to which the target process belongs through the kernel mode.
More specifically, since it is necessary to limit the access capability between different programs, to prevent them from acquiring memory data of another program, or to acquire data of a peripheral device, and to transmit the data to the network, the controller unit of the electronic device is divided into two levels of authority: user mode and kernel mode.
As can be seen, the kernel of the controller unit may access all the memory data of the electronic device, including peripheral devices, such as a hard disk and a network card.
The electronic device shown in this embodiment may open the handle to which the target process belongs through the kernel mode.
Step 212, inserting an asynchronous procedure call function in the handle to which the target process belongs.
In this embodiment, when determining the handle to which the target process belongs, the electronic device may insert an asynchronous procedure call function into the handle to which the target process belongs.
Wherein, the Asynchronous process call (called Asynchronous procedure call, called APC for short).
Specifically, the asynchronous process call APC function can implement the shutdown of the target process that is self-protected.
Specifically, the closing process is that the electronic device inserts an asynchronous process call APC function into a handle to which the target process belongs.
And step 213, calling the target function in the asynchronous process call callback APC function.
The objective function shown in this embodiment is terminateprocesses, and the description of the objective function is described in detail in the above description and will not be repeated.
In order to implement the secondary deletion of the target process which is self-protected, the electronic equipment can call the target function in the asynchronous process call callback APC function so as to implement the closing of the target process.
And step 214, closing the handle of the target process by using the called target function.
In this embodiment, the target function TerminateProcess called by the APC function is called in the asynchronous procedure call callback, and the target process can be closed.
Therefore, by adopting the method shown in the embodiment, even if the target process is self-protected, the electronic device shown in the embodiment can close the target process through the bottom layer driver, so that the situation that the target process cannot be successfully closed is avoided, and the probability of successfully closing the target process is improved.
Step 215, obtaining the associated process according to the target closing indication information.
In this embodiment, if the target process is a service process, and many service processes have a self-restart function, the service process executes a restart procedure after detecting that the service process exits abnormally, so that the closed service process is restarted.
In order to avoid restarting the closed target process, the electronic device shown in this embodiment may acquire an association process, where the service provided by the association process is associated with the service provided by the target process.
For example, if the target process is a Jinshan cell phone Assistant, the associated process may be Jinshan Toxicba.
Step 216, generating a stop execution signaling.
The stop execution signaling shown in this embodiment is used to instruct the process to stop providing services.
In this embodiment, in order to avoid restarting the target process and avoid starting the target process by the associated process, the electronic device shown in this embodiment may generate the execution stop signaling.
In this embodiment, the execution stop signaling is not limited, as long as the process that receives the execution stop signaling cannot be started.
Step 217, sending the stop execution signaling to the target process and the associated process.
In this embodiment, the electronic device sends the stop execution signaling to the target process and the associated process, so that the associated process and the target process stop providing services.
It should be clear that, in the method described in this embodiment, the target process is taken as an example to be described, and if the target process has no associated process, the electronic device may send the execution stop signaling to the target process, so that the target process that receives the execution stop signaling is not restarted.
If the target process has the associated process associated with the target process, the electronic device can send the execution stop signaling to the target process and the associated process, so that the associated process receiving the execution stop signaling cannot start the target process, thereby effectively avoiding the condition that the target process is not restarted.
Specifically, in this embodiment, taking a system of an electronic device as a windows as an example, the electronic device may send the stop execution signaling to the target process and the associated process through a StopService API interface provided by the windows.
Optionally, the electronic device shown in this embodiment may create a stop list, and the electronic device may put the determined target process and the associated process into the stop list, where as can be seen, the stop list shown in this embodiment includes a plurality of processes.
Specifically, the electronic device shown in this embodiment may send the stop execution signaling to all processes located in the stop list at the same time.
Since the process stopping service generally consumes a long time, if the processes are closed one by one, the efficiency of closing the processes is greatly reduced, and in this embodiment, to improve the efficiency of closing the processes, the electronic device shown in this embodiment may send the stop execution signaling to all the processes in the stop list at the same time, so that all the processes in the stop list can perform the process of stopping service in a multi-thread manner, thereby greatly reducing the consumed time and improving the efficiency of closing the processes.
In this embodiment, the plurality of processes located in the stop list may also be sorted.
In this embodiment, the priority of the processes in the stop list is not limited, for example, the processes may be sorted in the descending order of the size of the resource occupied by the processes.
The electronic device shown in this embodiment may send the stop execution signaling to each process in the stop list in sequence according to the priority arranged in the stop list, so that a process occupying a large resource can be released as quickly as possible, and the operating speed of the electronic device can be increased quickly.
Optionally, in the process shown in this embodiment, if the target process or the associated process may not provide the StopService interface, the electronic device shown in this embodiment cannot close the target process and the associated process through the process shown in this step.
In this embodiment, if it fails to control the associated process and the target process to stop providing the service, the electronic device shown in this embodiment may modify the restart attribute of the target process, so that the target process with the modified restart attribute does not have a restart function, and the target process with the modified restart attribute cannot be started by the associated process.
The embodiment does not limit how to modify the restart attribute of the target process, as long as the target process is not restarted.
Step 218, a target restart instruction is received.
In this embodiment, if the electronic device is configured to close the target process, and if the target restart instruction is received by the electronic device, the target restart instruction is issued by an application layer of the electronic device to a driver layer of the electronic device, and the target restart instruction is used to instruct the driver layer of the electronic device to restart the target process.
After receiving the target restart instruction, the driver layer of the electronic device shown in this embodiment does not restart the target process immediately, but determines whether the target process needs to be restarted by performing the following steps.
The target restart instruction is used for indicating to restart the target process, and the target restart instruction is a non-user-triggered instruction.
Optionally, if the electronic device receives an instruction for restarting the target process, which is triggered by a user, the application layer of the electronic device issues the instruction for restarting the target process, which is triggered by the user, to the driver layer of the electronic device, and the driver layer of the electronic device may restart the target process according to the instruction for restarting the target process, which is triggered by the user.
It can be seen that, by using the method shown in this embodiment, the instruction triggered by the user to restart the target process is not intercepted.
Step 219, detecting whether a process control identifier PID corresponding to the target process is located in a preset process restart prevention list according to the target restart instruction, if so, executing step 220, and if not, executing step 221.
In this embodiment, the electronic device may create the process restart prevention list.
Wherein the prevent process restart list includes a process control identifier PID.
Specifically, the process restart prevention list shown in this embodiment may include a plurality of process controller PIDs, and a process corresponding to any one of the process controller PIDs does not have a restart right.
In this embodiment, unnecessary target processes are prevented from being restarted by the process restart prevention list, and in the process of creating the process restart prevention list, the electronic device in the embodiment may collect data related to the processes on the electronic device, and perform analysis by a worker to create the process restart prevention list.
Step 220, the target process is not restarted.
In this embodiment, if the electronic device determines whether the process control identifier PID corresponding to the target process is located in a preset process restart prevention list, which indicates that the target process does not have a restart permission, the electronic device does not restart the target process.
And step 221, restarting the target process.
In this embodiment, if the electronic device determines that the process control identifier PID corresponding to the target process is located in a preset process restart prevention list, which indicates that the target process has a restart permission, the electronic device does not restart the target process.
The following describes in detail the advantageous effects of the method according to the present embodiment:
by adopting the method shown in the embodiment, the target process type to which the target process belongs can be analyzed, and different methods are adopted according to different target process types, so that the situation that the target cannot be successfully closed is avoided, and the probability of successfully closing the target process is ensured to the greatest extent.
If the target process is obtained by analyzing the target process category to which the target process belongs as a process for processing user data, the user data of the target process can be stored firstly, so that the situation of user data loss caused when the target process is closed is avoided, and the safety of the user data is effectively guaranteed.
By adopting the method shown in the embodiment, under the condition that the target process can be successfully closed, the target process can be effectively prevented from being restarted, and other processes can be effectively prevented from starting the target process.
A communication system provided by an embodiment of the present invention is described below with reference to fig. 4.
The embodiment of the present invention further provides a method for closing a process based on the communication system shown in fig. 4, and the following first describes, by way of example, a specific structure of the communication system with reference to fig. 4:
fig. 4 is a schematic structural diagram of an embodiment of a communication system provided in the present invention.
The communication system includes a server device 410 and at least one electronic device 420.
The server device 410 and the electronic device 420 can perform data interaction, so as to implement the method for closing the process shown in this embodiment.
Please refer to fig. 1 for a specific structure of the electronic device 420 according to this embodiment, which is not described in detail in this embodiment.
In this embodiment, the specific structure of the server device 410 is not limited, as long as the server device 410 and the electronic device 420 can perform data interaction.
Based on the communication system shown in fig. 4, the following describes in detail an implementation procedure of another embodiment of the method for closing a process provided by this embodiment with reference to fig. 5.
Fig. 5 is a flowchart illustrating steps of a method for closing a process according to another embodiment of the present invention.
Step 501, receiving a target process closing instruction.
Step 502, obtaining a target process control symbol corresponding to the target process.
Step 503, determining whether the target process is a process for processing the user data, if yes, executing step 504.
And step 504, storing the user data of the target process.
For details of the specific execution process of step 501 to step 505 shown in this embodiment, please refer to step 201 to step 204 shown in fig. 2, and the specific execution process is not described in detail in this embodiment.
And step 505, sending the target PID to a server.
In this embodiment, after the electronic device obtains the target process control symbol of the target process, in order to save a storage space and improve efficiency of closing the process, the electronic device shown in this embodiment does not determine whether the target process is a service process or a non-service process, but directly sends the target PID to the server, and the server determines the target process.
Step 506, receiving the target PID.
Specifically, the server shown in this embodiment may store a service process list.
The service process list shown in this embodiment includes at least one PID.
Specifically, the process corresponding to any PID included in the service process list is a service process.
The present embodiment does not limit the specific number of PIDs included in the service process list.
The following describes how the server specifically creates the service process list:
optionally, the service process list stored in the server may be sent by the electronic device, and after the electronic device sends the service process list to the server, the electronic device may delete the service process list, so that the storage space of the electronic device is effectively saved, and the utilization efficiency of the storage space of the electronic device is improved.
Optionally, the service process list on the server may be created for the server itself.
Specifically, after the electronic device determines the service process, the PID of the service process may be sent to the server, and the server may store the PID of the service process sent by the electronic device in the service process list.
In the process that the electronic device needs to determine whether the target process is a service process, if the electronic device can obtain the target PID of the target process, the electronic device can send request information to the server, where the request information carries the target PID.
The server may receive the target PID by receiving the request information.
And 507, judging whether the target PID is located in the service process list, if so, executing step 508, and if not, executing step 509.
In this embodiment, the server may receive the target PID sent by the electronic device, and the server may determine whether the target PID is located in the service process list stored on the server.
If so, the server can determine that the target process is a service process, and if not, the server interface determines that the target process is a non-service process.
Step 508, sending first indication information to the electronic device.
In this embodiment, when the server determines that the target process is a service process, the server may send the first indication information to the electronic device.
The first indication information is used for indicating that the target process corresponding to the target PID is a service process.
Step 509, sending the second indication information to the electronic device.
In this embodiment, when the server determines that the target process is a non-service process, the server may send the second indication information to the electronic device.
Wherein the second indication information is used for indicating that the target process corresponding to the target PID is a non-service process.
Optionally, if the server determines that the target process is a non-service process, the server may not send any indication information to the electronic device.
After the electronic device sends the target PID to the server, timing can be carried out, and if the indication information sent by the server is not received after the preset time length is exceeded, the electronic device can determine that the target process is a non-service process.
And step 510, acquiring target closing indication information corresponding to the non-service process type.
And 511, acquiring a handle to which the target process belongs according to the target closing indication information.
Step 512, call the target function.
And 513, closing the handle of the target process by using the called target function.
Step 514, detecting whether the target process is successfully closed, if not, executing step 515 of this embodiment.
Step 515, open the handle to which the target process belongs through the kernel mode.
Step 516, inserting an asynchronous procedure call function into the handle to which the target process belongs.
And 517, calling the target function in the asynchronous process call callback APC function.
And 518, closing the handle of the target process by using the called target function.
And step 519, acquiring the associated process according to the target closing indication information.
Step 520, generating a stop execution signaling.
Step 521, sending the execution stop signaling to the target process and the associated process.
Step 522, receiving a target restart instruction.
Step 523, detecting whether the process control symbol PID corresponding to the target process is located in a preset process restart prevention list according to the target restart instruction, if so, performing step 524, and if not, performing step 525.
And step 524, not restarting the target process.
And step 525, restarting the target process.
For details of the specific execution process from step 510 to step 525 shown in this embodiment, please refer to steps 206 to 221 shown in fig. 2, and the detailed process is not repeated in this embodiment.
To better understand the method shown in the embodiment of the present invention, the following description is made with reference to a specific application scenario, which is described with reference to fig. 6.
Fig. 6 is a schematic structural diagram of an embodiment of an electronic device provided in the present invention.
As shown in fig. 6, the electronic device includes an application layer, an interface layer, and a driver layer, and in order to adapt to different requirements of a user for closing a process in different application scenarios, the application layer of the electronic device shown in this embodiment may push different option menus to the user.
As shown in fig. 6, the menu of options can be computer acceleration 601, small rocket 602, game acceleration 603, application acceleration 604, and ultimate acceleration 605.
The description of the option menu in this embodiment is an optional example, and is not limited.
The menu options provided by the embodiment can quickly match the requirements of the user for closing the process.
The present embodiment does not limit the display mode of the menu option, for example, the menu option may be displayed in a floating window mode, displayed in a list mode, displayed in a response interface mode, and the like.
For example, if a user needs to accelerate a computer, only a process that affects the running speed of the computer needs to be closed, for example, a process that occupies large system resources, for example, a process that can release an enlarged memory, the user can click the computer acceleration 601, so that the electronic device automatically closes the process that occupies large system resources and the process that can release the enlarged memory.
For another example, if the user needs to clean the computer, the user can click the small rocket 602 only by closing the process occupying the larger storage space, or the useless process, or the process not used for a long time, so that the electronic device can automatically close the process occupying the larger storage space, or the useless process, or the process not used for a long time.
For another example, if the user needs to play the online game, the electronic device needs to have a good environment for running the game, and the process affecting the game running needs to be closed, such as the service process, the download process, the upgrade process, and the update process, that is, the game acceleration 603 can be clicked, so that the electronic device can close the process affecting the game running.
The interface layer of the electronic device shown in this embodiment is capable of receiving a target process closing instruction input by a user by clicking an option menu, and a detailed description of the target process closing instruction is shown in the above embodiment and is not described in detail;
the process type filter 611 of the interface layer of the electronic device may filter a type of a target process to which the target process belongs, as in the above embodiment, if the target process is screened by the process type filter 611 to be a non-service process, the PID of the non-service process is sent to the process queue 612, and a specific process is described in the above and is not described in detail.
In this application scenario, the process consumer 613 can determine whether there is a right to read the non-service process in the process queue 612, and if there is a right to read the non-service process in the process queue 612, the non-service process can be read.
The process closer 617 may close the read non-service process, and please refer to the foregoing embodiments for details of the closing process, which is not described in detail herein.
The service process consumer 614 can determine whether the service process in the service queue 614 is authorized to be read, and if the service process in the service queue 614 is authorized to be read, the service process can be read.
The service closer 616 shown in this embodiment can read the service process, and the service closer 616 can close the service process, and the specific closing process is shown in the foregoing embodiment and will not be described in detail.
The software manager 606 of the interface layer shown in this embodiment can manage software for closing a process, and the service enumerator 607 is configured to obtain services provided by all processes on the electronic device, so as to identify a target process type to which the target process belongs and determine an associated process.
The profile manager 608 may generate a profile indicating a class of target processes to which the target process belongs and determining an associated process, thereby facilitating the closing of the target process and the associated process.
The process enumerator 609 is configured to obtain all processes on the electronic device, and further identify a target process category to which the target process belongs and determine an associated process, where a specific process is shown in the foregoing embodiment and is not described in detail.
The window manager 610 is configured to push the target process and the management process to the application layer, and details of the specific process are not described herein.
In this application scenario, if the target process has a self-restart function, the driver layer of the electronic device can prevent the target process having the self-restart function from being restarted.
The application scene shows that the success rate of closing the target process is ensured and the target process is prevented from restarting, and the method shown in the embodiment ensures that the success rate of closing the target process can reach more than 97.5 percent.
The following describes a specific structure of the electronic device provided in this embodiment with reference to fig. 7:
fig. 7 is a schematic structural diagram of another embodiment of the electronic device provided in the present invention, and as shown in fig. 7, the electronic device includes:
a first receiving unit 701, configured to receive a target process closing instruction, where the target process closing instruction is used to instruct to close a target process;
a first determining unit 702, configured to determine, according to the target process closing instruction, a target process category to which the target process belongs;
specifically, the first determining unit 702 includes:
an obtaining module 7021, configured to obtain a target process control identifier PID corresponding to the target process;
a determining module 7022, configured to determine whether the target PID is located in a preset service process list, where the service process list includes at least one PID, and a process corresponding to any PID in the at least one PID is a service process;
a first determining module 7023, configured to determine that the target process type is a service process if it is determined that the target PID is located in the service process list;
a second determining module 7024, configured to determine that the target process type is a non-service process if it is determined that the target PID is not located in the service process list.
A determining unit 703, configured to determine whether the target process is a process for processing user data;
a fifth determining unit 704, configured to store the user data of the target process if it is determined that the target process is a process for processing user data;
an obtaining unit 705, configured to obtain target closing indication information corresponding to the target process type, where the target closing indication information is used to indicate a manner of closing the target process, and different target process types correspond to different target closing indication information;
a closing unit 706, configured to close the target process according to the target closing indication information.
Specifically, if the target process type is a non-service process, the closing unit 706 includes:
an opening module 7061, configured to open the target process according to the target closing indication information, so as to obtain a handle to which the target process belongs;
a calling module 7062, configured to call a target function for closing the target process, where the target function is a process end function TerminateProcess;
a closing module 7063, configured to close the handle to which the target process belongs by using the called target function.
Specifically, if the target process type is a service process, the closing unit 706 includes:
an obtaining module 7064, configured to obtain an association process according to the target closing indication information, where a service provided by the association process is associated with a service provided by the target process;
a generating module 7065, configured to generate an execution stop signaling, where the execution stop signaling is used to instruct a process to stop providing a service;
a sending module 7066, configured to send the execution stop signaling to the target process and the associated process, so that the associated process and the target process stop providing services.
The electronic device further includes:
a second receiving unit 707, configured to receive a target restart instruction, where the target restart instruction is used to instruct to restart the target process, and the target restart instruction is a non-user-triggered instruction;
a second determining unit 708, configured to detect, according to the target restart instruction, whether a process controller PID corresponding to the target process is located in a preset process restart prevention list, where the process restart prevention list includes the process controller PID;
a third determining unit 709, configured to not restart the target process if it is detected that the process controller PID corresponding to the target process is located in the process restart prevention list;
a fourth determining unit 710, configured to restart the target process if it is detected that the process controller PID corresponding to the target process is not located in the process restart prevention list.
For details, the specific process of the method for executing the closing process by the electronic device shown in this embodiment is shown in the foregoing embodiment, and details are not described here.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The present embodiment also provides a computer-readable storage medium storing one or more programs, where the one or more programs include instructions, and when the instructions are executed by an electronic device, the electronic device executes the method according to the foregoing embodiment, and the specific execution process is shown in the foregoing embodiment and will not be described in detail.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit 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 computer device (which may be 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. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (15)

1. A method for closing a process, comprising:
receiving a target process closing instruction, wherein the target process closing instruction is used for indicating to close a target process;
determining a target process type to which the target process belongs according to the target process closing instruction, wherein the target process type comprises a service process and a non-service process;
acquiring target closing indication information corresponding to the target process type, wherein the target closing indication information is used for indicating a mode of closing the target process, and different target process types correspond to different target closing indication information;
and closing the target process according to the target closing indication information.
2. The method of claim 1, wherein the determining a class of target process to which the target process belongs according to the target process shutdown instruction comprises:
acquiring a target process control symbol PID corresponding to the target process;
judging whether the target PID is located in a preset service process list, wherein the service process list comprises at least one PID, and a process corresponding to any PID in the at least one PID is a service process;
if the target PID is judged to be located in the service process list, determining the target process type as a service process;
and if the target PID is not positioned in the service process list, determining the type of the target process as a non-service process.
3. The method according to claim 1 or 2, wherein if the target process type is a non-service process, the closing the target process according to the target closing indication information comprises:
opening the target process according to the target closing indication information to acquire a handle to which the target process belongs;
calling a target function for closing the target process, wherein the target function is a process ending function TerminateProcess;
and closing the handle of the target process by using the called target function.
4. The method of claim 3, wherein after closing the handle to which the target process belongs using the called target function, the method further comprises:
detecting whether the target process is successfully closed;
if the target process is detected to be failed to close, opening a handle to which the target process belongs through a kernel mode;
inserting an asynchronous process call callback APC function into the handle to which the target process belongs;
calling the target function in the asynchronous process call callback APC function;
and closing the handle of the target process by using the called target function.
5. The method according to claim 1 or 2, wherein if the target process type is a service process, the closing the target process according to the target closing indication information comprises:
acquiring an associated process according to the target closing indication information, wherein the service provided by the associated process is associated with the service provided by the target process;
generating an execution stopping signaling, wherein the execution stopping signaling is used for indicating a process to stop providing services;
and sending the execution stopping signaling to the target process and the associated process so as to stop the associated process and the target process from providing services.
6. The method according to claim 1 or 2, wherein after the target process is closed according to the target closing indication information, the method further comprises:
receiving a target restart instruction, wherein the target restart instruction is used for indicating to restart the target process and is a non-user-triggered instruction;
detecting whether a process control symbol PID corresponding to the target process is located in a preset process restart prevention list or not according to the target restart instruction, wherein the process restart prevention list comprises the process control symbol PID;
if detecting that the process control symbol PID corresponding to the target process is located in the process restart prevention list, not restarting the target process;
and if detecting that the process control identifier PID corresponding to the target process is not located in the process restart prevention list, restarting the target process.
7. The method according to claim 1 or 2, wherein before the obtaining of the target shutdown indication information corresponding to the target process category, the method further comprises:
judging whether the target process is a process for processing user data or not;
and if the target process is judged to be the process for processing the user data, storing the user data of the target process.
8. An electronic device, comprising:
the system comprises a first receiving unit, a second receiving unit and a third receiving unit, wherein the first receiving unit is used for receiving a target process closing instruction which is used for indicating to close a target process;
a first determining unit, configured to determine, according to the target process closing instruction, a target process category to which the target process belongs, where the target process category includes a service process and a non-service process;
an obtaining unit, configured to obtain target closing indication information corresponding to the target process type, where the target closing indication information is used to indicate a manner of closing the target process, and different target process types correspond to different target closing indication information;
and the closing unit is used for closing the target process according to the target closing indication information.
9. The electronic device according to claim 8, wherein the first determination unit includes:
the acquisition module is used for acquiring a target process control identifier PID corresponding to the target process;
the judging module is used for judging whether the target PID is located in a preset service process list, the service process list comprises at least one PID, and a process corresponding to any PID in the at least one PID is a service process;
the first determining module is used for determining the type of the target process as the service process if the target PID is judged to be located in the service process list;
and the second determining module is used for determining that the target process type is a non-service process if the target PID is judged not to be located in the service process list.
10. The electronic device according to claim 8 or 9, wherein if the target process type is a non-service process, the shutdown unit includes:
the opening module is used for opening the target process according to the target closing indication information so as to obtain a handle to which the target process belongs;
the calling module is used for calling a target function for closing the target process, wherein the target function is a process ending function TerminateProcess;
and the closing module is used for closing the handle to which the target process belongs by using the called target function.
11. The electronic device according to claim 8 or 9, wherein if the target process type is a service process, the shutdown unit includes:
an obtaining module, configured to obtain an association process according to the target closing indication information, where a service provided by the association process is associated with a service provided by the target process;
a generating module, configured to generate an execution stop signaling, where the execution stop signaling is used to instruct a process to stop providing a service;
a sending module, configured to send the execution stop signaling to the target process and the associated process, so that the associated process and the target process stop providing services.
12. The electronic device according to claim 8 or 9, characterized in that the electronic device further comprises:
the second receiving unit is used for receiving a target restarting instruction, wherein the target restarting instruction is used for indicating to restart the target process, and the target restarting instruction is a non-user-triggered instruction;
a second determining unit, configured to detect, according to the target restart instruction, whether a process control identifier PID corresponding to the target process is located in a preset process restart prevention list, where the process restart prevention list includes the process control identifier PID;
a third determining unit, configured to not restart the target process if it is detected that the process control identifier PID corresponding to the target process is located in the process restart prevention list;
and the fourth determining unit is used for restarting the target process if the process control identifier PID corresponding to the target process is detected not to be located in the process restart prevention list.
13. The electronic device according to claim 8 or 9, characterized in that the electronic device further comprises:
a judging unit, configured to judge whether the target process is a process for processing user data;
and a fifth determining unit, configured to store the user data of the target process if it is determined that the target process is a process for processing user data.
14. An electronic device, comprising:
one or more processor units, a storage unit, a bus system, and one or more programs, the processor units and the storage unit being connected by the bus system;
wherein the one or more programs are stored in the storage unit, the one or more programs comprising instructions which, when executed by the electronic device, cause the electronic device to perform the method of any of claims 1-7.
15. A computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by an electronic device, cause the electronic device to perform the method of any of claims 1-7.
CN201710398808.3A 2017-05-31 2017-05-31 Method for closing process and electronic equipment Active CN108984212B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710398808.3A CN108984212B (en) 2017-05-31 2017-05-31 Method for closing process and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710398808.3A CN108984212B (en) 2017-05-31 2017-05-31 Method for closing process and electronic equipment

Publications (2)

Publication Number Publication Date
CN108984212A CN108984212A (en) 2018-12-11
CN108984212B true CN108984212B (en) 2021-06-25

Family

ID=64502355

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710398808.3A Active CN108984212B (en) 2017-05-31 2017-05-31 Method for closing process and electronic equipment

Country Status (1)

Country Link
CN (1) CN108984212B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111008079B (en) * 2019-12-10 2022-10-21 Oppo(重庆)智能科技有限公司 Process management method, device, storage medium and electronic equipment
CN114201221B (en) * 2020-09-02 2023-03-21 成都鼎桥通信技术有限公司 System closing method, equipment and storage medium based on dual systems

Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588323A (en) * 2004-09-23 2005-03-02 上海交通大学 Parallel program visuable debugging method
CN101593125A (en) * 2009-07-02 2009-12-02 上海交通大学 Use the method for monitoring thread to the execution flow of binary internal translator dynamic monitoring
CN102089752A (en) * 2008-07-10 2011-06-08 洛克泰克科技有限公司 Efficient parallel computation of dependency problems
CN102253863A (en) * 2011-06-15 2011-11-23 奇智软件(北京)有限公司 Method for closing processes
CN102541653A (en) * 2010-12-24 2012-07-04 新奥特(北京)视频技术有限公司 Method and system for scheduling multitasking thread pools
CN102622291A (en) * 2012-03-13 2012-08-01 苏州阔地网络科技有限公司 Method and system for monitoring processes
CN103106093A (en) * 2013-02-21 2013-05-15 北京奇虎科技有限公司 System operation quickening method and device
CN103809955A (en) * 2012-11-15 2014-05-21 腾讯科技(深圳)有限公司 Method and device for ending process
CN105446776A (en) * 2015-11-20 2016-03-30 北京金山安全软件有限公司 Application program closing method and device and electronic equipment
CN105868006A (en) * 2015-12-09 2016-08-17 乐视致新电子科技(天津)有限公司 Application operation control method and apparatus
CN105912096A (en) * 2016-04-28 2016-08-31 乐视控股(北京)有限公司 Terminal and course processing method
CN105975316A (en) * 2016-05-18 2016-09-28 广东欧珀移动通信有限公司 Process management method and device and equipment
CN106020958A (en) * 2016-05-17 2016-10-12 北京金山安全软件有限公司 Method and device for acquiring file occupation process and electronic equipment
CN106020976A (en) * 2016-05-13 2016-10-12 北京百度网讯科技有限公司 Method and apparatus for offloading out of memory processing process to user space
CN106096391A (en) * 2016-06-02 2016-11-09 北京金山安全软件有限公司 Process control method and user terminal
CN106293898A (en) * 2015-05-20 2017-01-04 张远虎 Multi-thread design method
CN106445696A (en) * 2016-09-12 2017-02-22 深圳铂睿智恒科技有限公司 Multiprocess interactive processing method and system
CN106528282A (en) * 2016-09-23 2017-03-22 依偎科技(南昌)有限公司 Method, device and terminal for closing process
CN106569930A (en) * 2016-11-10 2017-04-19 贵阳朗玛信息技术股份有限公司 Process monitoring processing method and device
CN106681827A (en) * 2016-05-11 2017-05-17 腾讯科技(深圳)有限公司 Method and device for detecting slow running of software and electronic equipment

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100568827C (en) * 2005-10-20 2009-12-09 英业达股份有限公司 A kind of network pressure testing method of multithreading
TW200916613A (en) * 2007-10-15 2009-04-16 Taiwan Lamination Ind Inc Packaging material with radio frequency identification tag and manufacturing method thereof
CN102314335A (en) * 2010-07-06 2012-01-11 上海晨兴希姆通电子科技有限公司 Multi-thread software concurrent design method
CN101895540B (en) * 2010-07-12 2015-08-12 中兴通讯股份有限公司 For the system and method that application service process is guarded
JP2013171121A (en) * 2012-02-20 2013-09-02 Ricoh Co Ltd Developing device, and image forming apparatus
JP6059116B2 (en) * 2013-08-30 2017-01-11 本田技研工業株式会社 Control method of differential pressure water electrolysis system
CN103500121A (en) * 2013-09-29 2014-01-08 深圳Tcl新技术有限公司 Process managing method and device
CN104199669B (en) * 2014-09-12 2017-12-15 北京奇虎科技有限公司 The method and device being managed to the process of application program
CN105700916B (en) * 2015-12-30 2019-06-14 Oppo广东移动通信有限公司 Application process starts method and application process starter
CN105930191B (en) * 2016-04-28 2019-01-04 网宿科技股份有限公司 The overloaded method and device of system service
CN106127031A (en) * 2016-06-23 2016-11-16 北京金山安全软件有限公司 Method and device for protecting process and electronic equipment
CN106648861B (en) * 2016-12-05 2020-07-14 阿里巴巴(中国)有限公司 Keep-alive method and device for background service process
CN106506565B (en) * 2017-01-04 2020-01-07 上海上讯信息技术股份有限公司 Remote command execution method and device

Patent Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588323A (en) * 2004-09-23 2005-03-02 上海交通大学 Parallel program visuable debugging method
CN102089752A (en) * 2008-07-10 2011-06-08 洛克泰克科技有限公司 Efficient parallel computation of dependency problems
CN101593125A (en) * 2009-07-02 2009-12-02 上海交通大学 Use the method for monitoring thread to the execution flow of binary internal translator dynamic monitoring
CN102541653A (en) * 2010-12-24 2012-07-04 新奥特(北京)视频技术有限公司 Method and system for scheduling multitasking thread pools
CN102253863A (en) * 2011-06-15 2011-11-23 奇智软件(北京)有限公司 Method for closing processes
CN102622291A (en) * 2012-03-13 2012-08-01 苏州阔地网络科技有限公司 Method and system for monitoring processes
CN103809955A (en) * 2012-11-15 2014-05-21 腾讯科技(深圳)有限公司 Method and device for ending process
CN103106093A (en) * 2013-02-21 2013-05-15 北京奇虎科技有限公司 System operation quickening method and device
CN106293898A (en) * 2015-05-20 2017-01-04 张远虎 Multi-thread design method
CN105446776A (en) * 2015-11-20 2016-03-30 北京金山安全软件有限公司 Application program closing method and device and electronic equipment
CN105868006A (en) * 2015-12-09 2016-08-17 乐视致新电子科技(天津)有限公司 Application operation control method and apparatus
CN105912096A (en) * 2016-04-28 2016-08-31 乐视控股(北京)有限公司 Terminal and course processing method
CN106681827A (en) * 2016-05-11 2017-05-17 腾讯科技(深圳)有限公司 Method and device for detecting slow running of software and electronic equipment
CN106020976A (en) * 2016-05-13 2016-10-12 北京百度网讯科技有限公司 Method and apparatus for offloading out of memory processing process to user space
CN106020958A (en) * 2016-05-17 2016-10-12 北京金山安全软件有限公司 Method and device for acquiring file occupation process and electronic equipment
CN105975316A (en) * 2016-05-18 2016-09-28 广东欧珀移动通信有限公司 Process management method and device and equipment
CN106096391A (en) * 2016-06-02 2016-11-09 北京金山安全软件有限公司 Process control method and user terminal
CN106445696A (en) * 2016-09-12 2017-02-22 深圳铂睿智恒科技有限公司 Multiprocess interactive processing method and system
CN106528282A (en) * 2016-09-23 2017-03-22 依偎科技(南昌)有限公司 Method, device and terminal for closing process
CN106569930A (en) * 2016-11-10 2017-04-19 贵阳朗玛信息技术股份有限公司 Process monitoring processing method and device

Also Published As

Publication number Publication date
CN108984212A (en) 2018-12-11

Similar Documents

Publication Publication Date Title
EP3182314B1 (en) Fingerprint identification method and apparatus
CN107222485B (en) Authorization method and related equipment
CN109726067B (en) Process monitoring method and client device
JP5972992B2 (en) Provisioning work environments on personal mobile devices
US10777205B2 (en) Voice control processing method and apparatus
US9584476B2 (en) Safety protection method, firewall, terminal device and computer-readable storage medium
US10165419B2 (en) Short message processing method and apparatus, and electronic device
EP2979177B1 (en) Method for controlling process of application and computer system
CN110442426B (en) Password resetting method, device and storage medium
CN107870666B (en) Terminal control method and terminal
CN106815518B (en) Application installation method and electronic equipment
EP3637251B1 (en) Method, device and terminal for executing hotpatch
CN106713608B (en) Application function state modification method and device and terminal
CN108090345B (en) Linux system external command execution method and device
WO2021022729A1 (en) Root permission assignment method and apparatus, storage medium, and terminal device
US10419608B2 (en) Call forwarding method, terminal, and portable electronic device
WO2018024138A1 (en) Method, device, terminal and computer storage medium for detecting malicious website
US10764038B2 (en) Method and apparatus for generating terminal key
EP3665569A1 (en) Hypervisor managing interrupts in a virtual environment having a plurality of virtual processors
CN108984212B (en) Method for closing process and electronic equipment
CN105278942B (en) Component management method and device
CN109145598B (en) Virus detection method and device for script file, terminal and storage medium
CN106484481B (en) Configuration method and device for multi-open application and terminal
KR102514841B1 (en) Method for selectively providing network capability to each application
CN106778297B (en) Application program running method and device and mobile 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