WO2023185684A1 - Procédé de destruction de processus pour application et dispositif électronique - Google Patents

Procédé de destruction de processus pour application et dispositif électronique Download PDF

Info

Publication number
WO2023185684A1
WO2023185684A1 PCT/CN2023/083751 CN2023083751W WO2023185684A1 WO 2023185684 A1 WO2023185684 A1 WO 2023185684A1 CN 2023083751 W CN2023083751 W CN 2023083751W WO 2023185684 A1 WO2023185684 A1 WO 2023185684A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
electronic device
type
occupied
component
Prior art date
Application number
PCT/CN2023/083751
Other languages
English (en)
Chinese (zh)
Inventor
季柯丞
杨文飞
常演
王绪
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023185684A1 publication Critical patent/WO2023185684A1/fr

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/566Dynamic detection, i.e. detection performed at run-time, e.g. emulation, suspicious activities
    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory

Definitions

  • the present application relates to the field of operating systems, and in particular, to an application process checking and killing method and an electronic device.
  • electronic devices can use process scanning and killing methods to clean up the memory occupied by processes.
  • electronic devices usually clean up the memory occupied by processes that are not commonly used or will not be used in the short term based on the user's usage habits.
  • the memory released after each process killing does not account for a high proportion of the entire machine's memory. Therefore, electronic devices need to frequently trigger process killing behaviors, which can easily cause system crashes.
  • This application provides a process checking and killing method for an application program and an electronic device, which can prevent electronic devices from frequently triggering process checking and killing behaviors, and is conducive to improving the smoothness and stability of the operation of electronic devices.
  • the first aspect provides a process checking and killing method for application programs.
  • the method includes: an electronic device runs one or more application APPs; the electronic device counts the first type of memory and the second type of memory occupied by each process started by one or more APPs.
  • Class memory the first class of memory includes one or more of the memory occupied by file pages, core library files, cached data, and user-mode anonymous pages; the second class of memory includes the memory occupied by streaming media and the kernel Occupying one or more items in the memory; when it is detected that the memory of the electronic device meets the preset conditions, the electronic device determines from the processes started by one or more APPs based on the first type of memory and the second type of memory occupied by each process.
  • Target process electronic device killing target process.
  • the electronic device when counting the memory occupied during the running of the process, the first type of memory and the second type of memory occupied during the running of the process are also counted, that is, the total occupation of the first type of memory and the second type of memory is counted. Then, when the electronic device performs process killing, it will determine the target process based on the total occupation of the first type of memory and the second type of memory of each candidate process. Moreover, after killing the target processes, the electronic device will reclaim the first type of memory and the second type of memory occupied by these target processes.
  • the first type of memory and the second type of memory recovered through this method account for a high proportion of the entire machine memory, it is conducive to maintaining the available memory of the electronic device at a higher value and preventing the electronic device from frequently triggering process checks. Killing behavior is conducive to improving the smoothness and stability of the operation of electronic devices.
  • the memory of the electronic device meeting the preset conditions includes: the remaining memory amount of the electronic device is less than or equal to the first threshold, and the blocking duration of the process in the electronic device due to untimely memory allocation is greater than or equal to the second threshold. Threshold, the total occupied amount of the second type of memory in the electronic device is greater than or equal to any of the third thresholds.
  • the electronic device may use a waterline triggering mechanism based on the amount of remaining memory to kill processes. Specifically, the electronic device can monitor the amount of remaining memory of the electronic device, where the remaining memory refers to available memory, which can include free memory in the system, as well as memory occupied by file pages, core library files, and cached data. when monitoring When the amount of remaining memory is less than or equal to the threshold 1, the electronic device starts the process killing process.
  • the electronic device may also use a triggering mechanism based on Pressure Stall Information (PSI) to kill the process.
  • PSI Pressure Stall Information
  • the electronic device can monitor the blocking time caused by untimely memory allocation when each process on the electronic device is running, that is, the time the process waits for memory allocation. When it is detected that the blocking time of the process is greater than or equal to the threshold 2, the process killing process is started.
  • PSI Pressure Stall Information
  • the electronic device can also use a waterline triggering mechanism based on the second type of memory usage to kill the process. Specifically, the electronic device can monitor the total occupied amount of the second type of memory in the electronic device. When it is detected that the total occupied amount of the second type of memory is greater than or equal to the threshold 3, the electronic device starts the process killing process.
  • this embodiment provides a method of monitoring the memory occupancy of an electronic device from the perspective of monitoring the second type of memory occupancy.
  • the second type of memory occupancy is usually large, which is one of the main reasons for the memory shortage of electronic devices. Therefore, the startup process killing process is determined from the perspective of monitoring the second type of memory occupancy. Being able to more accurately monitor the memory usage of electronic devices is more conducive to fundamentally solving the problems of high memory pressure and slow system operation caused by high second-type memory usage of electronic devices.
  • this embodiment realizes the function of recycling the second type of memory, it effectively reduces the occupation of the second type of memory, which helps the system's available memory to stay at a higher threshold for a long time, ensuring the stability and smoothness of the system operation. .
  • the first type of memory and the second type of memory occupied by the first process include the first type of memory and/or the second type of memory occupied by the second process called by the first process. Any one of the processes started for one or more APPs, and the second process is not called by other processes except the first process.
  • the electronic device determines the target process from the processes started by one or more APPs based on the first type of memory and the second type of memory occupied by each process, including: after the electronic device determines that the first process is the target process, it determines that the second process is also target process.
  • the electronic device can also determine other processes called by the target process based on the target process and the linkage relationships between different processes maintained by the electronic device, and determine These other processes are also processes that need to be killed, that is, they are also target processes. It can be understood that after the target process (for example, the first process) is checked and killed, if other processes (such as the second process) called by the target process are only called by the target process, then these other processes can also be checked and killed. Memory occupied by other processes can also be reclaimed. This will help further improve memory utilization and improve the system's operating speed. Of course, if other processes called by the target process are also called by other non-target processes, these other processes cannot be killed to ensure the normal operation of other non-target processes.
  • the method further includes: the electronic device determines whether the first component associated with the target process is a key component; where the key component is a component containing key information, and the key information Including information that will affect the stability of the system operation or the user experience when the target process is running; if it is determined that the first component is a critical component, the electronic device retains the information of the first component; if it is determined that the first component is not a critical component, The electronic device then clears the information of the first component.
  • some processes with higher priority or system level may be determined as target processes.
  • the key components in the target process are identified (that is, the information in the key components affects the stability of the system or the user experience) , and preserve key components in the target process. Later, when restarting the target process (or restarting the APP corresponding to the target process), you can directly use the retained key components to restore the target process to ensure that the system Operation stability or ensuring user experience.
  • the key information includes one or more of the information on the negative screen, the information on the magazine lock screen, the information displayed on the active screen, the information on the weather widget, and the reading progress information of the electronic document.
  • the method further includes: the electronic device calls the first component; when it is queried that the electronic device retains the first component After receiving the information of the component, the electronic device starts the third process; the electronic device establishes an association between the third process and the first component based on the retained information of the first component.
  • an electronic device including: a processor and a memory, the memory is coupled to the processor, the memory is used to store computer program code, the computer program code includes computer instructions, the processor The computer instructions are read from the memory, so that the electronic device performs the method described in the above aspect and any possible implementation manner therein.
  • a third aspect is to provide a device, which is included in an electronic device and has the function of realizing the behavior of the electronic device in any of the above aspects and possible implementation methods.
  • This function can be implemented by hardware, or it can be implemented by hardware executing corresponding software.
  • the hardware or software includes at least one module or unit corresponding to the above functions. For example, detection module or unit, statistical module or unit, determination module or unit, and killing module or unit, etc.
  • the fourth aspect is to provide a computer-readable storage medium.
  • the computer-readable storage medium includes computer instructions. When the computer instructions are run on an electronic device, the electronic device causes the electronic device to perform the above aspects and any possible implementation manner thereof. the method described.
  • a fifth aspect provides a chip system, including a processor.
  • the processor executes instructions, the processor executes the method described in the above aspects and any of the possible implementations.
  • a computer program product is provided.
  • the computer program product When the computer program product is run on a computer, it causes the computer to execute the method described in the above aspects and any of the possible implementations.
  • Figure 1 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application.
  • Figure 2A is a schematic diagram of the software structure of an electronic device provided by an embodiment of the present application.
  • Figure 2B is a schematic diagram of memory occupied by a process of an application provided by an embodiment of the present application
  • FIG. 3 is a schematic flowchart of an application process checking and killing method provided by an embodiment of the present application
  • Figure 4 is a schematic diagram of a process association provided by an embodiment of the present application.
  • Figure 5 is a schematic diagram of a statistical method for process memory usage provided by an embodiment of the present application.
  • Figure 6 is a schematic flowchart of another application process checking and killing method provided by an embodiment of the present application.
  • Figure 7 is a schematic flowchart of a method for recovering key components in an application provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a chip system provided by an embodiment of the present application.
  • first and second are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of indicated technical features. Therefore, features defined as “first” and “second” may explicitly or implicitly include one or more of these features. In the description of the embodiments of this application, unless otherwise specified, "plurality” means two or more.
  • Embodiments of the present application provide a process checking and killing method for an application (application, APP), which can be applied to an electronic device installed with one or more APPs.
  • the electronic device in the embodiment of the present application may be a mobile phone, a tablet computer, a personal computer (PC), a personal digital assistant (PDA), a smart watch, a netbook, a wearable electronic device, an enhanced Reality technology (augmented reality, AR) equipment, virtual reality (VR) equipment, vehicle-mounted equipment, smart screens, smart cars, smart speakers, robots, etc.
  • This application does not place special restrictions on the specific forms of this electronic equipment.
  • FIG. 1 shows a schematic structural diagram of an electronic device 100 .
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (SIM) card interface 195, etc.
  • a processor 110 an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display
  • the sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently.
  • the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc.
  • application processor application processor, AP
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller video codec
  • digital signal processor digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit
  • the controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.
  • the processor 110 may also be provided with a memory for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 110 . If the processor 110 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.
  • processor 110 may include one or more interfaces.
  • Interfaces may include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (pulse code modulation, PCM) interface, universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and /or universal serial bus (USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART universal asynchronous receiver and transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
  • the charging management module 140 may receive wireless charging input through the wireless charging coil of the electronic device 100 . While the charging management module 140 charges the battery 142, it can also provide power to the electronic device through the power management module 141.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, and the like.
  • the power management module 141 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters.
  • the power management module 141 may also be provided in the processor 110 .
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be reused as a diversity antenna for a wireless LAN. In other embodiments, antennas may be used in conjunction with tuning switches.
  • the mobile communication module 150 can provide solutions for wireless communication including 2G/3G/4G/5G applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.
  • the mobile communication module 150 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation.
  • at least part of the functional modules of the mobile communication module 150 may be disposed in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
  • a modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the application processor outputs sound signals through audio devices (not limited to speaker 170A, receiver 170B, etc.), or displays images or videos through display screen 194.
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110 and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellites.
  • WLAN wireless local area networks
  • System global navigation satellite system, GNSS
  • frequency modulation frequency modulation, FM
  • near field communication technology near field communication, NFC
  • infrared technology infrared, IR
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • the electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • the display screen 194 is used to display images, videos, etc.
  • Display 194 includes a display panel.
  • the display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • AMOLED organic light-emitting diode
  • FLED flexible light-emitting diode
  • Miniled MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc.
  • the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
  • the electronic device 100 can implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
  • the ISP is used to process the data fed back by the camera 193.
  • Camera 193 is used to capture still images or video.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
  • Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
  • MPEG moving picture experts group
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.
  • Internal memory 121 may be used to store computer executable program code including instruction.
  • the internal memory 121 may include a program storage area and a data storage area.
  • the stored program area can store an operating system, at least one application program required for a function (such as a sound playback function, an image playback function, etc.).
  • the storage data area may store data created during use of the electronic device 100 (such as audio data, phone book, etc.).
  • the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), etc.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
  • the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playback, recording, etc.
  • the buttons 190 include a power button, a volume button, etc.
  • Key 190 may be a mechanical key. It can also be a touch button.
  • the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
  • the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • the software system of the electronic device 100 may be the Hongmeng system, Android system, etc.
  • This embodiment of the present invention takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100 .
  • FIG. 2A is a software structure block diagram of the electronic device 100 according to the embodiment of the present invention.
  • the layered architecture divides the software into several layers, and each layer has clear roles and division of labor.
  • the layers communicate through software interfaces.
  • the Android system is divided into five layers. From top to bottom, they are the application layer (referred to as the application layer), the application framework layer (referred to as the framework layer), the Android runtime (Android runtime) and the system library. Hardware Abstraction Layer (HAL) and kernel layer.
  • the application layer can include a series of application packages. As shown in Figure 2A, the application package can include camera, gallery, calendar, calling, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
  • the framework layer provides application programming interface (API) and programming framework for applications in the application layer.
  • API application programming interface
  • the framework layer includes some predefined functions.
  • the framework layer can include activity manager, window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
  • the activity manager is responsible for the startup of all APP processes, the startup of the four major components of the APP (such as activity, service, broadcast receiver, content provider), the interface between APPs and within the APP. switching and the life cycle of various components.
  • a window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, capture the screen, etc.
  • Content providers are used to store and retrieve data and make this data accessible to applications. Said data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
  • the view system includes visual controls, such as controls that display text, controls that display pictures, etc.
  • a view system can be used to build applications.
  • the display interface can be composed of one or more views.
  • a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
  • the phone manager is used to provide communication functions of the electronic device 100 . For example, call status management (including connected, hung up, etc.).
  • the resource manager provides various resources to applications, such as localized strings, icons, pictures, layout files, video files, etc.
  • Notification manager enables The application can display notification information in the status bar, which can be used to convey notification-type messages, and can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also be notifications that appear in the status bar at the top of the system in the form of charts or scroll bar text, such as notifications for applications running in the background, or notifications that appear on the screen in the form of conversation windows. For example, text information is prompted in the status bar, a beep sounds, the electronic device vibrates, the indicator light flashes, etc.
  • the framework layer also includes a component cleaning module.
  • This component cleaning module is used to clean components according to certain strategies. For example, the least recently used (Least Recently Used, LRU) algorithm is used to filter components that are not frequently used recently, and the filtered components are cleaned up.
  • LRU least recently used
  • the component cleaning module is also used to clean up the components associated with the killed process after receiving information about the kernel-level killing process.
  • the component cleaning module is also used to determine whether the component associated with the process to be killed is a critical component to determine whether to clean the component.
  • key components refer to components that contain key information.
  • the key information includes information that will affect the stability of the system when the target process is running, or affect the user experience. This embodiment will be described in detail below, and will not be described here.
  • Android Runtime includes core libraries and virtual machines. Android runtime is responsible for the scheduling and management of the Android system.
  • the core library contains two parts: one is the functional functions that need to be called by the Java language, and the other is the core library of Android.
  • the application layer and framework layer run in virtual machines.
  • the virtual machine executes the java files of the application layer and framework layer into binary files.
  • the virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection and other functions.
  • System libraries can include multiple functional modules. For example: surface manager (surface manager), media libraries (Media Libraries), 3D graphics processing libraries (for example: OpenGL ES), 2D graphics engines (for example: SGL), etc.
  • the surface manager is used to manage the display subsystem and provides the integration of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, composition, and layer processing.
  • 2D Graphics Engine is a drawing engine for 2D drawing.
  • HAL used to abstract hardware. HAL hides the hardware interface details of a specific platform and provides a virtual hardware platform for the operating system, making it hardware-independent and portable on multiple platforms. In other words, all hardware-related operations required by the upper layer require calling HAL-related APIs, such as audio and video interfaces, GPS interfaces, call interfaces, Wi-Fi interfaces, and other interfaces.
  • HAL-related APIs such as audio and video interfaces, GPS interfaces, call interfaces, Wi-Fi interfaces, and other interfaces.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer includes the kernel allocator, memory statistics module and process killing module. Furthermore, the kernel layer also includes processes/threads, audio and video drivers, GPS drivers, Wi-Fi drivers, etc.
  • the kernel allocator can allocate memory to maintain the running status of each process on the electronic device.
  • the memory statistics module is used to count the various types of memory requested by each process. This memory statistics module is used to count power
  • the various types of memory occupied by each process in the sub-device can include memory occupied by files, memory occupied by user-mode anonymous pages, memory occupied by streaming media, and memory occupied by the kernel.
  • the memory occupied by the above file types may include the memory occupied by file pages, the memory occupied by core library files, and the memory occupied by cache data.
  • the file page may include code files of the application program and resource files (such as icons and pictures) when the application is running.
  • the code files of the application may include the application's configuration files (such as .dex files) and class files (such as .class files).
  • Core library files can include dynamic link libraries (such as .so files, a binary file) that the application needs to access when running.
  • Cached data may include data on file attributes stored in the electronic device for caching purposes.
  • the electronic device can use the mmap allocator (more specifically, the file page allocator) between the application layer and the framework layer in Figure 2A to allocate the memory occupied by the file page and the memory occupied by the cache data.
  • the electronic device can use the mmap allocator (more specifically, the core library file allocator) between the framework layer and the Android runtime layer in Figure 2A to allocate the memory occupied by the core library file.
  • the core library file allocator can be implemented by encapsulating the file page allocator. The embodiments of this application do not limit the specific implementation of the core library file allocator.
  • the memory occupied by the above-mentioned user-mode anonymous page can include dynamically allocated memory during the running of the application, and can include memory consumption caused by calling the API of the framework layer and the programming framework.
  • the APIs and programming frameworks of the called framework layer may include: APIs of high-level languages (such as Java language, JavaScript language, TypeScript language), system components of high-level languages, and system frameworks of system languages (such as C++ language, C language).
  • the electronic device can use the mmap allocator (more specifically the anonymous page allocator) between the framework layer and the Android runtime in Figure 2A to call high-level language APIs and high-level language system components for the application. Allocate the required memory.
  • the electronic device can use the C++ allocator between the framework layer and the system library in Figure 2A to allocate the memory required for the system framework that the application calls the system language (such as C++ language, C language).
  • the operating system can compress user-mode anonymous page data that is not used frequently.
  • the electronic device specifically triggers the behavior of compressing user-mode anonymous page data by the kernel layer, and stores the compressed data (also called Zram compressed data) in the memory space used to store Zram compressed data.
  • the kernel provides unified management and control of Zram compressed data. That is to say, in a specific implementation, the memory space for storing Zram compressed data can be allocated by the kernel allocator of the kernel layer in Figure 2A.
  • the memory occupied by the above streaming media includes the memory allocated by the dedicated streaming media memory allocator.
  • most applications such as video applications, music applications, game applications, social applications, etc.
  • This type of application often requires the computing power of different hardware in the SoC chip in the electronic device.
  • the operating system provides a dedicated streaming media memory allocator (such as Android's ION memory allocator).
  • the electronic device can use the streaming media memory allocator between the system library and HAL in Figure 2A to allocate memory for these applications to play streaming media. It should be noted that the memory occupied by streaming media can only be actively released by the applicant (that is, the application that applies for streaming media memory), and the kernel cannot uniformly control the memory occupied by streaming media.
  • the memory occupied by the above kernel can include: memory consumed by kernel operations such as Vmalloc and Slab, memory used for page table conversion (Page Table Entries, PTE), Kernel Stack that maintains application process information, and memory occupied by Zram compressed data. memory, and shared memory (such as Shmem) for efficient communication between multiple processes.
  • kernel operations such as Vmalloc and Slab
  • memory used for page table conversion Page Table Entries, PTE
  • Kernel Stack that maintains application process information
  • memory occupied by Zram compressed data occupied by Zram compressed data.
  • memory and shared memory (such as Shmem) for efficient communication between multiple processes.
  • the electronic device can use the kernel segmentation of the kernel layer in Figure 2A
  • the orchestrator allocates memory occupied by the kernel.
  • the above memory statistics module can obtain various types of memory occupied by each process from the mmap allocator, C++ allocator, streaming media memory allocator and kernel allocator.
  • the electronic device may also include multiple sub-statistical modules, for example, different sub-statistical modules are respectively provided at mmap allocator, C++ allocator, streaming media memory allocator, etc., for Count the memory allocated by each allocator for the process.
  • the sub-statistics module summarizes the statistical data to the memory statistics module of the kernel layer (also called the total statistics module).
  • the statistics module of the kernel layer analyzes the various types of memory of each process to determine the target of killing. process.
  • the electronic device only sets sub-statistics modules at, for example, mmap allocator, C++ allocator, streaming media memory allocator, kernel allocator, etc., and does not set a total statistics module. Then, the sub-statistical modules directly pass their respective statistical data to the process killing module, and the process killing module analyzes the various types of memory of each process to determine the target process for killing.
  • the embodiments of this application do not specifically limit this.
  • the above-mentioned process killing module is used to detect the triggering events of the process killing process, and select the process to be killed (i.e. the target process) based on the various types of memory occupied by each process detected by the above-mentioned memory statistics module. ), perform scanning and killing on the selected target process, etc.
  • the electronic device can use a waterline triggering mechanism based on the amount of remaining memory to kill the process. Specifically, the electronic device can monitor the remaining memory amount of the electronic device. When it is detected that the remaining memory amount is less than or equal to the threshold 1, the electronic device starts the process killing process.
  • the remaining memory refers to the available memory, which can include the free memory in the system and the memory occupied by files (including the memory occupied by file pages, core library files and cached data). It should be noted that since most file pages, core library files and cache data are backed up in the storage devices of electronic devices (such as Flash devices), during the memory recycling process, the electronic device can directly clean up the memory occupied by this part of the data.
  • the memory occupied by this part of the data is low-overhead recyclable memory. Therefore, the memory occupied by this part of the data belongs to available memory.
  • the electronic device can determine the target process for checking and killing by combining the usage frequency of the process and the amount of memory occupied by the process. For example, when an electronic device starts the killing process, the electronic device first uses the least recently used (Least Recently Used, LRU) algorithm to filter out processes that are not frequently used as candidate processes, and then selects processes based on the memory usage of each candidate process. Select the candidate process that occupies a large amount of memory as the target process, and then kill the target process to release the memory occupied by the target process.
  • LRU least recently used
  • the electronic device can use the top command, the ps command, and other commands, or a combination of any of these commands to obtain the memory usage of each candidate process.
  • the existing technology only counts the memory occupied by the process in the user mode (recorded as the first type of memory), but does not count the memory occupied by the process in the kernel state (recorded as the first type of memory). is the second type of memory).
  • the first type of memory can include memory occupied by files and memory occupied by user-mode anonymous pages.
  • the memory occupied during the running of the process that is not counted in the prior art is recorded as the second type of memory.
  • the second type of memory can include memory occupied by streaming media and memory occupied by the kernel.
  • the first type of memory can be a process using a memory allocator (such as the mmap allocator), or memory allocated through the framework layer using a memory allocator (such as the C++ allocator).
  • the second type of memory can be memory allocated by the process through the system library using a dedicated streaming allocator, or through the kernel allocator at the kernel level.
  • the electronic device since the prior art only counts the first type of memory occupied during the running process of the process, when the electronic device determines the target process based on the occupation of the first type of memory of each candidate process, the electronic device selects the third type of memory. One type of candidate process that occupies a large amount of memory is the target process. Then, after killing the target process, the electronic device will reclaim the first type of memory occupied by the target process. It is understandable that in actual usage scenarios, the proportion of the first type of memory occupied by the process in the whole machine memory may not be high, so the benefit of killing the target process determined based on the first type of memory usage is small. If it is not conducive to maintaining the available memory of the electronic device at a high value, the electronic device may need to frequently trigger process killing behaviors, which may easily cause the system to crash.
  • an embodiment of the present application provides a method.
  • the first type of memory and the second type of memory occupied during the running of the process are also counted. That is, the first type of memory and the second type of memory are counted. The total amount of memory occupied by the second type of memory.
  • the electronic device performs process killing, it will determine the target process based on the total occupation of the first type of memory and the second type of memory of each candidate process. Moreover, after killing the target processes, the electronic device will reclaim the first type of memory and the second type of memory occupied by these target processes.
  • the first type of memory and the second type of memory recovered through this method account for a high proportion of the entire machine memory, it is conducive to maintaining the available memory of the electronic device at a higher value and preventing the electronic device from frequently triggering process checks. Killing behavior is conducive to improving the smoothness and stability of the operation of electronic devices.
  • FIG. 3 it is a schematic flow chart of a method for checking and killing application processes provided by the embodiment of the present application.
  • the process includes:
  • the electronic device runs one or more APPs.
  • APP1 can start multiple processes, such as a foreground process and a background process.
  • the foreground process can be used to present the user interface of APP1 and interact with the user.
  • APP1 first starts a foreground process, which can launch one or more background processes.
  • the background processes do not need to interact with the user.
  • the one or more background processes may include a background service process of APP1 or a system service process of the electronic device.
  • this one or more background processes can also start other background processes again.
  • an APP may start multiple processes, and these processes will apply for corresponding memory and other system resources in the electronic device during operation.
  • an APP may only start one process, or the APP may only start one process in some scenarios and multiple processes in other scenarios.
  • the electronic device counts the first type of memory and the second type of memory occupied by each process started by the one or more APPs.
  • the electronic device can instrument each memory allocator and count the types of memory requested by each process from each memory allocator, including the first type of memory and the second type of memory.
  • instrumentation refers to inserting some probes (also called “probes") into the program on the basis of ensuring the original logical integrity of each memory allocator.
  • probes also called "probes”
  • They are essentially code segments for information collection, which can be assignments. statement or function call to collect coverage information), and through the execution of the probe, the classified memory requested by each process through each memory allocator is collected.
  • the process occupies the second Class memory can include memory allocated by streaming allocators (such as the ION memory allocator) and memory allocated by kernel allocators.
  • the memory allocated by the kernel allocator includes the memory consumption of kernel operations such as Vmalloc and Slab, PTE (Page Table Entries) memory for page table conversion, Kernel Stack for maintaining application process information, and Zram compressed data storage. memory, and shared memory (such as Shmem) for efficient communication between multiple processes.
  • monitoring can be implemented at the EGL Track interface of the streaming media allocator (such as the ION memory allocator) to count the memory allocated by the streaming media allocator to the process.
  • Monitoring can be implemented by instrumenting the kernel zsalloc memory allocation interface to count the memory occupied by Zram compressed data.
  • Monitoring can be implemented by instrumenting the kernel Shmem memory allocation interface to count the shared memory requested by the process.
  • Other allocators in the kernel such as PTE, Kernel Stack, Slab, Slab Large, Vmalloc, etc., also provide corresponding memory statistics interfaces. They can be installed at the corresponding statistics interfaces to implement monitoring to count various types of memory requested by the process. , I won’t go into details here.
  • process 1 may start another or multiple processes (such as process 2).
  • process 2 may also apply for memory, such as first-class memory, and/or second-class memory).
  • process 2 applies for the first type of memory
  • the first type of memory applied by process 2 may be counted as the memory occupied by process 2, and will not be counted as the memory occupied by process 1.
  • the memory occupied by process 2 will not be reclaimed when killing process 1. It is understandable that the memory requested by process 2 is to support the operation of process 1.
  • process 1 If process 1 is killed, the memory requested by process 2 will have no effect, which causes a waste of memory. Or, if process 2 applies for the second type of memory, the existing technology cannot count the second type of memory applied by process 2, which will still cause the problem of low profits after the process is killed.
  • the electronic device when counting the memory of each process, the electronic device will calculate the memory applied for by each process based on the linkage relationship between the processes (also known as the pull-up relationship, calling relationship, etc.) Assigned to the source process.
  • the linkage relationship between the processes also known as the pull-up relationship, calling relationship, etc.
  • the subsequent electronic device selects the target process to be checked and killed, it can accurately determine the target process that occupies the largest amount of the first type of memory and the second type of memory of the system, and can recover more when checking and killing the target process.
  • the first type of memory and the second type of memory thereby increasing the benefits of process killing and improving the smoothness and stability of the system.
  • the linkage relationship between processes requires inter-process communication services in the system (such as Binder, Socket, and Signal)
  • electronic devices can collect statistics on each process by monitoring the inter-process communication services.
  • Linkage relationship In some examples, the electronic device can maintain a linked list of linkage relationships between processes ( Figure 4 shows an example of a linked list of linkage relationships between processes) to collect statistics on linkage relationships between different processes.
  • the electronic equipment can be counted using methods such as red-black trees or hash tables. Then, based on the linkage relationship of each process, the memory requested by each process is finally counted to the source process.
  • the source process refers to the first caller. For example, process 1 calls process 2, and process 2 calls process 3. Then, the source process of process 2 and process 3 is process 1.
  • APP1 is taken as an example to illustrate the linkage relationship between processes of APP1 and the method of counting memory.
  • the main process of APP1 (such as the foreground process) will be started.
  • the main process of APP1 may call the background services of the framework layer, and/or the system library and runtime layer (each service will correspond to a process).
  • the main process calls audio and video services, and the audio and video services pass the graphical allocator (Graghic Allocator). ) applies for streaming media memory (such as ION memory).
  • the electronic device establishes the main process of APP1 (or APP1)
  • the linkage relationship with the audio and video service counts the memory requested by the audio and video service to the main process of APP1 (or APP1).
  • the image rendering service applies for streaming media memory (such as ION memory) through the graphics allocator (Graghic Allocator).
  • the electronic device establishes a linkage relationship between the main process of APP1 (or APP1) and the image rendering service, and counts the memory requested by the image rendering service to the main process of APP1 (or APP1).
  • the APP1 main process may also call the kernel layer's memory management service to compress the user-mode anonymous page data and apply for memory to store the compressed data (for example, to store Zram compression data memory). Then, the electronic device can count the memory applied for this time by the memory management service to the APP1 main process (or APP1).
  • the APP1 main process may also call the inter-process communication (such as Binder) module of the kernel layer to apply for shared memory (such as Ashmem). Then, the electronic device counts the shared memory applied for this time by the inter-process communication module to the main process of APP1 (or APP1).
  • the inter-process communication such as Binder
  • shared memory such as Ashmem
  • the main process of APP1 calls the memory business module of the kernel layer to apply for other kernel memory (such as page table PT, Stack, Slab, Vmalloc). Then, the electronic device counts the various kernel memories applied for this time by the memory business module to the main process of APP1 (or APP1).
  • kernel memory such as page table PT, Stack, Slab, Vmalloc
  • the electronic device determines the target process from the processes started by the one or more APPs.
  • the memory of the electronic device meets the preset conditions, which is the trigger condition for the electronic device to execute process killing.
  • the memory of the electronic device that meets the preset conditions includes: the remaining memory amount of the electronic device is less than or equal to the threshold 1; or the blocking duration of the process in the electronic device due to untimely memory allocation is greater than or equal to the threshold 2; or the electronic device The total occupancy of the second type of memory is greater than or equal to any of threshold 3.
  • the electronic device may use a waterline triggering mechanism based on the amount of remaining memory to kill processes. Specifically, the electronic device can monitor the amount of remaining memory of the electronic device, where the remaining memory refers to available memory, which can include free memory in the system, as well as memory occupied by file pages, core library files, and cached data. When it is detected that the remaining memory amount is less than or equal to the threshold 1, the electronic device starts the process killing process.
  • the electronic device can determine the target process for checking and killing by combining the usage frequency of the process and the amount of memory occupied by the process. For example, when the electronic device starts the killing process, the electronic device first uses, for example, the LRU algorithm to filter out processes that are not frequently used as candidate processes, and then selects the candidate process with a larger memory footprint based on the memory usage of each candidate process. As the target process, then kill the target process to release the memory occupied by the target process.
  • each candidate process includes the first type of memory usage and the second type of memory usage. That is to say, the electronic device is based on the first type of memory and the second type of memory occupied by each candidate process. The total usage is used to determine the target process.
  • the memory usage of each candidate process may also include the memory requested by other processes called by each candidate process (also including the first type of memory and Type II memory).
  • the electronic device can also be configured according to the target process and the electronic device maintenance Use the linkage relationship between different processes protected to determine other processes called by the target process, and determine that these other processes are also processes that need to be killed, that is, they are also target processes. It is understandable that after the target process is checked and killed, if other processes called by the target process are only called by the target process, then these other processes can also be checked and killed, and the memory occupied by these other processes can also be recycled. This will help further improve memory utilization and improve the system's operating speed. Of course, if other processes called by the target process are also called by other non-target processes, these other processes cannot be killed to ensure the normal operation of other non-target processes.
  • the main process of APP1 is determined to be the target process, in addition to killing the main process of APP1 and reclaiming the memory requested by the main process of APP1, if the audio and video services and image rendering services called by APP1 have not been If the process calls of other applications, it can also be determined that the audio and video service and image rendering service are also target processes. Then, the electronic device also kills the audio and video services and image rendering services, and recovers the streaming media memory (such as ION memory) occupied by the audio and video services and image rendering services. It is understandable that streaming media usually takes up a large amount of memory. Then, the audio and video killing service and image rendering service will recycle this part of the streaming media memory, which is more conducive to increasing the benefits of process killing and maintaining the stability and smoothness of system operation.
  • the audio and video killing service and image rendering service will recycle this part of the streaming media memory, which is more conducive to increasing the benefits of process killing and maintaining the stability and smoothness of system operation.
  • the electronic device may also use a triggering mechanism based on Pressure Stall Information (PSI) to kill the process.
  • PSI Pressure Stall Information
  • the electronic device can monitor the blocking time caused by untimely memory allocation when each process on the electronic device is running, that is, the time the process waits for memory allocation. When it is detected that the blocking time of the process is greater than or equal to the threshold 2, the process killing process is started.
  • PSI Pressure Stall Information
  • the electronic device can also use a waterline triggering mechanism based on the second type of memory usage to kill the process. Specifically, the electronic device can monitor the total occupied amount of the second type of memory in the electronic device. When it is detected that the total occupied amount of the second type of memory is greater than or equal to the threshold 3, the electronic device starts the process killing process. It should be noted that the difference between this embodiment and the above-mentioned embodiment is that the triggering conditions for initiating the process checking and killing process are different. The specific method of executing process checking and killing by the electronic device is the same as that in the above-mentioned embodiment, and will not be described again here.
  • this embodiment provides a method for monitoring the memory usage of an electronic device from the perspective of monitoring the second type of memory usage.
  • the second type of memory occupancy is usually large, which is one of the main reasons for the memory shortage of electronic devices. Therefore, the startup process killing process is determined from the perspective of monitoring the second type of memory occupancy. Being able to more accurately monitor the memory usage of electronic devices is more conducive to fundamentally solving the problems of high memory pressure and slow system operation caused by high second-type memory usage of electronic devices.
  • this embodiment realizes the function of recycling the second type of memory, it effectively reduces the occupation of the second type of memory, which helps the system's available memory to stay at a higher threshold for a long time, ensuring the stability and smoothness of the system operation. .
  • the electronic device may simultaneously adopt a watermark triggering mechanism based on the amount of remaining memory and a watermark triggering mechanism based on the second type of memory usage.
  • the process of killing the process is started.
  • the process checking and killing method here may adopt existing technology, or may adopt the process checking and killing method provided by the embodiments of this application.
  • the process of killing the process is also started.
  • the electronic device since the electronic device adopts a trigger mechanism based on the second-type memory usage waterline, and the electronic device recycles more second-class memory when executing the scanning and killing process of the process, it is conducive to the remaining memory of the electronic device. Inside If the inventory is at a high threshold for a long time, it also reduces the frequency of process killing triggered by electronic devices using a trigger mechanism based on the remaining memory waterline of the electronic device, and reduces the system consumption of electronic devices executing the process killing process. Resources, such as CPU resources, memory resources, etc.
  • the electronic device scans and kills the determined target process, and reclaims the first type of memory and the second type of memory occupied by the target process. More specifically, after the kernel layer of the electronic device kills the target process, it notifies the upper layer that the target process has been killed. After receiving the notification information, the framework layer further cleans up the components associated with the target process and further releases the memory occupied by the components.
  • the first type of memory and the second type of memory recovered through this method account for a high proportion of the entire machine's memory, it is conducive to maintaining the available memory of the electronic device at a higher value, which is conducive to improving the operation of the electronic device. fluency and stability.
  • the process checking and killing method provided by the embodiment of the present application has greater benefits, it is conducive to maintaining the available memory of the electronic device at a higher value, reducing the frequency of the electronic device executing the process checking and killing process, and reducing the cost of the process.
  • the system resources consumed by electronic devices when executing process killing processes such as CPU resources, memory resources, etc.
  • some processes with higher priority or system level may be determined as the target process.
  • the key components in the target process are identified (that is, the information in the key components affects the stability of the system or the user experience) , and preserve key components in the target process. Later, when the target process is restarted (or the APP corresponding to the target process is restarted), the retained key components can be directly used to restore the target process to ensure the stability of the system operation or the user experience.
  • FIG. 6 it is a schematic flowchart of another method for detecting and killing an application process provided by an embodiment of the present application.
  • the process includes:
  • step S601. Monitor whether the occupancy of the second type of memory of the electronic device is greater than or equal to threshold 3. If it is detected that the occupancy of the second type of memory of the electronic device is greater than or equal to threshold 3, step S602 is executed.
  • the occupancy of the second type of memory of the electronic device is greater than or equal to the threshold 3 as the trigger condition for the electronic device to execute process killing.
  • the electronic device may also adopt Other triggering conditions will not be described here.
  • the kernel layer (for example, more specifically, the memory statistics module of the kernel layer) monitors whether the occupation amount of the second type of memory of the electronic device is greater than or equal to the threshold 3.
  • the memory usage of each process includes the total usage of the first type of memory and the second type of memory.
  • the electronic device may also start to count the memory usage of each process in real time while executing step S601 or before executing step S601.
  • the kernel layer (for example, more specifically, the memory statistics module of the kernel layer) is used to count the memory usage of each process.
  • step S302 For other contents of this step, please refer to the relevant contents in the above-mentioned step S302, which will not be described again here.
  • the electronic device may determine the target process for scanning and killing by combining the usage frequency of the process and the amount of memory occupied by the process.
  • the kernel layer for example, more specifically, the inner layer of the kernel layer The memory statistics module
  • the kernel layer is used to select the target process based on the statistical memory usage of each process.
  • the kernel layer (for example, more specifically, the process killing module of the kernel layer) is used to kill the target process.
  • step S605. Determine whether the component associated with the target process is a critical component. If it is a key component, perform step S606. If it is not a critical component, perform step S607.
  • key components refer to components that contain key information.
  • the key information includes information that will affect the stability of the system when the target process is running, or affect the user experience. It is understandable that some temporary data while the target process is running will be stored in the component. If you clean up the components associated with the target process directly after killing the target process, this part of the temporary data will be lost. If the temporary data contains critical information, it will inevitably affect the restart of the target process, the stability of the target process, or the user experience.
  • key components may include information about some permanent functions when the system is running, such as information about the electronic device's negative screen, magazine lock screen information, information displayed on the active screen, weather widget information, etc.
  • the key component may include the reading progress information of the electronic document, and the reading progress information of the electronic document will affect the user's experience when reading the electronic document.
  • the electronic device cleans the components associated with the target process, it will first determine whether the components associated with the target process contain key components. For key components, retain the information of the key components, or retain the key information in the key components, that is, perform step S606. For non-critical components, clean up non-associated components, that is, perform step S607.
  • the kernel layer for example, the process killing module of the kernel layer kills the target process
  • the framework layer (for example, more specifically, the component cleaning module of the framework layer) determines whether the components associated with the target process are critical components, and further retains the critical components and cleans the non-critical components.
  • the electronic device can also modify the life cycle of key components to retain information about key components.
  • the information of key components associated with the target process is retained, so that the electronic device can subsequently restore the information of key components, maintain the stability of system operation, and provide user experience.
  • FIG. 7 it is a schematic flowchart of a method for restoring a target process provided by an embodiment of the present application.
  • the process includes:
  • the main process of the APP can call components in the framework layer to implement corresponding functions.
  • the APP does not exit, and the APP's main process (or other processes, such as other processes called by the main process) needs to call the components in the framework layer again to implement the corresponding functions.
  • step S702 Determine whether the called component is a recoverable key component. If yes, execute step S703; if not, execute step S706.
  • the main process of the APP can query the component records to determine whether the component to be called is a recoverable key component. That is, whether the electronic device saves information about the component to be called. If it is determined that the component to be called is a recoverable key component, the component can be recovered using the information of the key component retained by the electronic device, that is, steps S703 to S705 are performed. If it is determined that the component to be called is not a recoverable critical component, the system's native process is adopted, that is, steps S706 to S709 are executed.
  • the electronic device Since the component needs to rely on a process to run, the electronic device creates a new process for running the component.
  • step S706 Determine whether a component needs to be created. If not, execute step S707. If so, execute step S708,
  • step S707 For example, before calling, query whether the electronic device runs the component. If the electronic device does not run the component, the component needs to be created, that is, step S707 is performed. If the electronic device runs the component, there is no need to create the component again, and step S708 is executed.
  • step S707. Determine whether a new process needs to be created. If so, execute step S703.
  • step S709. Determine whether there is an existing process that can take over the created component. If yes, execute step S704. If not, execute step S703.
  • the chip system includes at least one processor 1101 and at least one interface circuit 1102 .
  • the processor 1101 and the interface circuit 1102 may be interconnected by wires.
  • interface circuitry 1102 may be used to receive signals from other devices, such as the memory of electronic device 100 .
  • interface circuit 1102 may be used to send signals to other devices (eg, processor 1101).
  • the interface circuit 1102 can read instructions stored in the memory and send the instructions to the processor 1101.
  • the electronic device can be caused to perform various steps performed by the electronic device 100 (such as a mobile phone) in the above embodiments.
  • the chip system may also include other discrete devices, which are not specifically limited in the embodiments of this application.
  • An embodiment of the present application also provides a device, which is included in an electronic device and has the function of realizing the behavior of the electronic device in any of the methods in the above embodiments.
  • This function can be implemented by hardware, or it can be implemented by hardware executing corresponding software.
  • the hardware or software includes at least one module or unit corresponding to the above functions. For example, detection module or unit, statistical module or unit, determination module or unit, and killing module or unit, etc.
  • Embodiments of the present application also provide a computer storage medium that includes computer instructions.
  • the computer instructions When the computer instructions are run on an electronic device, the electronic device causes the electronic device to perform any of the methods in the above embodiments.
  • Embodiments of the present application also provide a computer program product.
  • the computer program product When the computer program product is run on a computer, it causes the computer to perform any of the methods in the above embodiments.
  • the above-mentioned electronic devices include hardware structures and/or software modules corresponding to each function.
  • Persons skilled in the art should easily realize that, in conjunction with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or by computer software driving the hardware? Depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementations should not be considered to be beyond the scope of the embodiments of the present invention.
  • Embodiments of the present application can divide the above-mentioned electronic equipment into functional modules according to the above-mentioned method examples.
  • each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module.
  • the above integrated modules can be implemented in the form of hardware or software function modules. It should be noted that the division of modules in the embodiment of the present invention is schematic and is only a logical function division. In actual implementation, there may be other division methods.
  • Each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above integrated units can be implemented in the form of hardware or software functional units.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.
  • the technical solutions of the embodiments of the present application are essentially or contribute to the existing technology, or all or part of the technical solution can be embodied in the form of a software product.
  • the computer software product is stored in a storage device.
  • the medium includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods described in various embodiments of this application.
  • the aforementioned storage media include: flash memory, mobile hard disk, read-only memory, random access memory, magnetic disk or optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Virology (AREA)
  • Stored Programmes (AREA)

Abstract

La présente invention concerne un procédé de destruction de processus pour une application et un dispositif électronique, se rapportant au domaine des systèmes d'exploitation et étant capables d'empêcher un dispositif électronique de déclencher fréquemment une opération de destruction de processus et de faciliter l'amélioration de la fluidité et de la stabilité de fonctionnement d'un dispositif électronique. Le procédé comprend les étapes suivantes : un dispositif électronique calcule des statistiques sur une mémoire de premier type et une mémoire de second type occupées par des processus d'exécution, la mémoire de premier type comprenant une ou plusieurs éléments parmi une mémoire occupée par une page de fichier, une mémoire occupée par un fichier de bibliothèque de cœur, une mémoire occupée de données de cache et une mémoire occupée par une page anonyme en mode utilisateur et la mémoire de second type comprenant une ou plusieurs mémoires occupées par un support de diffusion en continu et une mémoire occupée par un noyau ; et s'il est détecté qu'une mémoire du dispositif électronique satisfait une condition prédéfinie, déterminer un processus cible parmi les processus d'exécution selon la mémoire de premier type et la mémoire de second type occupées par les processus et détruire le processus cible.
PCT/CN2023/083751 2022-04-01 2023-03-24 Procédé de destruction de processus pour application et dispositif électronique WO2023185684A1 (fr)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210339419.4 2022-04-01
CN202210339419.4A CN116933254A (zh) 2022-04-01 2022-04-01 一种应用程序的进程查杀方法及电子设备

Publications (1)

Publication Number Publication Date
WO2023185684A1 true WO2023185684A1 (fr) 2023-10-05

Family

ID=88199335

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/083751 WO2023185684A1 (fr) 2022-04-01 2023-03-24 Procédé de destruction de processus pour application et dispositif électronique

Country Status (2)

Country Link
CN (1) CN116933254A (fr)
WO (1) WO2023185684A1 (fr)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866548A (zh) * 2015-05-08 2015-08-26 深圳市金立通信设备有限公司 一种内存管理方法
US20160378587A1 (en) * 2015-06-25 2016-12-29 Emc Corporation Detecting unresponsiveness of a process
CN109857555A (zh) * 2019-01-15 2019-06-07 Oppo广东移动通信有限公司 内存回收方法及装置、存储介质和电子设备
CN111611020A (zh) * 2020-04-14 2020-09-01 上海卓易科技股份有限公司 一种应用程序的应用进程查杀方法及设备
CN111831441A (zh) * 2020-07-01 2020-10-27 Oppo广东移动通信有限公司 内存回收方法、装置、存储介质及电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866548A (zh) * 2015-05-08 2015-08-26 深圳市金立通信设备有限公司 一种内存管理方法
US20160378587A1 (en) * 2015-06-25 2016-12-29 Emc Corporation Detecting unresponsiveness of a process
CN109857555A (zh) * 2019-01-15 2019-06-07 Oppo广东移动通信有限公司 内存回收方法及装置、存储介质和电子设备
CN111611020A (zh) * 2020-04-14 2020-09-01 上海卓易科技股份有限公司 一种应用程序的应用进程查杀方法及设备
CN111831441A (zh) * 2020-07-01 2020-10-27 Oppo广东移动通信有限公司 内存回收方法、装置、存储介质及电子设备

Also Published As

Publication number Publication date
CN116933254A (zh) 2023-10-24

Similar Documents

Publication Publication Date Title
CN111966492B (zh) 内存回收方法、装置、电子设备及计算机可读存储介质
WO2022257748A1 (fr) Procédé de gestion de mémoire virtuelle et dispositif électronique
WO2023202429A1 (fr) Procédé de recyclage de déchets et dispositif électronique
WO2021093626A1 (fr) Procédé de gestion de mémoire et dispositif électronique
CN115292199B (zh) 一种显存泄露的处理方法及相关装置
US20230385112A1 (en) Memory Management Method, Electronic Device, and Computer-Readable Storage Medium
WO2021185352A1 (fr) Procédé de mise à niveau de version et appareil associé
WO2019128542A1 (fr) Procédé de traitement d'application, dispositif électronique et support d'informations lisible par ordinateur
CN114185494A (zh) 内存匿名页的处理方法、电子设备及可读存储介质
CN115016631B (zh) 进程调度方法和终端设备
WO2021218370A1 (fr) Procédé de gestion de mémoire et dispositif terminal
EP4095723A1 (fr) Procédé de réutilisation d'autorisation, procédé d'accès à une ressource basé sur une réutilisation d'autorisation et dispositif associé
CN111381996B (zh) 内存异常处理方法及装置
CN116126744B (zh) 一种内存回收方法、装置及终端设备
WO2023185684A1 (fr) Procédé de destruction de processus pour application et dispositif électronique
CN114253737B (zh) 电子设备及其内存回收方法、介质
CN117130824A (zh) 一种处理异常的方法、电子设备及存储介质
CN114461589B (zh) 读取压缩文件的方法、文件系统及电子设备
CN112783418B (zh) 一种存储应用程序数据的方法及移动终端
WO2020147859A1 (fr) Dégonflement décentralisé de verrous dilatés
CN115794413B (zh) 一种内存处理方法及相关装置
WO2023202406A1 (fr) Procédé d'affichage et dispositif électronique
WO2023231900A1 (fr) Procédé de gestion de mémoire et appareil associé
CN117130947A (zh) 一种内存管理方法及电子设备
CN115981573A (zh) 数据管理方法、电子设备及计算机可读写存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23778052

Country of ref document: EP

Kind code of ref document: A1