CN115904686A - Memory management method, electronic device, computer storage medium, and program product - Google Patents

Memory management method, electronic device, computer storage medium, and program product Download PDF

Info

Publication number
CN115904686A
CN115904686A CN202111161913.8A CN202111161913A CN115904686A CN 115904686 A CN115904686 A CN 115904686A CN 202111161913 A CN202111161913 A CN 202111161913A CN 115904686 A CN115904686 A CN 115904686A
Authority
CN
China
Prior art keywords
memory
application
electronic device
application program
priority
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.)
Pending
Application number
CN202111161913.8A
Other languages
Chinese (zh)
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202111161913.8A priority Critical patent/CN115904686A/en
Priority to PCT/CN2022/112034 priority patent/WO2023051056A1/en
Publication of CN115904686A publication Critical patent/CN115904686A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • 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/48Program initiating; Program switching, e.g. by interrupt
    • 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]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

Embodiments of the present disclosure provide a memory management method, an electronic device, a computer storage medium, and a program product. The method comprises the following steps: the electronic equipment determines a first available memory; if the first available memory is lower than a first set value, determining the killed priority of each of the plurality of application programs at least based on the occupied memory of each of the plurality of application programs in the background state; and killing at least one of the plurality of applications based on the killed priority of each of the plurality of applications. In this way, the electronic device of the embodiment of the disclosure can kill the at least one application program in the background state in time based on at least occupying the memory when the available memory is lower than the first set value, so that memory occupation of the at least one application program can be released, the available memory of the electronic device can be ensured, a smooth feeling of using the electronic device by a user can be ensured, and user experience is improved.

Description

Memory management method, electronic device, computer storage medium, and program product
Technical Field
The present disclosure relates to the field of computers, and more particularly, to a memory management method, an electronic device, a computer storage medium, and a program product.
Background
With the development of computer technology, operating systems have been rapidly developed and applied to various electronic products. With the operating system, a large number of applications can be used, and applications run on the operating system using memory.
Because the memory resource is limited, when the number of the opened application programs is too large, the memory may be insufficient, so that the system operation fails, and the user experience is affected.
Disclosure of Invention
Embodiments of the present disclosure provide an efficient memory management scheme.
In a first aspect, a memory management method is provided. The method comprises the following steps: the electronic equipment determines a first available memory of the electronic equipment; if the first available memory is lower than a first set value, the electronic equipment determines the killed priority of each of the plurality of application programs at least based on the occupied memory of each of the plurality of application programs in the background state; and the electronic equipment kills at least one application program in the plurality of application programs based on the killed priority of each application program. Specifically, if the memory occupied by the application is larger, the killed priority of the application is higher. Namely, the application program with large memory occupation can be killed preferentially.
Therefore, the electronic device of the embodiment of the disclosure can kill the at least one application program in the background state based on the occupied memory when the available memory is lower than the first set value, so that the memory occupation of the at least one application program can be released, the available memory of the electronic device is ensured, the smooth feeling of using the electronic device by a user can be ensured, and the user experience is improved.
In some embodiments of the first aspect, determining the first available memory comprises: the electronic equipment periodically determines a first available memory based on a first period; or, if the occupied memory is higher than a first set value after the application program in the to-be-started state is detected to be started, the electronic device determines a first available memory.
Therefore, the electronic device of the embodiment of the disclosure can determine the available memory based on the first period or based on the application program to be started, so that the scheme is more targeted, and the influence on the normal use of the user due to memory judgment is avoided.
In some embodiments of the first aspect, the killed priority of each of the plurality of applications is further determined based on at least one of: a location of each of the plurality of applications in the background application list, a number of times each of the plurality of applications is used within a preset length of time, or a time consumed by each of the plurality of applications when launched. In particular, the position of each in the background application list may be determined based on the sequential order in which the plurality of applications each last switched from the foreground state to the background state. Specifically, the earlier the application program is switched from the foreground state to the background state for the last time, the fewer the number of times it is used within a preset time period, and the shorter the elapsed time when it is started, the higher the killing priority is. For example: the total score representing the killed priority can be determined based on the memory occupation of the application program, the position of the application program in a background application program list, the used times of the application program in a preset time length and the starting time consumption of the application program; the larger the memory occupation is, the higher the score corresponding to the parameter is; the position in the background application program list is more forward, the higher the score corresponding to the parameter is; the smaller the number of times of use in the preset time length is, the higher the score corresponding to the parameter is; the shorter the starting time is, the higher the score corresponding to the parameter is; according to the scores corresponding to the four parameters respectively, a total score representing the killed priority can be obtained, and the higher the total score is, the higher the killed priority is. For example, the four parameters of memory usage, location in the background application list, number of times used, and time consumed for booting may have preset weights respectively. According to the preset weight, the scores corresponding to the four parameters can be weighted, so that a total score representing the killed priority is obtained.
Thus, the electronic device can determine the killed priority of the application based on a plurality of factors, so that the consideration when killing the application is more comprehensive.
Therefore, the electronic equipment determines the killed priority of each application program based on the preset weight, and the method is simple, efficient and easy to implement.
In some embodiments of the first aspect, further comprising: the electronic equipment adds the relevant information of the killed at least one application program into the information list.
In some embodiments of the first aspect, the information related to the at least one application comprises information about at least one of: identification, memory occupation after startup, number of times of use within a preset time length, or time consumption when the device is started last time.
Therefore, the electronic equipment adds the information of the killed application program in the information list, and the subsequent recovery of the application program is facilitated.
In some embodiments of the first aspect, further comprising: the electronic equipment determines a second available memory of the electronic equipment; if the second available memory is higher than a second set value, the electronic equipment determines the starting priority of each application program in the information list at least based on the memory occupied by each application program in the information list after starting, wherein the second set value is higher than the first set value; and the electronic equipment starts one or more application programs in the information list in the background at least based on the starting priority of each application program.
Therefore, in the embodiment of the disclosure, after the electronic device kills the application program, the killed application program can be recovered, and time consumption of restarting when the user uses the electronic device again is avoided, so that the scheme of the embodiment of the disclosure can improve user experience.
In some embodiments of the first aspect, determining the second available memory comprises: the electronic equipment periodically determines a second available memory based on a second period; or if the exiting application program exists and the released memory of the exiting application program is higher than the first set value, determining the second available memory.
In some embodiments of the first aspect, determining the launch priority comprises: the electronic device determines a start priority if the second available memory is higher than a second set point and at least one of: the occupancy of the processor is below a first threshold, the input/output bandwidth occupancy is below a second threshold, or the network bandwidth occupancy is below a third threshold.
Therefore, the electronic equipment has more comprehensive consideration in recovering the application program, can ensure that the recovery of the application program does not influence or interrupt the operation performed by the user, and ensures the user experience.
In some embodiments of the first aspect, the launch priority of each application in the list of information is further determined based on at least one of: the position of each application program in the information list, the number of times each application program is used within a preset time length, or the time consumed when each application program is started last time. Specifically, the position of each application in the information list may be determined based on the sequence in which each application is added to the information list from the background state. Specifically, the smaller the memory occupied after the startup, the later the time to be added to the information list, the more the number of times used within a preset time period, and the longer the time consumed when being started, the higher the startup priority.
In some embodiments of the first aspect, when determining the boot priority, at least one of a location occupied by the memory after booting, a number of times used, and a time consumed for the last boot in the information list respectively has a preset weight.
Thus, the electronic device can determine the starting priority of the application program based on a plurality of factors, so that the consideration in starting the application program is more comprehensive. And the starting priority of each application program is determined based on the preset weight, and the method is simple, efficient and easy to implement.
In a second aspect, a memory management device is provided. The device includes: a determination module configured to determine a first available memory of an electronic device; the determining module is further configured to determine the killed priority of each of the plurality of application programs at least based on the occupied memory of each of the plurality of application programs in the background state if the first available memory is lower than a first set value; and a kill application module configured to kill at least one of the plurality of applications based on a killed priority of each of the plurality of applications.
In some embodiments of the second aspect, the determination module is configured to periodically determine the first available memory based on a first period; or, if the occupied memory is higher than a first set value after the application program in the state to be started is detected to be started, determining the first available memory.
In some embodiments of the second aspect, the killed priority of each of the plurality of applications is further determined by the determining module based on at least one of: a location of each of the plurality of applications in a background application list, a number of times each of the plurality of applications is used within a preset length of time, or a time consumed by each of the plurality of applications when launched.
In some embodiments of the second aspect, the determining module is configured to take memory and at least one of a location in a background application list, a number of times used, and a time consumed in determining the killed priority of each of the plurality of applications, respectively, has a predetermined weight.
In some embodiments of the second aspect, further comprising an add list module configured to: and adding the relevant information of the killed at least one application program into the information list.
In some embodiments of the second aspect, the information related to the at least one application comprises information about at least one of: identification, occupation of a memory after starting, use times within a preset time length, or time consumption when the mobile terminal is started last time.
In some embodiments of the second aspect, the method further comprises launching an application module, the determining module further configured to determine a second available memory of the electronic device; if the second available memory is higher than a second set value, determining the starting priority of each application program in the information list at least based on the memory occupied by each application program in the information list after starting, wherein the second set value is higher than the first set value; and a launch application module configured to launch one or more applications in the list of information in the background based at least on the launch priorities of the respective applications.
In some embodiments of the second aspect, the determining module is configured to periodically determine the second available memory based on a second periodicity; or if the exiting application program exists and the released memory of the exiting application program is higher than the first set value, determining the second available memory.
In some embodiments of the second aspect, the determination module is configured to determine the boot priority if the second available memory is above a second set point and at least one of: the occupancy of the processor is below a first threshold, the occupancy of the input/output bandwidth is below a second threshold, or the occupancy of the network bandwidth is below a third threshold.
In some embodiments of the second aspect, the launch priority of each application in the list of information is further determined by the determination module based on at least one of: the position of each application program in the information list, the number of times each application program is used within a preset time length, or the time consumed when each application program is started last time.
In some embodiments of the second aspect, the determining module, when determining the boot priority, occupies the memory after booting, and at least one of a location in the information list, a number of times of being used, and a time consumed when booting last time, respectively has a preset weight.
In a third aspect, there is provided an electronic device comprising a processor and a memory, the memory having stored thereon instructions for execution by the processor, the instructions when executed by the processor causing the electronic device to carry out the operations of the method of the first aspect or any embodiment thereof.
In a fourth aspect, there is provided a computer-readable storage medium having stored thereon computer-executable instructions that, when executed by an electronic device, implement operations according to the method of the first aspect above or any embodiment thereof.
In a fifth aspect, a chip or chip system is provided. The chip or chip system comprises processing circuitry configured to perform operations according to the method of the first aspect described above or any embodiment thereof.
In a sixth aspect, a computer program or computer program product is provided. The computer program or computer program product is tangibly stored on a computer-readable medium and comprises computer-executable instructions that, when executed by a computer, implement the operations according to the method of the first aspect described above or any embodiment thereof.
Drawings
FIG. 1 is a diagram illustrating a scenario in which an application occupies memory;
FIG. 2 illustrates a schematic block diagram of an electronic device in which embodiments of the present disclosure may be implemented;
FIG. 3 illustrates a software architecture block diagram of an electronic device with a hierarchical architecture of the android system in which embodiments of the present disclosure may be implemented;
FIG. 4 shows a schematic flow chart diagram of a memory management process in accordance with some embodiments of the present disclosure;
FIG. 5 illustrates a schematic flow chart diagram of a process for restarting killed at least one application in accordance with some embodiments of the present disclosure; and
fig. 6 illustrates a schematic flow chart diagram of a process of determining boot priority in accordance with some embodiments of the present disclosure.
Detailed Description
In describing embodiments of the present disclosure, the terms "include" and "comprise," and similar language, are to be construed as open-ended, i.e., "including but not limited to. The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first," "second," and the like may refer to different or the same objects. Other explicit and implicit definitions are also possible below.
Due to the development of computer technology, electronic devices are becoming more and more popular nowadays, and a large number of applications can be installed on the electronic devices in general. During the process of using the electronic device, the user can completely quit the application program, that is, the memory space is released by the process corresponding to the application program. Or the user may simply turn off the interface of the application program so that the application program is converted into a background state, at which time the application program still occupies the memory.
Fig. 1 is a diagram illustrating a scenario 100 in which an application occupies a memory. As shown in fig. 1, the memory may include chip reservations 110, a kernel 120, anonymous pages 131, compressed anonymous pages 132, compressed anonymous page extensions 133, file pages, and free (free) memory 140, where the anonymous pages 131, compressed anonymous pages 132, and compressed anonymous page extensions 133 may be collectively referred to as a total anonymous page distribution 130. Illustratively, after one or more applications 150 (e.g., APP1 through APP6 shown in fig. 1) are started, the applications in the foreground state or the background state occupy memory, and in particular, occupy the total anonymous page distribution 130.
In general, system services and applications, etc. are kept as operational as possible to ensure the user experience. But is limited by the size of the memory resources of the system and the number of applications that remain running is limited. When the memory is insufficient, one way is to compress the running application program so as to occupy less memory resources, but in this case, the compression and decompression operations need to be performed frequently; another way is to swap out the memory occupied by the application, for example, to make the application occupy other memory resources, but this will affect the service life of various devices, increase the occupancy rate of the input/output interface between the memory and other memories, and also require frequent swapping in and out. Therefore, the current scheme is not efficient enough, has disadvantages and can influence user experience.
In view of this, embodiments of the present disclosure provide a memory management scheme, which can kill an application program in a background state to release a memory when the memory is insufficient, and can restart the killed application program when the memory is sufficient, so as to ensure user experience. Specific embodiments of the present disclosure will be described below with reference to the accompanying drawings.
FIG. 2 illustrates a schematic block diagram of an electronic device 200 in which embodiments of the present disclosure may be implemented.
As shown in fig. 2, the electronic device 200 may include a processor 210, an external memory interface 292, an internal memory 296, a Subscriber Identity Module (SIM) card interface 294, a display 220, a camera 222, a pointer 224, a motor 226, keys 228, a Universal Serial Bus (USB) interface 230, a charging manager Module 240, a power management Module 242, a battery 244, a mobile communication Module 250, an antenna 252, a wireless communication Module 260, an antenna 262, an audio Module 270, a speaker 272, a microphone 274, a microphone 276, an earphone interface 278, a sensor Module 280, and so on. The sensor module 280 includes a pressure sensor 2802, a gyroscope sensor 2804, a barometric pressure sensor 2806, a magnetic sensor 2808, an acceleration sensor 2810, a distance sensor 2812, a proximity light sensor 2814, a fingerprint sensor 2816, a temperature sensor 2818, a touch sensor 2820, an ambient light sensor 2822, and the like.
It is understood that fig. 2 is only an illustration, and the electronic device 200 may include more or less components, or may combine several components into one component, or may separate one component into several components, or a combination thereof. It is further understood that the components shown in FIG. 2 may be implemented in hardware, software, or a combination of software and hardware.
The Processor 210 may include one or more Processing units, such as a Central Processing Unit (CPU), an Application Processor (AP), a modem Processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a video codec, a Digital Signal Processor (DSP), a baseband Processor, and/or a Neural Network Processor (NPU), and the like, wherein the different Processing units may be independent devices or may be integrated into one or more processors.
A memory may also be provided in processor 210 for storing instructions and data. As an example, the memory in the processor 210 is a cache memory. The memory may hold instructions or data that have just been used or recycled by processor 210. If the processor 210 needs to use the instruction or data again, it can be called directly from memory. Avoiding repeated accesses reduces the latency of the processor 210, thereby increasing the efficiency of the system.
The processor 210 may include one or more interfaces. The Interface may include an Integrated Circuit (I2C) Interface, an Inter-Integrated Circuit built-in audio (I2S) Interface, a Pulse Code Modulation (PCM) Interface, a Universal Asynchronous Receiver/Transmitter (UART) Interface, a Mobile Industry Processor Interface (MIPI), a General-Purpose Input/Output (GPIO) Interface, a SIM card Interface 294, and/or a USB Interface 230.
It is understood that the present disclosure only schematically illustrates the interfacing relationship between the modules, but these illustrations should not be construed as limiting the structure of the electronic device 200. The electronic device 200 may also interface differently than described above, or may interface in a combination of multiple ways.
The charge management module 240 is configured to receive a charging input from a charger. The charger can be a wireless charger or a wired charger. In the case of wired charging, the charging management module 240 may receive a charging input of a wired charger through the USB interface 230. In the case of wireless charging, the charging management module 240 may receive a wireless charging input through a wireless charging coil of the electronic device 200. The charging management module 240 may also provide power to the electronic device 200 via the power management module 242 while charging the battery 244.
The power management module 242 is used to connect the battery 244, the charge management module 240, and the processor 210. The power management module 242 receives input from the battery 244 and/or the charge management module 240 and provides power to the processor 210, the internal memory 296, the display 220, the camera 222, the wireless communication module 260, and the like. The power management module 242 may also be used to monitor parameters such as battery capacity, battery cycle count, and battery state of health (e.g., leakage, impedance). In some cases, the power management module 242 may also be disposed in the processor 210. In other cases, the power management module 242 and the charging management module 240 may be disposed in the same device.
The wireless communication function of the electronic device 200 may be implemented by the mobile communication module 250, the antenna 252, the wireless communication module 260, the antenna 262, a modem processor, a baseband processor, and the like.
The antenna 252 and the antenna 262 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 200 may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example, the antenna 252 may be multiplexed as a diversity antenna for a wireless local area network. For example, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 250 may provide a solution including 2G/3G/4G/5G wireless communication applied on the electronic device 200. The mobile communication module 250 may include at least one filter, a switch, a power amplifier, a Low Noise Amplifier (LNA), and the like. The mobile communication module 250 may receive the electromagnetic wave from the antenna 1, filter, amplify, etc. the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 250 can also amplify the signal modulated by the modem processor, and convert the signal into electromagnetic wave through the antenna 252 to radiate the electromagnetic wave. In some scenarios, at least some of the functional modules of the mobile communication module 250 may be disposed in the processor 210. In some scenarios, at least some of the functional modules of the mobile communication module 250 may be disposed in the same device as at least some of the modules of the processor 210.
The modem processor may include a modulator for modulating a low frequency baseband signal to be transmitted into a medium-high frequency signal and a demodulator for demodulating a received electromagnetic wave signal into a low frequency baseband signal. The demodulator then passes the demodulated low frequency baseband signal to a baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 272, the receiver 274, etc.) or displays an image or video through the display screen 220. In some scenarios, the modem processor may be a stand-alone device. In other scenarios, the modem processor may be provided in the same device as the mobile communication module 250 or other functional modules, independent of the processor 210.
The Wireless communication module 260 may provide a solution for Wireless communication including a Wireless Local Area Network (WLAN) applied to the electronic device 200, such as Wi-Fi Network, BT, global Navigation Satellite System (GNSS), frequency Modulation (FM), NFC, infrared (IR). The wireless communication module 260 may be one or more devices integrating at least one communication processing module. The wireless communication module 260 receives electromagnetic waves via the antenna 262, performs frequency modulation and filtering on the electromagnetic wave signal, and transmits the processed signal to the processor 210. The wireless communication module 260 may also receive a signal to be transmitted from the processor 210, frequency-modulate and amplify the signal, and convert the signal into electromagnetic waves via the antenna 262 to radiate the electromagnetic waves.
In some scenarios, the antenna 252 and the mobile communication module 250 of the electronic device 200 are coupled and the antenna 262 and the wireless communication module 260 are coupled such that the electronic device 200 may communicate with networks and/or other devices via wireless communication techniques. The wireless communication technology may include Global System For Mobile Communications (GSM), general Packet Radio Service (GPRS), code Division Multiple Access (CDMA), wideband Code Division Multiple Access (WCDMA), time Division Code Division Multiple Access (TD-SCDMA), long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technologies.
The electronic device 200 implements a display function through the GPU, the display screen 220, and the application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 220 and an application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 210 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 220 is used to display text, images, video, and the like. The Display screen 220 includes a Display panel, which may be a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), an Active Matrix Organic Light-Emitting Diode (Active-Matrix Organic Light-Emitting Diode, AMOLED), a flexible Light-Emitting Diode (FLED) Mini-LED, micro-OLED, a Quantum Dot Light-Emitting Diode (QLED), or the like. In some scenarios, the electronic device 200 may include 1 or more display screens 220.
The electronic device 200 may implement a photographing function through the ISP, the camera 222, the video codec, the GPU, the display screen 220, and the application processor, etc.
The ISP is used to process the data fed back by the camera 222. For example, when a user takes a picture, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, an optical signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing and converting the electric signal into an image visible to the naked eye. The ISP can also carry out algorithm optimization on noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some scenarios, the ISP may be located in camera 222.
The camera 222 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image to the photosensitive element. The photosensitive element may be a Charge Coupled Device (CCD) or a Complementary Metal-Oxide-Semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to be converted into a digital image signal. And the ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV and other formats. In some scenarios, the electronic device 200 may include 1 or more cameras 222.
The digital signal processor is used for processing digital signals, and can process digital image signals and other digital signals. For example, when the electronic device 200 selects a frequency bin, the digital signal processor is used to perform fourier transform or the like on the frequency bin energy.
Video codecs are used to compress or decompress digital video. The electronic device 200 may support one or more video codecs. In this way, the electronic device 200 can play or record videos of various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, and so on.
The NPU is a Neural-Network (NN) computing processor, which processes input information quickly by referring to a biological Neural Network structure, for example, by referring to a transfer mode between neurons of a human brain, and can also learn by itself continuously. The NPU can implement applications such as intelligent recognition of the electronic device 200, for example: image recognition, face recognition, speech recognition, text understanding, and the like.
The indicator 224 may be an indicator light, and may be used to indicate a charging status, a change in charge level, or may be used to indicate a message, a missed call, a notification, etc.
The motor 226 may generate a vibration cue. The motor 226 may be used for both an incoming call vibration prompt and a touch vibration feedback. For example, touch operations applied to different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 226 may also respond to different vibration feedback effects for touch operations applied to different areas of the display screen 20. Different application scenes (such as time reminding, receiving information, alarm clock, game and the like) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
The keys 228 include a power-on key, a volume key, and the like. The keys 228 may be mechanical keys or touch keys. The electronic apparatus 200 may receive a key input, and generate a key signal input related to user setting and function control of the electronic apparatus 200.
The SIM card interface 294 is used to connect a SIM card. The SIM card can be attached to and detached from the electronic device 200 by being inserted into the SIM card interface 294 or being pulled out from the SIM card interface 294. The electronic device 200 may support 1 or more SIM card interfaces 294. The SIM card interface 294 may support a Nano SIM card, a Micro SIM card, a mini SIM card, and the like. The same SIM card interface 294 can be inserted with multiple cards at the same time, and the types of the multiple cards can be the same or different. The SIM card interface 294 may also be compatible with different types of SIM cards. The SIM card interface 294 may also be compatible with an external memory card. The electronic device 200 interacts with the network through the SIM card to implement functions such as communication and data communication. In some scenarios, the electronic device 200 employs an embedded SIM (eSIM) card, which may be embedded in the electronic device 200 and cannot be separate from the electronic device 200.
The external memory interface 292 may be used to connect an external memory card, such as a Micro SD card, to extend the memory capability of the electronic device 200. The external memory card communicates with the processor 210 through the external memory interface 292 to implement a data storage function. For example, files such as music, video, etc. are saved in an external memory card.
The internal memory 296 may be used to store computer-executable program code, which includes instructions. The internal memory 296 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function and an image playing function) required by at least one function, and the like. The storage data area may store data (such as audio data, a phonebook) created during use of the electronic device 200, and the like. In addition, the internal memory 296 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk Storage device, a Flash memory device, a Universal Flash Storage (UFS), and the like. The processor 210 executes various functional applications of the electronic device 200 and data processing by executing instructions stored in the internal memory 296 and/or instructions stored in a memory provided in the processor.
The electronic device 200 may implement audio functions through the audio module 270, the speaker 272, the microphone 276, the headphone interface 278, the application processor, and the like. Such as music playing, recording, etc.
Audio module 270 is used to convert digital audio signals to analog audio signal outputs and also to convert analog audio inputs to digital audio signals. Audio module 270 may also be used to encode and decode audio signals. In some scenarios, audio module 270 may be disposed in processor 210, or some functional modules of audio module 270 may be disposed in processor 210.
The receiver 274, also called "earpiece", is used to convert electrical audio signals into sound signals. When the electronic apparatus 200 receives a call or voice information, it is possible to receive voice by placing the receiver 274 close to the human ear.
The microphone 276, also referred to as a "microphone" or "microphone," is used to convert acoustic signals into electrical signals. When making a call or sending voice information, the user can input a voice signal to the microphone 276 by speaking near the microphone 276 through the mouth of the user. The electronic device 200 may be provided with at least one microphone 276. For example, the electronic apparatus 200 may be provided with two microphones 276, which may implement a noise reduction function in addition to collecting sound signals. For example, the electronic device 200 may further include three, four, or more microphones 276 for collecting sound signals, reducing noise, identifying sound sources, performing directional recording, and the like.
The headset interface 278 is used to connect wired headsets. The headset interface 278 may be a USB interface 230, an open mobile electronic device platform (OMTP) standard interface of 3.5mm, a cellular telecommunications industry association (cellular telecommunications industry association) standard interface of the USA, or the like.
The pressure sensor 2802 is used to sense a pressure signal and convert the pressure signal into an electrical signal. In some scenarios, pressure sensor 2802 may be disposed on display screen 220. The pressure sensor 2802 may be of the type of a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, or the like.
The gyro sensor 2804 may be used to determine a motion pose of the electronic device 200.
Air pressure sensor 2806 may be used to measure air pressure.
The magnetic sensor 2808 includes a hall sensor. The electronic device 200 may detect the opening and closing of the flip holster using the magnetic sensor 2808.
The acceleration sensor 2810 may be used to detect the magnitude of acceleration of the electronic device 200 in various directions (typically three axes).
The distance sensor 2812 may be used to measure distance. The electronic device 200 may measure the distance by infrared or laser. In a scene such as a shot, the electronic device 200 may utilize the distance sensor 2812 to range to achieve fast focus.
The proximity light sensor 2814 may include, for example, an LED and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic apparatus 200 emits infrared light outward through the light emitting diode, and detects infrared reflected light from a nearby object using the photodiode. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 200. When insufficient reflected light is detected, the electronic device 200 may determine that there is no object nearby. The electronic device 200 can utilize the proximity sensor 2814 to detect that the user holds the electronic device 200 close to the ear for talking, so as to automatically extinguish the display 220 for power saving. The proximity light sensor 2814 may also be used in holster mode, pocket mode automatically unlock and lock screen.
The fingerprint sensor 2816 may be used to capture a fingerprint. The electronic device 200 can utilize the collected fingerprint characteristics to unlock the fingerprint, access the application lock, photograph the fingerprint, answer an incoming call with the fingerprint, and the like.
Temperature sensor 2818 may be used to detect temperature.
Touch sensor 2820 is also referred to as a "touch device" or "touch panel" or the like. The touch sensor 2820 may be disposed on the display screen 220, and the touch sensor 2820 and the display screen 220 form a touch screen. The touch sensor 2820 is used to detect a touch operation applied thereto or nearby. The touch sensor 2820 may pass the detected touch operation to the application processor to determine the touch event type. Visual output related to touch operations may be provided through the display screen 220. In other scenarios, the touch sensor 2820 may be disposed on the surface of the electronic device 200 at a different position than the display screen 220.
The ambient light sensor 2822 is used to sense ambient light brightness. The electronic device 200 may adaptively adjust the brightness of the display screen 220 based on the perceived ambient light level. The ambient light sensor 2822 may also be used to automatically adjust the white balance when taking a picture. The ambient light sensor 2822 may also cooperate with the proximity light sensor 2814 to detect whether the electronic device 200 is in a pocket to prevent inadvertent contact.
Optionally, the sensor module 280 may further include an infrared sensor, an ultrasonic sensor, an electric field sensor, and the like for assisting the electronic device 200 in recognizing the air gesture.
It should be understood that the electronic device 200 in fig. 2 is merely illustrative and that it may include more or less components when implemented as a different type of device. For example, the electronic device 200, when implemented as a laptop computer, may not have the SIM card interface 294.
The software system of the electronic device 200 may employ a hierarchical architecture, a dammony system (Harmony OS) architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, a cloud architecture, or the like.
Fig. 3 illustrates a software structure block diagram of an electronic device 300 having an Android (Android) system of a hierarchical architecture in which embodiments of the present disclosure may be implemented.
The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. As shown in fig. 3, the Android system may be divided into four layers, which are an application layer 310, an application framework layer 320, a kernel layer 330, and a network transport layer 340 from top to bottom.
The Application layer 310 may include a series of Application packages including, but not limited to, camera, gallery, calendar, call, map, navigation, WLAN, bluetooth, music, video, short message, etc. Applications (APP).
The Application framework layer 320 provides an Application Programming Interface (API) and a Programming framework for the applications of the Application layer 310. The application framework layer 320 may include a number of predefined functions including, but not limited to, a window manager, a content provider, a view system, a phone manager, an explorer, a notification manager, etc.
The window manager is used for managing window programs. The window manager can obtain the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make it accessible to applications. The data may include video, images, audio, calls made and answered, browsing history and bookmarks, phone books, etc.
The view system includes visual controls such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, the display interface including the short 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 300. Such as management of call status (including on, off, etc.).
The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so forth.
The notification manager enables the application to display notification information in the status bar, can be used to convey notification-type messages, can disappear automatically after a brief dwell, and does not require user interaction. A notification manager is used to inform about download completion, message alerts, etc. The notification manager may also be a notification that appears in the form of a chart or scroll bar text at the top status bar of the system, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. Such as prompting for text information in the status bar, sounding a prompt tone, the electronic device 300 vibrating, flashing an indicator light, etc.
The kernel layer 330 at least includes a display driver, a camera driver, an audio driver, and a transmission driver. Different drivers of the kernel layer 330 are used for calling hardware devices of the electronic device 300 and executing corresponding operations. For example, the display driver is used to support interface display and the like of the electronic device 300, the audio driver is used to support playing audio and the like of the electronic device 300, and the transmission driver is used to support content sharing and the like between the electronic device 300 and another electronic device.
The network transport layer 340 may be used for communication, data transfer, etc. between the electronic device 300 and another electronic device. The method can comprise the following steps: the device comprises a Bluetooth module, a Wi-Fi module, an NFC module, a discovery connection module, a pairing module, a connection transmission module and the like. The discovery connection module may be used to discover another electronic device that may establish a communication connection. The pairing module may be used to authenticate another electronic device requesting connection establishment during the establishment of the communication connection. The connection transfer module may be used to transfer data or messages, instructions, etc. with another electronic device to which a connection has been established.
It should be understood that although the electronic device 300 shown in fig. 3 has an android system, the present disclosure is not limited thereto, for example, embodiments of the present disclosure may also be applied to electronic devices and the like having other operating systems. In addition, the electronic device 200 and the electronic device 300 as described above are merely illustrative and should not be construed as limiting the embodiments of the present disclosure as described below.
Fig. 4 shows a schematic flow diagram of a memory management process 400 according to some embodiments of the present disclosure. Process 400 may be performed by an electronic device, such as electronic device 200 shown in FIG. 2 or electronic device 300 shown in FIG. 3, above.
At step 410, a first available memory of the electronic device is determined.
The electronic equipment is provided with an application program, and the application program occupies a memory after being started. For example, a user may start an application by clicking an icon corresponding to the application, bring the application to a foreground state, present an interface, and the like. For an application in the foreground state, the user may close the interface of the application by clicking a "close" button, or by clicking a key such as "Home" or by clicking an icon of another application, and change to the background state. It can be understood that the application program in the foreground state or the background state occupies the memory. It should be noted that, in the embodiments of the present disclosure, memories, memory spaces, memory resources, and the like may represent the same meaning, and are not differentiated below.
In some embodiments, the electronic device may determine the first available memory periodically or based on an event trigger.
For example, the first available memory may be determined periodically based on a first period. The electronic device may be provided with a first timer, and the first timer may have an initial value when started, and when the value of the first timer reaches a predetermined value, the first available memory may be determined. Additionally or alternatively, the value of the first timer may be reset to an initial value after the value reaches a predetermined value and re-timed. As an example, the initial value may be equal to 0, and the predetermined value may be equal to the first period. As another example, the initial value may be equal to the first period, and the predetermined value may be equal to 0. The value of the first period may be preset based on actual requirements, for example, the electronic device may have a factory-set first period, or a user may adjust the first period according to own requirements, which is not limited by the present disclosure.
The first timer may be in operation during a time when the electronic device is powered on. Or alternatively, the first timer may be in operation when the electronic device includes an application in a background state. That is, if the electronic device is in the power-on state but there is no application program in the background state, the first timer may be set to the initial value and stop running, i.e., not count time.
For example, the first available memory may be determined based on the application program being in a state to be launched. Specifically, memory occupied after the application program in the to-be-started state is started may be detected, and if it is determined that the memory occupied after the application program in the to-be-started state is started is higher than a first set value, the first available memory is determined. Optionally, in the embodiment of the present disclosure, an application program that occupies a memory higher than the first setting value after being started may be referred to as a large memory application program, for example, a camera or a mobile phone. For example, the first setting value may be preset based on the total memory of the electronic device, the processing speed of the processor of the electronic device, and the like. In addition, the form of the first set value can be a specific memory size, and the dimension of the first set value is MB or kB and the like; or the first set point may be in the form of a ratio relative to the total memory, having a dimension of 1, such as in the form of a percentage. The present disclosure is not limited thereto.
The determined form of the first available memory may be a specific memory size, and the dimension of the first available memory is MB or kB; or the first available memory may be in the form of a proportion relative to the total memory, the dimension being 1, such as a percentage. The present disclosure is not limited thereto. It should be understood, however, that the first available memory and the first set point are the same dimensions in the embodiments of the disclosure.
In connection with the scenario 100 of fig. 1, the first available memory may represent the available memory (in the dimension of MB or kB, etc.) in the total anonymous page distribution 130 or the proportion of the available memory in the total anonymous page distribution 130 relative to the total anonymous page distribution 130. It should be understood, however, that the first available memory may also represent other meanings, such as an amount of available memory, and the disclosure is not limited thereto.
In step 412, it is determined whether the first available memory is below a first set point. If the first available memory is determined not to be lower than the first set value, the process returns to step 410. If it is determined that the first available memory is lower than the first set value, step 420 is executed.
In step 420, the killed priority of each of the plurality of applications is determined based at least on the occupied memory of each of the plurality of applications in the background state.
That is, if the first available memory is lower than the first set value, determining killed priority of each application program in the plurality of application programs in the background state.
In some embodiments, it can be understood that, if there is an application program in a to-be-started state and the occupied memory of the application program in the to-be-started state after being started is higher than the first setting value, when the first available memory is lower than the first setting value, the first available memory may not guarantee normal use of the application program in the to-be-started state, and may even not guarantee normal start of the application program in the to-be-started state.
In some embodiments, if the respective occupied memories of the plurality of applications in the background state are different, the respective killed priorities may be determined based on the size of the occupied memories. For example, the application program with the largest memory usage has the largest killed priority. For example, assume that there are 3 applications in the background state, where the memory occupied by the application 1 is S1, the memory occupied by the application 2 is S2, and the memory occupied by the application 3 is S3. If S3> S1> S2, then application 3 has a first killed priority, application 1 has a second killed priority, and application 2 has a third killed priority.
In some embodiments, in determining the killed priority of each of the plurality of applications, in addition to being based on occupied memory, one or more of the following may be further based on: a location of each of the plurality of applications in the background application list, a number of times each of the plurality of applications is used within a preset length of time, or a time consumed by each of the plurality of applications when launched.
Taking an application (assumed to be APP 01) of the multiple applications as an example, the location of APP01 in the background application list may be represented in the form of a serial number, such as 1, 2, \8230, etc. Illustratively, the location may be determined based on the time APP01 was last used (last in the foreground state). Specifically, the closer the last time of use, the smaller the serial number of the position; conversely, the longer the last time it was used, the larger the sequence number of the location. For example, assume that there are two applications in the background state: APP01 and APP02, the last time APP01 was used, then the position of APP01 in the background application list is denoted 1 and the position of APP02 in the background application list is denoted 2.
The number of times each of the plurality of applications is used within the preset time period may represent the number of times the application is switched to the foreground state within the preset time period. For example, the preset time period may be a preset parameter, such as 10 minutes or 1 hour or other values.
The elapsed time of each of the plurality of applications when launched may represent the length of time that the application changed from the un-launched state to the foreground state. In some embodiments, the elapsed time may be the time period from the user clicking on the desktop application icon to full screen display of the interface of the application. In some embodiments, the elapsed time may be the length of time from when the user clicks on the desktop application icon to when the interface of the application is presented and the number of words on the interface reaches a word count threshold. In particular, the number of words presented on the interface of the application may be counted until the number of words reaches a word number threshold. In some embodiments, the elapsed time may be a period of time from when the user clicks on the desktop application icon to when the proportion of the application's interface presentation content reaches a proportion threshold. For example, the proportional threshold may be 80% or 100% or other value. This allows sufficient consideration of network conditions, processing speed of the electronic device, and the like.
The position of the application in the background application list may be determined based on the precedence order in which the application was last switched from the foreground state to the background state. And, the earlier the last switch from the foreground state to the background state is, the higher the killed priority is. In addition, the smaller the number of times of use within the preset time period, the higher the kill priority. The shorter the elapsed time when it is started, the higher the kill priority.
Alternatively, the total score representing the killed priority may be determined based on the memory usage of the application, the location of the application in the background application list, the number of times the application is used within a preset time period, and the time taken for the application to start. As an example, a first score may be determined based on the memory usage of the application, a second score may be determined based on the location of the application in the background application list, a third score may be determined based on the number of times the application is used within a preset time period, a fourth score may be determined based on the time taken for the application to start, and a total score representing the kill priority may be obtained based on the first score to the fourth score.
For example, when determining the killed priority of each of the plurality of applications, at least one of the occupied memory, the position in the background application list, the number of times of use, and the time consumed for starting each of the plurality of applications has a preset weight.
In some embodiments, an application in the background state may be referred to simply as a background application. And the score of each of the plurality of applications in the background state may be determined by the following formula, and the killed priority may be determined based on the score, wherein a higher score indicates a higher killed priority:
Figure BDA0003290493070000121
in the above formula, score k Represents the score of the kth background application of the plurality of background applications, w1, w2, w3, and 4 represent weights, respectively, and w1+ w2+ w3+ w4=1,mem k Indicates the occupied memory of the kth background application program, posorder k Indicating the location, of the kth background application among multiple background applications k Representing the ranking of the kth background application among multiple background applications, posnum ber, based on the elapsed time when launched, from long to short k The sequence of the kth background application program in the background application programs is shown based on the number of used times in the preset time length, and n1 represents the number of the background application programs.
For posorder in equation 1 k The value range is 1 to n1. Specifically, of the n1 background applications, the application that is switched to the background state at the latest is assumed to be the background application i1, and the position thereof is 1, i.e., the posorder i1 And =1. The application that switches to the background state earliest is assumed to be background application j1, which is located at n1, i.e., posorder j1 =n1。
For the pos in equation 1 k The value range is 1 to n1. Specifically, of the n1 background applications, the time consumed when the application is started is the mostThe long application is assumed to be the background application i2, which is ranked 1, namely, the potential i2 And =1. The application that takes the least time when launched is assumed to be the background application j2, ordered n1, that is, the potential j2 =n1。
For posumber in equation 1 k The value range is 1 to n1. Specifically, of the n1 background applications, the application with the largest number of times of use within the preset time duration is assumed to be the background application i3, and the ranking is 1, that is, posnum ber i3 And =1. The application with the least number of times of use within the preset duration is assumed to be the background application j3, which is ranked as n1, i.e., posnum ber j3 =n1。
It will be appreciated that in relation to score k In the expression of (1), 0<w1≤1,0≤w2<1,0≤w3<1 and 0 is not less than w4<1. For example, if the number of times of being used is not considered in determining the killed priority, w4=0 may be set.
At step 430, at least one of the plurality of applications is killed based on the killed priority of each of the plurality of applications.
In some embodiments, if the first available memory is determined based on the first period in step 410, a preset number of applications having the highest killed priority (corresponding to the highest score of equation 1) may be killed in step 430. The predetermined number may be any positive integer, such as 1. In one example, an application with the highest killed priority (in the background state) may be killed.
In some embodiments, if the first available memory is determined based on the application to be started in step 410, then in step 430, the at least one application with the highest killed priority may be killed, so that the memory after the at least one application is killed satisfies the memory usage after the application in the state to be started is started.
For example, it is assumed that the occupied memory after the application program in the standby state is started can be represented as S01, the first available memory can be represented as S02, and S02< S01. In one example, if the occupied memory of the application with the highest killed priority is S11, and S11+ S02> S01, the application with the highest killed priority can be killed. In another example, if the occupied memory of the application with the highest killed priority is S21, the occupied memory of the application with the next highest killed priority is S22, and S21+ S02< S01, S21+ S22+ S02> S01, the application with the highest killed priority and the application with the next highest killed priority can be killed.
In the embodiment of the present disclosure, killing (kill) an application refers to closing a process of the application and releasing an occupied memory of the application.
As described above, in the embodiment of the present disclosure, the killed priority is determined based on the occupied memory, so that the application program occupying a larger memory can be killed in time when the available memory is insufficient, thereby more effectively implementing memory release. When the application program to be started exists, the business requirement can be met more quickly. Additionally or alternatively, the killed priority may be determined based on a location in the background application list, such that older used applications may be killed preferentially when there is insufficient memory, and killing older used applications may have less impact on the user's usage requirements since the user may have a lower need to reuse older used applications relatively speaking. In addition, additionally or alternatively, the killed priority can be determined based on the number of times of use, so that when the memory is insufficient, the application programs which are not frequently used can be killed preferentially, time consumption of restarting the user when the user uses the application programs which are frequently used is avoided, and user experience is improved. Additionally or alternatively, the killed priority can be determined based on the starting time consumption, so that when the memory is insufficient, the application program with short starting time consumption can be killed preferentially, the situation that the user waits for the overlong starting time consumption again when the killed application program is used is avoided, and the user experience is improved.
Therefore, according to the embodiment of the disclosure, when the memory of the electronic device is insufficient, at least one application program in the background state can be killed based on the occupied memory of the application program in the background state, so that the used memory of the electronic device can be determined, the performance of the electronic device caused by the insufficient memory is prevented from being poor or even unavailable, and the user experience is improved.
Additionally or alternatively, after killing the at least one application program in the background state, the at least one application program to be killed may be restarted under the condition that the memory is sufficient.
FIG. 5 shows a schematic flow chart of a process 500 for restarting at least one application killed in accordance with some embodiments of the present disclosure.
At step 510, information about the killed at least one application is added to the list of information.
In some embodiments, the application-related information may include information regarding at least one of: identification, memory occupation after startup, number of times of use within a preset time length, or time consumption when the device is started last time. The identification may be represented as a name of the application, an identifier of the application or other form, and so forth.
The embodiment of the present disclosure does not limit the specific form of the information list, for example, the information list may include entries, one entry corresponding to one application.
In step 520, a second available memory of the electronic device is determined.
In some embodiments, the electronic device may determine the second available memory periodically or based on an event trigger.
For example, the second available memory may be determined periodically based on a second periodicity. A second timer may be set in the electronic device, and the second timer may have an initial value when started, and when the value of the second timer reaches a predetermined value, a second available memory is determined. Additionally or alternatively, the value of the second timer may be reset to an initial value after reaching a predetermined value and re-timed. As an example, the initial value may be equal to 0, and the predetermined value may be equal to the second period. As another example, the initial value may be equal to the second period, and the predetermined value may be equal to 0. The value of the second period may be preset based on actual requirements, for example, the electronic device may have a factory-set second period, or a user may adjust the second period according to own requirements, which is not limited by the present disclosure.
In case the information list is not empty, the second timer may be running. In other words, the second timer may stop counting when the information list is empty. When the information list is added with the related information of at least one application program, a second timer is started.
For example, the second available memory may be determined based on the application exiting. Specifically, the occupied memory of the exited application program may be detected, and if it is determined that the exited application program exists and the released memory of the exited application program is higher than a first set value, the second available memory is determined. Optionally, in the embodiment of the present disclosure, an application program whose occupied memory is higher than the first setting value may be referred to as a large memory application program, for example, a camera or a hand game. For example, the first setting value may be preset based on the total memory of the electronic device, the processing speed of the processor of the electronic device, and the like. In addition, the form of the first set value can be a specific memory size, and the dimension of the first set value is MB or kB and the like; or the first set point may be in the form of a ratio with respect to the total memory, having a dimension of 1, such as in the form of a percentage. The present disclosure is not limited thereto.
It should be understood that killing and exiting in embodiments of the present disclosure are different operations for an application. Typically, the exit is based on user instructions, for example, a user may exit an application in a foreground or background state, for example, the user deletes an application from a background application and exits the application. Generally, killing is not based on user operation, the electronic device may dynamically kill the application program in the background state based on the memory usage condition, the killed application program is not completely exited, but the related information of the killed application program is added to the information list, and thereafter, the electronic device may be started to the background state again based on the memory usage condition in the case that the user has no operation for the application program. It should be noted, however, that the explanations herein of kill and retire are merely illustrative to facilitate understanding of the differences between the two, but should not be construed as limiting the embodiments of the present disclosure.
The determined form of the second available memory may be a specific memory size, and the dimension of the second available memory is MB or kB; or the second available memory may be in the form of a proportion relative to the total memory, the dimension being 1, such as a percentage. The present disclosure is not limited thereto. However, it should be understood that the second memory and the first setting value in the embodiment of the present disclosure have the same dimension.
In step 522, it is determined whether the second available memory is higher than a second set value. If it is determined that the second available memory is not higher than the second set value, the process returns to step 520. If it is determined that the second available memory is higher than the second set value, proceed to step 530.
In step 530, the start priority of each application program in the information list is determined based on at least the memory occupied by each application program in the information list after start, where the second setting value is higher than the first setting value.
That is, if the second available memory is higher than the second set value, the start priority of each application program in the information list is determined.
Optionally, the start priority of each application program in the information list may be determined when the second available memory is higher than a second set value and at least one of (1) to (3) below, where (1) the occupancy rate of the processor is lower than a first threshold, (2) the occupancy rate of the input/output bandwidth is lower than a second threshold, and (3) the occupancy rate of the network bandwidth is lower than a third threshold.
In some embodiments, the launch priority of each application may be determined when the second available memory is higher than the second set point and (1) - (3) are simultaneously satisfied. As described in connection with fig. 6. Fig. 6 illustrates a schematic flow diagram of a process 600 of determining boot priority in accordance with some embodiments of the present disclosure.
At step 610, a second available memory is determined.
At step 620, it is determined whether the second available memory is higher than a second set point. If the second available memory is determined to be higher than the second set value, go to step 630, otherwise go back to step 610.
In some embodiments, the second set point is higher than the first set point, for example, the second set point is equal to 1.5 times the first set point or other multiple greater than 1.
At step 630, it is determined whether the occupancy of the processor is below a first threshold. If it is determined that the occupancy of the processor is below the first threshold, execution continues at step 640, otherwise execution returns to step 610.
The first threshold may be set based on the processing capability (e.g., processing speed, etc.) of the processor. For example, the first threshold is equal to 25% or 30% or other values.
At step 640, it is determined whether the Input/Output (I/O) bandwidth occupancy is below a second threshold. If the I/O occupancy is determined to be below the second threshold, then execution continues at step 650, otherwise execution returns to step 610.
The second threshold value may be set based on the transmission rate of the input-output bus or the like. For example, the second threshold is equal to 64kB/s or 200kB/s or other values.
At step 650, it is determined whether the network bandwidth occupancy is below a third threshold. If the network bandwidth occupancy is determined to be lower than the third threshold, the step 660 is continuously executed, otherwise, the step 610 is executed.
The third threshold may be set based on a bandwidth transmission rate of the electronic device, or the like. For example, the third threshold is equal to 64kB/s or 100kB/s or other values.
At process 600, returning to perform step 610 may include: resetting the second timer or re-determining whether the exited application program exists and the released memory of the exited application program is higher than the first set value.
At step 660, the launch priority of each application in the list of information is determined.
It is understood that process 600 of fig. 6 is merely illustrative, and for example, the order of execution of steps 630-650 in fig. 6 is not limited by embodiments of the disclosure. Although step 630 is shown as being performed first, followed by steps 640 and 650 in sequence in fig. 6. In an actual scenario, however, any one of steps 630-650 may be performed first, followed by the remaining two steps.
In the embodiment of the present disclosure, the start priority of each application program in the information list may be determined based on at least the memory occupied by each application program in the information list after start. Optionally, the launch priority of each application may be further determined based on at least one of: the position of each application program in the information list, the number of times each application program is used within a preset time length, or the time consumed when each application program is started last time.
The location of each application in the information list may be represented in the form of a serial number, such as 1, 2, \8230, etc. For example, the position of each application in the information list may depend on the order in which the application is killed (or added to the information list). Specifically, the more the time for killing is, the smaller the serial number of the position is; conversely, the further the time to kill, the greater the sequence number of the location. That is, the longer the time in the information list, the larger the number of positions in the information list.
In addition, specific meanings of the number of times each application program is used within a preset time period or the time consumed when each application program is started last time can be referred to the embodiment described above in conjunction with fig. 4, and are not repeated here.
The position of the application in the information list may be determined based on the order in which the application was added to the information list from the background state. And the later it is added to the information list, the higher the start-up priority. In addition, the more times used within the preset time period, the higher the start priority. The longer the elapsed time when being started, the higher the start priority.
Alternatively, the total score representing the starting priority may be determined based on the memory occupied by the application program after the application program is started, the position of the application program in the information list, the number of times the application program is used within a preset time period, and the starting time of the application program. As an example, the fifth value may be determined based on an occupied memory of the application program after the start, the sixth value may be determined based on a position of the application program in the information list, the seventh value may be determined based on a number of times the application program is used within a preset time period, the eighth value may be determined based on a start-up elapsed time of the application program, and the total value representing the start-up priority may be obtained based on the fifth value to the eighth value.
Illustratively, when determining the starting priority of each application program in the information list, at least one of the occupied memory after starting, the position in the information list, the number of times of use, and the elapsed time when the application program is started last time respectively has a preset weight.
In some embodiments, the scores of the various applications in the list of information may be determined by the following equation, and the launch priority may be determined based on the scores, where a lower score indicates a higher launch priority:
Figure BDA0003290493070000161
in the above formula, score t Represents the score of the t-th application in the information list, w1, w2, w3, and 4 represent weights, respectively, and w1+ w2+3+4=1, mem t Indicating that the t-th application program occupies memory after being started, posorder t Indicating the location, of the tth application in the list of information t Indicating the ranking of the tth application among the plurality of applications in the information list, posumber, based on the elapsed time since last launched t Indicating the sorting of the tth application program in the plurality of application programs in the information list based on the number of used times within a preset time period, and n2 indicating the number of application programs in the information list.
It will be appreciated that in relation to score t In the expression of (1), 0<w1≤1,0≤w2<1,0≤w3<1 and 0. Ltoreq. W4<1. For example, if the number of times of being used is not considered in determining the activation priority, w4=0 may be set. It is understood that w1, w2, w3 and 4 in formula 2 and w1, w2, w3 and 4 in formula 1 may be correspondingly equal, that is to sayThe weights of the items are respectively equal when considering the starting priority and the killed priority, so that consistency in killing and starting can be ensured.
At step 540, one or more applications in the list of information are launched in the background based at least on the launch priorities of the respective applications.
In some embodiments, if the second available memory is determined based on the second period in step 520, a preset number of applications having the highest launch priority (lowest score corresponding to equation 2) may be launched in step 540. The predetermined number may be any positive integer, such as 1.
In some embodiments, if the second available memory is determined based on the exited application releasing memory above a first predetermined value in step 520, then at least one application having the highest launch priority may be launched such that the available memory remains above the first set value after the at least one application is launched in step 540.
For example, it is assumed that the application with the highest boot priority (APP 11) occupies the memory after booting S31, and the application with the next highest boot priority (APP 12) occupies the memory after booting S32. If the available memory is still higher than the first set value after both APP11 and APP12 are started, both APP11 and APP12 may be started. On the contrary, if the APP11 is started, the available memory is higher than the first set value; however, after APP11 and APP12 are both started, if the available memory is lower than the first setting value, only APP11 may be started, and the related information of APP12 is still retained in the information list.
Therefore, the killed application program can be recovered more efficiently and more quickly, the time consumed for restarting when the user uses the application program again is avoided, and therefore the user experience can be improved through the scheme of the embodiment of the disclosure.
In the embodiment of the present disclosure, starting the application program from the information list may also be referred to as restoring the application program in the information list to a background state, that is, the application program started from the information list will be in a background state. Specifically, when the application program is started from the information list, the interface, the sound and the like of the application program can be closed, so that influence on other application programs used by the user is avoided.
Additionally, it is understood that after step 540, information related to the launched application or applications may also be deleted from the information list.
The processes of embodiments of the present disclosure are described in greater detail above in conjunction with fig. 4-6, but it should be understood that the above-described embodiments are merely illustrative, and that processes may include more or fewer steps, for example. In addition, although the above-mentioned embodiments show one determination manner of the killed priority and the start priority in formula 1 and formula 2, respectively, embodiments of the present disclosure may also determine the killed priority and the start priority in other manners, respectively, or embodiments of the present disclosure may represent the process of determining the killed priority and the start priority in one manner by combining formula 1 and formula 1.
Through the memory management scheme disclosed by the invention, at least one application program in a background state can be killed at least on the basis of occupying the memory in time when the memory is insufficient, so that the smooth feeling of using the electronic equipment by a user can be ensured, and the user experience is improved. In addition, when the memory is sufficiently recovered, the starting can be recovered at least based on the application program which occupies the memory and is killed after the starting, so that the time consumption of manual starting when the user uses the application program again is avoided.
Additionally, it can be appreciated that an electronic device as shown in fig. 2 or fig. 3 above may be used to implement the processes of embodiments of the present disclosure as described in connection with fig. 4-6.
Embodiments of the present disclosure also provide a chip that may include an input interface, an output interface, and a processing circuit. In the embodiment of the present disclosure, the interaction of signaling or data can be completed by the input interface and the output interface, and the generation and processing of signaling or data information can be completed by the processing circuit.
Embodiments of the present disclosure also provide a chip system, including a processor, configured to support an electronic device to implement the functions recited in any of the above embodiments. In one possible design, the system on chip may further include a memory for storing necessary program instructions and data, which when executed by the processor, cause the device on which the system on chip is installed to implement the method as claimed in any of the above embodiments. Illustratively, the chip system may be composed of one or more chips, and may also include chips and other discrete devices.
Embodiments of the present disclosure also provide a processor coupled to a memory, the memory storing instructions that, when executed by the processor, cause the processor to perform the methods and functions recited in any of the above embodiments.
Embodiments of the present disclosure also provide a computer program product containing instructions which, when run on a computer, cause the computer to perform the methods and functions referred to in any of the embodiments described above.
Embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon computer instructions, which, when executed by an electronic device, cause the electronic device to perform the methods and functions recited in any of the above embodiments.
In general, the various embodiments of the disclosure may be implemented in hardware or special purpose circuits, software, logic or any combination thereof. Some aspects may be implemented in hardware, while other aspects may be implemented in firmware or software, which may be executed by a controller, microprocessor or other computing device. While various aspects of the embodiments of the disclosure are illustrated and described as block diagrams, flow charts, or using some other pictorial representation, it is well understood that the blocks, apparatus, systems, techniques or methods described herein may be implemented in, as non-limiting examples, hardware, software, firmware, special purpose circuits or logic, general purpose hardware or controller or other computing devices, or some combination thereof.
The present disclosure also provides at least one computer program product tangibly stored on a non-transitory computer-readable storage medium. The computer program product comprises computer executable instructions, such as instructions included in program modules, which are executed in a device on a real or virtual processor of the target to perform the processes/methods as described above with reference to the figures. Generally, program modules include routines, programs, libraries, objects, classes, components, data structures, etc. that perform particular tasks or implement particular abstract data types. In various embodiments, the functionality of the program modules may be combined or split between program modules as desired. Machine-executable instructions for program modules may be executed within local or distributed devices. In a distributed facility, program modules may be located in both local and remote memory storage media.
Computer program code for implementing the methods of the present disclosure may be written in one or more programming languages. These computer program code may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program code, when executed by the computer or other programmable data processing apparatus, causes the functions/acts specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the computer, partly on the computer, as a stand-alone software package, partly on the computer and partly on a remote computer or entirely on the remote computer or server.
In the context of the present disclosure, computer program code or related data may be carried by any suitable carrier to enable a device, apparatus or processor to perform various processes and operations described above. Examples of a carrier include a signal, computer readable medium, and so forth. Examples of signals may include electrical, optical, radio, acoustic, or other forms of propagated signals, such as carrier waves, infrared signals, and the like.
The computer readable medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination thereof. More detailed examples of a computer-readable storage medium include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical storage device, a magnetic storage device, or any suitable combination thereof.
Further, while the operations of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that these operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Rather, the steps depicted in the flowcharts may change the order of execution. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions. It should also be noted that the features and functions of two or more devices according to the present disclosure may be embodied in one device. Conversely, the features and functions of one apparatus described above may be further divided into embodiments by a plurality of apparatuses.
The foregoing has described implementations of the present disclosure, and the above description is illustrative, not exhaustive, and is not limited to the disclosed implementations. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. The choice of terms used herein is intended to best explain the principles of the implementations, practical applications, or improvements to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the various implementations disclosed herein.

Claims (14)

1. A memory management method includes:
the method comprises the steps that the electronic equipment determines a first available memory of the electronic equipment;
if the first available memory is lower than a first set value, the electronic equipment determines the killed priority of each of the plurality of application programs at least based on the occupied memory of each of the plurality of application programs in the background state; and
the electronic device kills at least one of the plurality of applications based on the killed priority of each of the plurality of applications.
2. The method of claim 1, wherein determining the first available memory comprises:
the electronic device periodically determines the first available memory based on a first cycle; or,
and if the occupied memory is higher than the first set value after the application program in the state to be started is detected to be started, the electronic equipment determines the first available memory.
3. The method of claim 1 or 2, wherein the killed priority of each of the plurality of applications is further determined based on at least one of:
a position of each of the plurality of applications in a background application list, the position being determined based on a precedence order of each of the plurality of applications in a last switch from a foreground state to a background state,
the number of times each of the plurality of applications is used within a preset time period, or
A time consumption of each of the plurality of applications when launched;
the earlier the application program is switched from the foreground state to the background state last time, the fewer the used times in the preset time length, and the shorter the consumed time when the application program is started, the higher the killing priority is.
4. The method of claim 3, wherein the occupied memory, and at least one of the location in the list of background applications, the number of times used, and the elapsed time each have a preset weight when determining the killed priority of each of the plurality of applications.
5. The method of any of claims 1 to 4, further comprising:
the electronic equipment adds the relevant information of the killed at least one application program into an information list.
6. The method of claim 5, wherein the information related to the at least one application comprises information about at least one of: identification, memory occupation after startup, number of times of use within a preset time length, or time consumption when the device is started last time.
7. The method of claim 5 or 6, further comprising:
the electronic equipment determines a second available memory of the electronic equipment;
if the second available memory is higher than a second set value, the electronic equipment determines the starting priority of each application program in the information list at least based on the memory occupied by each application program in the information list after starting, wherein the second set value is higher than the first set value; and
and the electronic equipment starts one or more application programs in the information list in the background at least based on the starting priority of each application program.
8. The method of claim 7, wherein determining a second available memory comprises:
the electronic device periodically determines the second available memory based on a second period; or,
and if the exiting application program exists and the memory released by the exiting application program is higher than the first set value, the electronic equipment determines the second available memory.
9. The method of claim 7 or 8, wherein determining the launch priority comprises:
the electronic device determines the activation priority if the second available memory is higher than the second set point and at least one of:
the occupancy of the processor is below a first threshold,
the occupancy rate of the input/output bandwidth is lower than a second threshold value, or
The network bandwidth occupancy is below a third threshold.
10. The method of any of claims 7 to 9, wherein the launch priority of each application in the list of information is further determined based on at least one of:
a position of the respective application in the information list, the position in the information list being determined based on a precedence order in which the respective application is added to the information list from a background state,
the number of times of use of each application program in a preset time period, or
The time consumed when the respective application program was last started;
wherein the later the application is added to the information list, the more times it is used within a preset time period, and the longer it takes to start, the higher the start priority.
11. The method according to claim 10, wherein the occupied memory after booting, and at least one of the location in the information list, the number of times used, and the elapsed time when last booted respectively have a preset weight when determining the boot priority.
12. An electronic device comprising a processor and a memory, the memory having stored thereon instructions for execution by the processor, the instructions when executed by the processor causing the electronic device to implement the method of any of claims 1-11.
13. A computer-readable storage medium having stored thereon computer-executable instructions that, when executed by an electronic device, cause the electronic device to implement the method of any of claims 1-11.
14. A computer program product having computer-executable instructions embodied thereon that, when executed by a computer, cause the computer to implement the method of any one of claims 1 to 11.
CN202111161913.8A 2021-09-30 2021-09-30 Memory management method, electronic device, computer storage medium, and program product Pending CN115904686A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111161913.8A CN115904686A (en) 2021-09-30 2021-09-30 Memory management method, electronic device, computer storage medium, and program product
PCT/CN2022/112034 WO2023051056A1 (en) 2021-09-30 2022-08-12 Memory management method, electronic device, computer storage medium, and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111161913.8A CN115904686A (en) 2021-09-30 2021-09-30 Memory management method, electronic device, computer storage medium, and program product

Publications (1)

Publication Number Publication Date
CN115904686A true CN115904686A (en) 2023-04-04

Family

ID=85729484

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111161913.8A Pending CN115904686A (en) 2021-09-30 2021-09-30 Memory management method, electronic device, computer storage medium, and program product

Country Status (2)

Country Link
CN (1) CN115904686A (en)
WO (1) WO2023051056A1 (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2538327A1 (en) * 2011-06-16 2012-12-26 Samsung Electronics Co., Ltd. Adaptive Termination and Pre-Launching Policy for Improving Application Startup Time
CN106371913A (en) * 2015-07-21 2017-02-01 赤子城网络技术(北京)有限公司 Memory cleaning method and apparatus
CN109213539B (en) * 2016-09-27 2021-10-26 华为技术有限公司 Memory recovery method and device
CN109117256A (en) * 2018-07-12 2019-01-01 维沃移动通信有限公司 A kind of management method and terminal of background application
CN109614168A (en) * 2018-12-11 2019-04-12 深圳美图创新科技有限公司 Memory Optimize Method and device

Also Published As

Publication number Publication date
WO2023051056A1 (en) 2023-04-06

Similar Documents

Publication Publication Date Title
CN113542839B (en) Screen projection method of electronic equipment and electronic equipment
CN111182614B (en) Method and device for establishing network connection and electronic equipment
CN111913750B (en) Application program management method, device and equipment
WO2021036898A1 (en) Application activation method for apparatus having foldable screen, and related device
CN114125130B (en) Method for controlling communication service state, terminal device and readable storage medium
CN111371849A (en) Data processing method and electronic equipment
CN112527476A (en) Resource scheduling method and electronic equipment
CN113254409A (en) File sharing method, system and related equipment
CN112445276A (en) Folding screen display application method and electronic equipment
CN114625525A (en) Resource control method and equipment
CN111078376A (en) Process management method and device
CN114840280A (en) Display method and electronic equipment
CN114077519B (en) System service recovery method and device and electronic equipment
CN113596919A (en) Data downloading method and device and terminal equipment
CN113438366B (en) Information notification interaction method, electronic device and storage medium
CN113760191B (en) Data reading method, data reading apparatus, storage medium, and program product
CN112532508A (en) Video communication method and video communication device
CN113805771B (en) Notification reminding method, terminal equipment and computer readable storage medium
WO2023051056A1 (en) Memory management method, electronic device, computer storage medium, and program product
CN113467821A (en) Application program repairing method, device, equipment and readable storage medium
CN114828098A (en) Data transmission method and electronic equipment
CN112346831A (en) Method and device for managing abnormal application
CN110737916A (en) Communication terminal and processing method
CN113886060B (en) Method and device for compressing memory
CN116700660B (en) Audio playing method and electronic equipment

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