Process release method and electronic equipment
By determining the memory release method based on the processor load and the foreground application type, and adopting serial or parallel release method, the problem of excessive memory usage caused by background process residency is solved, the impact on the performance of the foreground application is reduced, and the system performance and user experience are improved.
Patent Information
- Application Number
- CN202311240078.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-22
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2043-09-22
AI Technical Summary
In electronic devices, the residency of background processes leads to excessive memory usage, affecting system performance, and traditional process release methods may have a negative impact on the performance of foreground applications.
By determining the memory release method based on the processor load and the type of foreground application, and using serial release method or parallel release method, to reduce the performance impact of process release operations on the foreground application.
It effectively reduces the impact of process release operations on the performance of the foreground application, improves user experience, and improves the overall performance of the system.
Smart Images

Figure CN119739489A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of terminal technology, and in particular, relates to a process release method and electronic device. Background Art
[0002] With the development of intelligent electronic devices, users can install various applications in electronic devices to meet their daily life and work needs.
[0003] When a user uses an electronic device, many processes of used applications will be kept in the background, resulting in a large amount of memory being occupied. By releasing background processes, the size of available memory can be increased. Summary of the invention
[0004] The embodiments of the present application provide a process release method and an electronic device, which can reduce the impact of the process release operation on the performance of the foreground application.
[0005] In a first aspect, a process release method is provided, the method being applied to an electronic device, or to a processor or other module in the electronic device, the method comprising:
[0006] A memory release method is determined according to the load of a processor in the electronic device and / or the type of foreground application, wherein the memory release method includes a serial release method or a parallel release method; and multiple background processes in the electronic device are released according to the memory release method.
[0007] In the above scheme, different memory release methods can be selected to release background processes according to the current scenario (i.e., different load conditions, and / or different types of foreground applications) to reduce the impact of the process release operation on the performance of the foreground application. Because the process of releasing the process needs to be scheduled by the processor, if a fixed method is used to release the background process in different scenarios, in some scenarios, the processor load may be impacted by the operation of releasing the process, thereby affecting the performance of the foreground application. For example, if there are many processes to be released, releasing these processes at the same time may cause a surge in the processor load, causing the processor's response speed to slow down, and the performance of the foreground application will also be affected. For example, the frame rate of the foreground application may fluctuate violently in a short period of time, which will greatly affect the user experience.
[0008] In the solution provided in the present application, the memory release method can be determined based on the processor load and / or the type of foreground application. Therefore, in scenarios where the performance of some foreground applications may be affected by the release process operation, a serial release method can be adopted. Based on the serial release method, multiple background processes can be released one by one. This brings much less load pressure to the processor than releasing multiple background processes at the same time. Therefore, it will not have much impact on the performance of the foreground application, thereby improving the user experience; and in scenarios where the performance of some foreground applications is not easily affected by the release process operation, a parallel release method can be adopted. Based on the parallel release method, multiple background processes can be released at the same time, thereby shortening the time occupied by process release, allowing the system to reclaim memory space as soon as possible, thereby improving the overall performance of the system.
[0009] As an example, the electronic device is currently in a screen-on state.
[0010] That is to say, in one example, the process release method provided by the embodiment of the present application can be applied to a screen-on scenario. At this time, the display screen of the electronic device is displaying the interface of the foreground application, that is, the user is using the foreground application. At this time, the solution provided by the embodiment of the present application can be adopted to reduce the impact of the process release operation on the performance of the foreground application, so as to minimize the impact on the user's experience of using the foreground application.
[0011] If a release operation is required in the screen-off state, the solution provided in the present application may be used or not. For example, in the screen-off state, a fixed memory release method (such as a parallel release method) may be used to release background processes. In this way, there is no need to obtain the above-mentioned load and / or foreground application type information, nor is there a need to determine the memory release method process, thereby reducing resource consumption and improving the efficiency of process release.
[0012] As an example, when the determined memory release mode is a serial release mode, releasing multiple background processes in the electronic device according to the memory release mode includes: releasing the multiple background processes one by one in the same memory release agent process.
[0013] Based on the above scheme, when releasing multiple background processes in series, all the background processes to be released can be released in the same memory release proxy process, for example, the multiple background processes are put into a queue and released one by one in a memory release proxy process. Since a proxy process can only release one process at a time, the release times of the multiple background processes will not overlap. Therefore, this implementation method can complete the operation of serially releasing processes without complicated timing control, which can improve the efficiency of process release.
[0014] As an example, before releasing multiple background processes one by one in the same memory release proxy process, the method further includes: waking up the memory release proxy process in a dormant state, where the memory release proxy process is a pre-established process.
[0015] Based on the above scheme, in a scenario where multiple background processes are released serially in a memory release agent process, a memory release agent process can be established in advance and put into a dormant state. After determining to perform a serial release, the dormant memory release agent process is awakened, and then the multiple background processes are released in sequence in the memory release agent process. In this way, the memory release agent process can be directly awakened and used to improve the efficiency of process release.
[0016] As an example, before releasing multiple background processes one by one in the same memory release proxy process, the method further includes: creating a memory release proxy process.
[0017] Based on the above scheme, in the scenario where multiple background processes are serially released in a memory release proxy process, the memory release proxy process can be temporarily created when it is determined to perform serial release, and after the creation is completed, the multiple background processes are sequentially released in the memory release proxy process, and after the release is completed, the memory release proxy process can be cleared. In this way, it is not necessary to maintain the memory release proxy process all the time, thereby reducing memory usage.
[0018] As an example, the processor is a multi-core processor, and the method further includes: binding the memory release agent process to a small core or a medium core of the processor.
[0019] For example, for a multi-core processor, the large core has the strongest main frequency capability and is usually used to process tasks with relatively high performance requirements. If the memory release agent process is bound to the large core of the processor, there is a high probability that the load of the large core will be impacted. If the memory release agent process is bound to the small or medium core of the processor, the impact of the process release operation on the processor load can be minimized, thereby reducing the impact on the performance of the foreground application.
[0020] As an example, when the determined memory release mode is a serial release mode, releasing multiple background processes in the electronic device according to the memory release mode includes: releasing the multiple background processes one by one in sequence according to a preset rule.
[0021] As an example, the preset rule includes: releasing multiple background processes in order from large to small occupied loads.
[0022] In the above scheme, the multiple background processes can be released in order from the largest to the smallest occupancy load. That is, the background process with the largest occupancy load is released first, and then the background process with the smallest occupancy load is released. By releasing the process with the largest occupancy load first, the system load can be reduced as soon as possible and the system performance can be improved.
[0023] As an example, the preset rule includes: releasing the multiple background processes in sequence according to the usage frequencies of the applications corresponding to the multiple background processes from low to high.
[0024] In the above scheme, the multiple background processes are released in order from low to high usage frequencies of the applications corresponding to the multiple background processes. That is, the processes of applications with low usage frequencies are released first, and then the processes of applications with high usage frequencies are released. By releasing the processes of applications with low usage frequencies first, the processes of applications with high usage frequencies can be retained as much as possible, so that when the user reopens the applications with these retained processes, the application loading speed can be improved.
[0025] As an example, determining the memory release mode according to the processor load includes: if the processor load is greater than or equal to a preset threshold, determining the memory release mode to be a serial release mode.
[0026] For example, if the processor load is greater than or equal to the preset threshold, it means that the processor load is relatively large, and the process of releasing the process needs to be scheduled by the processor. Therefore, if the background process is released in a parallel release mode, it may cause an impact on the processor load. For example, if there are many background processes to be cleaned up, cleaning these background processes at the same time will cause the processor performance to further decline, and the performance of the foreground application will also be affected. Releasing the background process in a serial release mode can reduce the impact of the released process on the processor performance, because releasing the background processes one by one will bring much less load pressure to the processor than releasing multiple background processes at the same time.
[0027] As an example, determining the memory release mode according to the processor load includes: if the processor load is less than a preset threshold, determining the memory release mode to be a parallel release mode.
[0028] For example, if the processor load is less than a preset threshold, it means that the processor load is relatively small, so even if the parallel release method is used to release the background process at this time, it will not cause processor overload. At the same time, using a parallel release method instead of a serial release method can shorten the time occupied by the process release, so that the system can reclaim memory space as soon as possible and improve the overall performance of the system.
[0029] As an example, determining the memory release mode according to the type of the foreground application includes: if the foreground application is a load-sensitive application, determining the memory release mode to be a serial release mode.
[0030] The performance of the load-sensitive application is affected by the load of the processor to a degree higher than a preset level.
[0031] For example, if the foreground application is a load-sensitive application, the performance of the foreground application is easily affected by load changes. If the background process is released in parallel, the processor load may increase, which further affects the performance of the foreground application, such as causing the foreground application to drop frames. Releasing the background process in serial release can reduce the impact of the released process on the processing load, and further reduce the impact on the performance of the foreground application, so as to keep the foreground application running stably as much as possible.
[0032] As an example, determining the memory release mode according to the type of the foreground application includes: if the foreground application is not a load-sensitive application, determining the memory release mode to be a parallel release mode.
[0033] Among them, the performance of load-sensitive applications is affected by the load to a greater extent than the preset level.
[0034] For example, if the foreground application is not a load-sensitive application (such as a photo album application, a financial application, etc.), it means that the performance of the foreground application is not easily affected by load changes. At this time, even if the parallel release method is used to release the background process, which causes the processor load to increase, it will basically not affect the performance of the foreground application. At the same time, using the parallel release method instead of the serial release method can also shorten the time taken by the process release, so that the system can reclaim memory space as soon as possible, improving the overall performance of the system.
[0035] As an example, determining the memory release mode according to the processor load and the type of foreground application includes: if the processor load is less than a preset threshold and the foreground application is a load-sensitive application, determining the memory release mode to be a serial release mode.
[0036] Among them, the performance of load-sensitive applications is affected by the load to a greater extent than the preset level.
[0037] For example, if the load of the processor is less than a preset threshold, and the foreground application is a load-sensitive application, the memory release method is determined to be the serial release method. Specifically, if the load of the processor is less than the preset threshold, it means that the load of the processor is relatively small, but because the foreground application is a load-sensitive application, if the background process is released in a parallel release mode, even if the current load of the processor is relatively small, it may be affected by the process release operation, resulting in an increase in load, which may affect the performance of the foreground application. Therefore, the serial release mode can be used to release the background process to reduce the impact of the process release on the processor load, thereby reducing the impact on the performance of the foreground application.
[0038] As an example, determining the memory release mode according to the processor load and the type of foreground application includes: if the processor load is less than a preset threshold and the foreground application is not a load-sensitive application, determining the memory release mode to be a parallel release mode.
[0039] Among them, the performance of load-sensitive applications is affected by the load to a greater extent than the preset level.
[0040] For example, if the processor load is less than a preset threshold, it means that the processor load is relatively small. Therefore, even if the background process is released in a parallel release manner, resulting in an increase in load, it will not cause processor overload. Moreover, since the foreground application is not a load-sensitive application, even if the load increases, it will basically not affect the performance of the foreground application. At the same time, it can also improve the efficiency of memory recovery and improve the overall performance of the system.
[0041] As an example, determining the memory release mode according to the processor load and the type of foreground application includes: if the processor load is greater than or equal to a preset threshold, and the foreground application is a load-sensitive application or the foreground application is not a load-sensitive application, determining the memory release mode to be a serial release mode.
[0042] Among them, the performance of load-sensitive applications is affected by the load to a greater extent than the preset level.
[0043] For example, if the processor load is greater than or equal to a preset threshold, it means that the processor load is relatively large. At this time, if the background process is released in a parallel release mode, it may cause an impact on the processor load, causing the processor to be overloaded, thereby affecting the performance of the foreground application. Releasing the background process in a serial release mode can reduce the impact of the released process on the processor performance.
[0044] As an example, the method further includes: if the foreground application is a media application, determining that the foreground application is a load-sensitive application, the media application is an application for taking pictures, or an application for taking or displaying video images.
[0045] Based on the above scheme, it is possible to determine whether the foreground application is a load-sensitive application based on the type of the foreground application, so that the memory release method to be adopted can be further determined based on the judgment result. Specifically, the type of load-sensitive application can be pre-configured. For example, a media application can be set as a load-sensitive application. The media application is an application for taking pictures (such as a camera application), or an application for taking or displaying video images (such as a video application, a game application, a video application, a live broadcast application, etc.). Therefore, before determining the memory release method, the type of the foreground application can be determined first. If the type of the foreground application is a media application, the foreground application is determined to be a load-sensitive application.
[0046] As an example, the method further includes: reading classification information of the foreground application through an interface of the foreground application; and determining the type of the foreground application based on the classification information.
[0047] Exemplarily, the electronic device can read the classification information of the foreground application through the interface of the foreground application, and then determine the type of the foreground application based on the classification information. The classification information here refers to information indicating the type of the foreground application determined based on a preset classification rule, and the type of the foreground application indicated by the classification information is, for example, any one or more of the following: games, videos, music, social networking, photography, finance, etc.
[0048] As an example, before determining the memory release method according to the load of the processor in the electronic device and / or the type of the foreground application, the method further includes: determining to release multiple background processes.
[0049] In a second aspect, a process release method and an electronic device are provided. The method is applied to an electronic device, or to a processor or other module in an electronic device. The method includes: determining a memory release method based on the load of the processor in the electronic device and / or the load sensitivity of a foreground application, the load sensitivity of the foreground application being used to indicate the extent to which the performance of the foreground application is affected by the processor load, the memory release method including a parallel release method or a serial release method; and releasing multiple background processes in the electronic device according to the memory release method.
[0050] According to a third aspect, an electronic device is provided, which includes a memory release mode decision module for determining a memory release mode according to a processor load and / or a foreground application type in the electronic device, wherein the memory release mode includes a serial release mode or a parallel release mode.
[0051] A memory release control module is used to release multiple background processes in the electronic device according to the memory release method.
[0052] As an example, the electronic device further includes a policy notification module, which is used to receive the memory release mode from the memory release mode decision module, and send the memory release mode to the memory release control module.
[0053] In a fourth aspect, an electronic device is provided, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the electronic device implements the steps of the application display method as described in any one of the above-mentioned first aspects.
[0054] In a fifth aspect, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the steps of the application display method as described in any one of the above-mentioned first aspects are implemented.
[0055] In a sixth aspect, a computer program product is provided. When the computer program product is run on an electronic device, the electronic device executes the application display method described in any one of the first aspects above.
[0056] In a seventh aspect, a chip system is provided, which includes a processor coupled to a memory, and the processor executes a computer program stored in the memory to implement the application display method described in any one of the first aspects above.
[0057] The chip system may be a single chip or a chip module composed of multiple chips.
[0058] It can be understood that the beneficial effects of the second to seventh aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 An exemplary flow chart of releasing a background process provided by an embodiment of the present application is shown;
[0060] Figure 2 An application scenario diagram of the present application solution is shown;
[0061] Figure 3 A schematic diagram showing the frame rate change of the foreground application;
[0062] Figure 4 An exemplary flow chart of releasing a background process provided by an embodiment of the present application is shown;
[0063] Figure 5 Another application scenario diagram of the present application solution is shown;
[0064] Figure 6 A graph showing the change in the start-up time of a foreground application is shown;
[0065] Figure 7 An exemplary flow chart of a process release method provided in an embodiment of the present application is shown;
[0066] Figure 8 An exemplary block diagram of a process release method provided in an embodiment of the present application is shown;
[0067] Fig. 9 Another exemplary flow chart of the process release method provided in an embodiment of the present application is shown;
[0068] Fig.10 A structural block diagram of an electronic device provided in an embodiment of the present application is shown;
[0069] Fig.11 A block diagram of a software system of an electronic device provided in an embodiment of the present application is shown;
[0070] Fig.12 A schematic diagram of a workflow for releasing a background process during the startup and use of a camera application in an electronic device provided by an embodiment of the present application is shown;
[0071] Fig.13 An exemplary interaction diagram of releasing a background process during the startup and use of a camera application by an electronic device provided by an embodiment of the present application is shown;
[0072] Fig.14 Another structural block diagram of an electronic device provided in an embodiment of the present application is shown;
[0073] Fig.15 A block diagram of a hardware system of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0074] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0075] The terms "first", "second", "third", "fourth" and other various terminology and numbers (if any) in the specification and claims of this application and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or quantity. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein.
[0076] It is understood that the various numbers involved in this application are only used for the convenience of description and are not used to limit the scope of this application. The size of the sequence number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic.
[0077] The terms "including" and "having" and any variations thereof mean "including but not limited to" unless specifically emphasized otherwise. For example, a process, method, system, product or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed but may include other steps or units not explicitly listed or inherent to such process, method, product or apparatus.
[0078] In the embodiments of the present application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0079] In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In the description of the present application, unless otherwise specified, "multiple" means two or more.
[0080] In the various embodiments of the present application, if there is no special explanation and logical conflict, the terms and / or descriptions between different embodiments are consistent and can be referenced to each other, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationships. The specific operating methods in the method embodiments of the present application can also be applied to device embodiments or system embodiments.
[0081] In the present application, "pre-configuration" may include pre-definition, for example, protocol definition. Among them, "pre-definition" may be implemented by pre-saving corresponding codes, tables or other methods that can be used to indicate relevant information in a device (for example, including each network element), and the present application does not limit the specific implementation method.
[0082] The "storage" or "saving" involved in the embodiments of the present application may refer to saving in one or more memories. The one or more memories may be set separately or integrated in an encoder or decoder, a processor, or an electronic device. The one or more memories may also be partially set separately and partially integrated in a decoder, a processor, or an electronic device. The type of memory may be any form of storage medium, which is not limited by the present application.
[0083] In the schematic diagrams of the drawings in the specification of this application, the dashed lines or boxes represent optional steps or optional modules, and the dotted lines or boxes represent the contents of the annotations.
[0084] In order to more clearly and concisely describe the following embodiments provided in the present application, some of the terms or technologies involved in the embodiments of the present application are first briefly introduced.
[0085] 1. Foreground application: The foreground application described in the embodiments of the present application refers to the application currently running in the foreground of the electronic device.
[0086] For example, when a user clicks on the icon of a game application on the system desktop of an electronic device, the electronic device will load and display the application interface of the game application on the display screen. Before the user closes the game application or switches the game application to the background, the game application is the foreground application of the electronic device.
[0087] It can be understood that the foreground application described in the embodiments of the present application may also refer to an application that runs in the background but can be perceived by the user in the foreground, for example, an input method being called by the user, music or video software playing sound in the background, a social or news application that appears through a pop-up window in the notification bar in the foreground, etc.
[0088] It can also be understood that the foreground application described in the embodiments of the present application may include system applications, such as system desktop applications, artificial intelligence assistants that appear in the foreground through floating windows, etc., system negative one screen, etc.
[0089] 2. Background application: The background application described in the embodiments of the present application refers to an application running in the background. Specifically, it may refer to an application that is switched from the foreground to the background by the user and the process is retained in the background.
[0090] For example, when a user clicks on the icon of a game application on the system desktop of an electronic device, the electronic device will load and display the application interface of the game application on the display screen. When the user returns to the desktop or switches to other applications from the application interface of the game application (without releasing the process of the game application), the game application is the background application of the electronic device.
[0091] It is understandable that the background application described in the embodiment of the present application may also include applications that continue to run in the background but are not perceived by the user, such as wireless fidelity (WiFi), Bluetooth, etc.
[0092] 3. Background process: The process of background application can be called background process.
[0093] It is understood that an application may include one or more processes.
[0094] It is also understandable that when a user releases a background process, he or she usually does not release all background processes, but releases some or all of the background processes that can be released. The processes that can be released refer to the processes of background applications that are not used by the user and do not affect the functions of the electronic device, and do not include the processes of system-level applications running in the background (such as background download processes, background positioning processes, etc.) and the processes of applications that are still providing services to the user (such as alarm clocks, timers, navigation applications, etc. running in the background).
[0095] It can also be understood that in the embodiment of the present application, releasing the background process refers to the operation of terminating or clearing the background process, so releasing the background process can also be called terminating the background process, or clearing the background process, or cleaning up the background process, or "killing" the background process, etc. By releasing the background process, the memory occupied by the background process can be reclaimed.
[0096] 4. Frame rate: Frame rate refers to the frequency at which images in frames appear continuously on the display, that is, the number of frames displayed on the screen per second. The unit of frame rate is the number of frames per second (fps). Generally, frame rate represents the smoothness of the video. The higher the frame rate value, the better the video smoothness.
[0097] 5. Processor: The processor is the computing and control core of an electronic device, and is mainly used to realize information processing and program execution. The processor in the embodiment of the present application is, for example, a central processing unit (CPU) in an electronic device.
[0098] In order to improve the processing speed and performance of the processor, a multi-core processor can be used in an electronic device. The processor may include a large core, a medium core, and a small core. The large core has higher computing power than the medium core, but also consumes more power. Similarly, the medium core has higher computing power than the small core, but also consumes more power. A multi-core processor may include multiple types of large cores, medium cores, and small cores.
[0099] As mentioned in the background technology section, when a user uses an electronic device, many processes of used applications will be kept in the background, resulting in a large amount of memory being occupied, which may cause insufficient system memory space or system freezes. In order to avoid the continuous accumulation of processes resident in the background, background processes can be released according to preset rules to ensure that the system has enough available memory. Figures 1 to 6 Two possible implementation methods of releasing a background process provided in the embodiments of the present application are introduced.
[0100] Figure 1An exemplary flow chart of the first possible implementation is shown. Exemplarily, after the background application enters the cache state, the state time monitoring is performed, that is, the time when the background application enters the cache state is monitored. When the time when the background application enters the cache state is greater than a preset threshold, a memory recovery operation is performed, for example, triggering an Android native cleanup operation to release the process of the background application. The specific process is not limited in this application.
[0101] Figure 2 Shows Figure 1 A practical application scenario of the solution shown in FIG. Figure 2 As shown in the figure, the user is currently playing a racing game on the electronic device. At this time, if the time a background application enters the cache state exceeds the preset threshold, the system will release the process of the background application in the background. An application may include multiple processes, so all of them need to be released. In the process of releasing these multiple processes, the performance of the current game application may be affected, for example, the frame rate of the current game may fluctuate. Figure 3 For example, assuming that the frame rate of the above-mentioned racing game application is 90fps during stable operation, the system starts to release multiple background processes at time t1 and ends at time t2. As shown in the figure, affected by the process release operation, the frame rate of the racing game application fluctuates irregularly, causing the game interface to have a freeze that is perceptible to the user's naked eye, reducing the user experience.
[0102] Figure 4 An exemplary flow chart of a second possible implementation is shown. Exemplarily, after the electronic device receives the operation of the user clicking the application icon, in response to the operation, the electronic device starts the application at the application layer (which can be understood as pulling up the process of the application). Then, the application sends a memory application request to the kernel to apply for memory, and the memory application request carries information for indicating the size of the memory space applied for by the application. It can be understood that the memory applied for by the application is used to run the process of the application. Further, after the kernel receives the memory application request, it monitors the remaining memory space, that is, determines whether the remaining memory space is less than the memory space applied for by the above application. In the case where the remaining memory space is less than the memory space applied for by the application, the kernel reclaims the memory. For example, the kernel performs a clearing operation on one or more background processes until the remaining memory space is greater than or equal to the memory space applied for by the application. It can be understood that the kernel can directly clear all background processes, or only clear some of the background processes according to preset rules, which is not limited in this application. When the remaining memory space is greater than or equal to the memory space requested by the application after the memory recycling operation, the kernel can allocate memory space to the application to provide memory space for application startup, so that the mail application can be successfully started.
[0103] Figure 5 Shows Figure 4 A practical application scenario of the solution shown in FIG. Figure 5 As shown in (a) in the figure, the user clicks the icon of the camera application on the system desktop. In order to successfully start, the camera application will request memory from the kernel. If there is insufficient memory space at this time, the system will release some or all background processes so that there is enough space to allocate to the camera application. After the camera application obtains enough space, it can successfully open the startup interface, as shown in Figure 5 As shown in (b) in the figure. When the camera application is started, it often requests a large amount of memory space. Therefore, it is usually necessary to clear a large number of background processes to meet the memory requirements of the camera application. However, when a large number of background processes are released, the startup time of the camera application may be prolonged. Figure 6 For example, assuming that the camera application starts up in 200ms with sufficient memory, Figure 6 The startup time of the first and second launch of the camera application. Assume that the system has insufficient remaining space when the camera application is launched for the third time. At this time, multiple background processes need to be released so that the camera application can obtain sufficient memory space. Figure 6 As shown in the figure, due to the process release operation, the startup time of the third camera application has increased significantly, reaching 500ms. At this time, the user may feel that the camera application is stuck when starting, which reduces the user experience. On the other hand, the performance of the camera application may also be affected, for example, the photo page may be stuck.
[0104] In summary, in the process of releasing background processes, the performance of foreground applications may be affected, thereby deteriorating the user experience.
[0105] Based on this, the present application embodiment provides a process release method, and an exemplary flow chart of the method is as follows: Figure 7 As shown. Figure 7 As shown, the method can determine whether the memory release mode is a serial release mode or a parallel release mode according to the processor load and / or the performance of the foreground application. By using the serial release mode to release the background process in the scenario where the release process may affect the performance of the foreground application, it can prevent the simultaneous release of multiple background processes from causing an increase in the processor load, thereby affecting the performance of the foreground application. Figure 8The process release method 100 provided in the present application is exemplified. It is understandable that the method 100 can be applied to electronic devices, such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA), etc. The embodiments of the present application do not impose any restrictions on the specific types of electronic devices.
[0106] S110, determining a memory release method according to a processor load and / or a type of a foreground application in the electronic device.
[0107] Exemplarily, the electronic device determines the memory release mode according to the processor load and / or the type of the foreground application. The memory release mode is used to indicate the mode of releasing the memory, or in other words, the memory release mode is used to indicate the mode of releasing the background process, therefore, the memory release mode can also be called the process release mode, or the process cleanup mode, etc.
[0108] As an exemplary application scenario, the current electronic device is in a screen-on state.
[0109] The memory release method in the embodiment of the present application includes a serial release method or a parallel release method. Among them, the serial release method refers to a method of releasing background processes in sequence to recycle memory, that is, releasing multiple background processes one by one (or two by two, or three by three, etc.) to recycle memory; the parallel release method refers to a method of releasing background processes in parallel to recycle memory, that is, releasing multiple background processes in parallel in their respective processes to recycle memory. In one implementation method, the parallel release method refers to a method of releasing multiple background processes at the same time to recycle memory.
[0110] In one example, when it is determined to release multiple background processes, the memory release method is determined according to the processor load and / or the type of the foreground application. This application does not limit the specific method for determining the release of the background process. As an example, the following method can be used: Figure 1 or Figure 4 The solution shown determines the release of background processes, which is not limited here.
[0111] The following is an exemplary description of a specific implementation method for determining a memory release method.
[0112] In a first possible implementation, the memory release method is determined according to the load of the processor, as illustrated below by an example.
[0113] For example, if the load of the processor is greater than or equal to a preset threshold, the memory release method is determined to be a serial release method. Specifically, if the load of the processor is greater than or equal to the preset threshold, it means that the load of the processor is relatively large, and the process of releasing the process needs to be scheduled by the processor. Therefore, if the background process is released in a parallel release mode at this time, it may cause an impact on the processor load. For example, if there are many background processes to be cleaned up, cleaning these background processes at the same time will cause the processor performance to further decline, and the performance of the foreground application will also be affected. Releasing the background process in a serial release mode can reduce the impact of the released process on the processor performance, because releasing the background processes one by one puts much less load pressure on the processor than releasing multiple background processes at the same time.
[0114] For another example, if the processor load is less than a preset threshold, the memory release method is determined to be the parallel release method. Specifically, if the processor load is less than the preset threshold, it means that the processor load is relatively small, so even if the parallel release method is used to release the background process, it will not cause processor overload. At the same time, the parallel release method rather than the serial release method can shorten the time taken by the process release, so that the system can reclaim the memory space as soon as possible, thereby improving the overall performance of the system.
[0115] In a second possible implementation, the memory release method is determined according to the type of the foreground application, as illustrated below.
[0116] For example, if the foreground application is a load-sensitive application, the memory release method is determined to be the serial release method, wherein the performance of the load-sensitive application is affected by the processor load to a higher degree than the preset level, that is, the performance of the load-sensitive application is susceptible to changes in the processor load, or in other words, if the processor load is too large (such as exceeding a certain threshold), it will affect the performance of the load-sensitive application (such as the frame rate of the application). Specifically, if the foreground application is a load-sensitive application, it means that the performance of the foreground application is susceptible to changes in the load. If the background process is released in a parallel release mode at this time, the processor load may increase, thereby further affecting the performance of the foreground application, such as causing the foreground application to lose frames. Releasing the background process in a serial release mode can reduce the impact of the released process on the processing load, and further reduce the impact on the performance of the foreground application, and try to keep the foreground application running stably.
[0117] In one implementation, the type of load-sensitive application can be preconfigured. For example, a media application can be set as a load-sensitive application. The media application is an application for taking pictures (such as a camera application) or an application for taking or displaying video images (such as a video application, a game application, a video application, a live broadcast application, etc.). Therefore, before determining the memory release method, the type of the foreground application can be determined first. If the type of the foreground application is a media application, the foreground application is determined to be a load-sensitive application.
[0118] It is understandable that the present application does not limit the specific implementation method of the electronic device determining the type of the foreground application. As an example, the electronic device can read the classification information of the foreground application through the interface of the foreground application, and then determine the type of the foreground application based on the classification information. The classification information here refers to the information used to indicate the type of the foreground application determined based on the preset classification rules. The type of the foreground application indicated by the classification information is, for example, any one or more of the following: games, videos, music, social networking, video photography, finance, etc.
[0119] For another example, if the foreground application is not a load-sensitive application, the memory release method is determined to be the parallel release method. Specifically, if the foreground application is not a load-sensitive application (such as a photo album application, a financial application, etc.), it means that the performance of the foreground application is not easily affected by load changes. At this time, even if the parallel release method is used to release the background process, resulting in an increase in the processor load, it will basically not affect the performance of the foreground application. At the same time, using the parallel release method instead of the serial release method can also shorten the time occupied by the process release, so that the system can reclaim the memory space as soon as possible, improving the overall performance of the system.
[0120] In a third possible implementation, the memory release method is determined according to the processor load and the type of the foreground application. It is understandable that in this implementation, the processor load may be determined first, and then the foreground application type may be determined, or the foreground application type may be determined first, and then the processor load may be determined, and this application does not limit this. The following is an example.
[0121] For example, if the load of the processor is less than a preset threshold, and the foreground application is a load-sensitive application, the memory release method is determined to be the serial release method. Specifically, if the load of the processor is less than the preset threshold, it means that the load of the processor is relatively small, but because the foreground application is a load-sensitive application, if the background process is released in a parallel release mode, even if the current load of the processor is relatively small, it may be affected by the process release operation, resulting in an increase in load, which may affect the performance of the foreground application. Therefore, the serial release mode can be used to release the background process to reduce the impact of the process release on the processor load, thereby reducing the impact on the performance of the foreground application.
[0122] For another example, if the load of the processor is less than the preset threshold, and the foreground application is not a load-sensitive application, the memory release method is determined to be a parallel release method. Specifically, if the load of the processor is less than the preset threshold, it means that the load of the processor is relatively small, so even if the parallel release method is used to release the background process and the load increases, it will not cause the processor to be overloaded, and because the foreground application is not a load-sensitive application, even if the load increases, it will basically not affect the performance of the foreground application, and at the same time, it can also improve the efficiency of memory recovery and improve the overall performance of the system.
[0123] For another example, if the load of the processor is greater than or equal to a preset threshold, and the foreground application is a load-sensitive application or the foreground application is not a load-sensitive application, then the memory release method is determined to be a serial release method. Specifically, if the load of the processor is greater than or equal to the preset threshold, it means that the load of the processor is relatively large. At this time, if the background process is released in a parallel release mode, it may cause an impact on the processor load, causing the processor to be overloaded, thereby affecting the performance of the foreground application. Releasing the background process in a serial release mode can reduce the impact of the released process on the processor performance.
[0124] In summary, in the above three examples, if the processor load is greater than or equal to the preset threshold, the serial release method is adopted regardless of whether the foreground application is load-sensitive for business purposes; if the foreground application is a load-sensitive application, the serial release method is adopted regardless of whether the processor load is greater than the preset threshold; only when the processor load is less than the preset threshold and the foreground application is a load-sensitive application, the parallel release method is adopted.
[0125] Therefore, if the processor load is determined first, then when the processor load is greater than or equal to the preset threshold, the type of the foreground application can be determined and the serial release method can be used directly; if the type of the foreground application is determined first, then when the foreground application is a load-sensitive application, the processor load can be determined and the serial release method can be used directly. This method can reduce power consumption, save resources, and improve the efficiency of memory recycling.
[0126] S120: releasing a plurality of background processes in the electronic device according to the memory release method.
[0127] Exemplarily, after determining the memory release method, multiple background processes are released according to the memory release method. It is understandable that these multiple background processes may be some or all of the background processes in the electronic device, and this application does not limit how the number of these multiple background processes is determined. Exemplarily, one way is to determine the number of background processes to be released according to the size of the memory applied for by the foreground application, and another way is to determine the number of background processes to be released according to the system's native cleanup rules. The specific implementation method of releasing the background process is exemplified below.
[0128] Example 1: When the memory release mode is determined to be a parallel release mode, each background process releases the memory in its own process. The specific process is not limited in this application.
[0129] Example 2: When the memory release mode is determined to be serial release mode, multiple background processes are released in sequence.
[0130] In the first implementation, these multiple background processes are still released in their respective processes, but the release time of each process is not overlapped through timing control. This implementation does not require the introduction of additional proxy processes and can reduce resource waste to a certain extent.
[0131] In the second implementation, the multiple background processes are released one by one in the same memory release proxy process, that is to say, all background processes are released in the same memory release proxy process, for example, the multiple background processes are put into a queue and released one by one in a memory release proxy process. Since one proxy process can only release one process at a time, the release times of these multiple background processes will not overlap, so this implementation does not require cumbersome timing control and can complete the operation of serial release process. Wherein, the memory release proxy process can be one of the above-mentioned multiple processes, or it can be a process other than the multiple processes. The second situation is illustrated below.
[0132] For example, a memory release agent process can be established in advance and put into a dormant state. After determining to perform serial release, the dormant memory release agent process is awakened, and then the multiple background processes are released in sequence in the memory release agent process. In this way, the memory release agent process can be directly awakened and used to improve the efficiency of process release.
[0133] For another specific example, when it is determined to release serially, the memory release proxy process can be temporarily created, and after the creation is completed, the multiple background processes are sequentially released in the memory release proxy process, and after the release is completed, the memory release proxy process can be cleared. In this way, it is not necessary to maintain the memory release proxy process all the time, thereby reducing memory usage.
[0134] Optionally, in a possible implementation, when it is determined that the memory release mode is a serial release mode, the memory release proxy process can be bound to the small core or the medium core of the processor. Specifically, for a multi-core processor, the main frequency capability of the large core is the strongest, and it is usually used to process tasks with relatively high performance requirements. If the memory release proxy process is bound to the large core of the processor, there is a high probability that the load of the large core will be impacted. If the memory release proxy process is bound to the small core or the medium core of the processor, the impact of the process release operation on the processor load can be minimized.
[0135] Optionally, in a possible implementation, when it is determined that the memory release mode is a serial release mode, the multiple background processes can be cleared one by one in order according to preset rules. For example, the multiple background processes can be released in order from large to small occupied loads. That is to say, the background processes with large occupied loads are released first, and then the background processes with small occupied loads are released. By giving priority to releasing the processes with large loads, the system load can be reduced as soon as possible and the system performance can be improved. For another example, the multiple background processes can be released in order from low to high usage frequencies of the applications corresponding to the multiple background processes. That is to say, the processes of applications with low usage frequencies are released first, and then the processes of applications with high usage frequencies are released. By giving priority to releasing the processes of applications with low usage frequencies, the processes of applications with high user usage frequencies can be retained as much as possible, so that when the user reopens the applications of these retained processes, the application loading speed can be increased.
[0136] Combine the following Fig. 9 The specific process of the process release method shown in the above method 100 is exemplified. Fig. 9As shown, the system is based on the current scene (such as the video live broadcast scene, video editing scene, game scene, etc. in the figure), processor load, process release monitoring execution scene and system status monitoring and decision-making. Specifically, the current scene can be identified based on the type of foreground application (i.e., identifying whether the foreground application is a load-sensitive application), based on the processor load, judging whether the load is greater than or equal to the preset threshold, and based on empty cleaning, or memory application, or power consumption / heat cleaning and other scenes, determining whether to perform process cleaning, and then comprehensively determining the memory release method based on the above information. For specific solutions, please refer to the description of S110 in method 100, which will not be repeated here. Further, the memory release method is written into the kernel control node, which is used to control the release of the background process. If it is a serial release, the background process (i.e., the process to be released) can be optionally bound to a small core or a medium core, and then enter the release queue. Optionally, it can be sorted according to preset rules, and the processes are released one by one in the sorted order. For details, please refer to the description of Example 2 in S120 in method 100. If it is not a serial release, each is released in parallel. For details, please refer to the description of Example 1 in S120 of method 100.
[0137] In summary, the process release method provided in the embodiment of the present application can determine the memory release method according to the processor load and / or the performance of the foreground application to reduce the impact of the process release operation on the performance of the foreground application. Specifically, when the processor load is greater than or equal to a preset threshold, or the foreground application is a load-sensitive application, a serial release method can be used to release the background process. In this way, the impact of the process release on the processor load can be reduced, while reducing the impact on the foreground; when the processor load is less than a preset threshold, and / or the foreground application is not a load-sensitive application, a parallel release method is used to release the background process. In this way, the time occupied by the process release can be shortened, so that the system can reclaim memory space as soon as possible, and improve the overall performance of the system.
[0138] For example, for Figure 2 In the application scenario shown, when a user is playing a game on an electronic device, the system may release multiple background processes based on Android Empty. At this time, the foreground application is a racing game. Based on the type of foreground application (load-sensitive application), it can be determined to release the background process in serial release mode. Since the process of releasing the process needs to be scheduled by the CPU, releasing the background processes one by one in serial release mode can minimize the impact of the process release operation on the processor load. At the same time, it can also reduce the impact of the foreground application's performance on the processor load fluctuation, avoiding the application from appearing like Figure 3 The frame rate fluctuations shown.
[0139] For example, for Figure 5 In the application scenario shown, when a user opens the camera application on an electronic device, if the memory is insufficient, the system will clean up multiple background processes to free up memory space. If the current processor load is high, you can use the serial release method to release background processes, try to avoid the situation where the process release causes processor overload, improve the performance of the camera application, shorten the startup time of the camera application, and avoid the camera application from experiencing such problems. Figure 6 The startup time shown changes suddenly.
[0140] Corresponding to the methods given in the above-mentioned method embodiments, the embodiments of the present application also provide corresponding electronic devices, which include modules for executing the corresponding methods in the above-mentioned method embodiments. The module can be software, hardware, or a combination of software and hardware. It can be understood that the technical features described in the above-mentioned method embodiments are also applicable to the following device embodiments. Therefore, the contents not described in detail can be referred to the above method embodiments, and for the sake of brevity, they will not be repeated here.
[0141] Fig.10 1 shows a structural block diagram of an electronic device 1000 provided in an embodiment of the present application. For convenience, only the parts related to the embodiment of the present application are shown. Fig.10 , the electronic device 1000 may specifically include the following modules:
[0142] The memory release mode decision module 1010 is used to determine the memory release mode according to the load of the processor in the electronic device 1000 and / or the type of the foreground application. The memory release mode includes a serial release mode or a parallel release mode.
[0143] The memory release control module 1030 is used to release multiple background processes in the electronic device according to the memory release method.
[0144] Optionally, the electronic device 1000 also includes a policy notification module 1020, which is located between the memory release method decision module 1010 and the memory release control module 1030. The policy notification module is used to obtain the memory release method from the memory release method decision module 1010 and send the memory release method to the memory release control module 1030.
[0145] It should be noted that the information interaction, execution process, etc. between the above-mentioned modules / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method and system embodiment section and will not be repeated here.
[0146] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units or modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0147] Combine the following Fig.11 A software system corresponding to the electronic device 1000 is introduced. In this software system, each module in the electronic device 1000 can be regarded as a software module.
[0148] The software system of the electronic device 1000 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture, etc. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software system of the electronic device 1000.
[0149] Fig.11 1 is a block diagram of a software system of an electronic device 1000 provided in an embodiment of the present application. Fig.11 , the layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely the application layer (also called the application layer), the application framework layer (Framework) layer (also called the application framework layer), the native service layer and the kernel layer. It is understandable that a hardware abstraction layer (HAL) (not shown in the figure) can also be included between the native service layer and the kernel layer. HAL is a core state module that can hide various hardware-related details, such as I / 0 interfaces, interrupt controllers, and multi-processor communication mechanisms, etc., to provide a unified service interface for different hardware platforms running Android, and achieve portability on multiple hardware platforms.
[0150] The application layer can include a series of application packages. Fig.11As shown, the application package may include media applications such as camera applications, game applications, live video applications, etc. Of course, the application package may also include other applications, such as gallery, calendar, call, map, navigation, Bluetooth, music, video, short message, etc.
[0151] The application framework layer provides application programming interface (API) and programming framework for the application layer applications. The application framework layer includes some predefined modules, which can implement corresponding functions based on predefined functions. Fig.11 As shown, the application framework layer may include a memory release mode decision module, which may determine the memory release mode according to the load of the processor in the electronic device 1000 and / or the type of the foreground application. For specific implementation methods, please refer to Figure 8 The description of step S110 in method 100 is not repeated here.
[0152] Optionally, the application framework layer may further include a process management module, which is used to monitor process release, that is, monitor whether a process release operation is required. For example, whether a process cleanup operation is required can be determined based on an empty cleanup mechanism, memory application of a foreground application, system power consumption / thermal cleanup, etc., and the specific method is not limited in this application.
[0153] Optionally, the application framework layer may further include a scene recognition module, and the scene recognition module is used to recognize the current scene according to the type of the foreground application (ie, to recognize whether the foreground application is a load-sensitive application).
[0154] Optionally, the application framework layer may further include a load acquisition module, the load acquisition module being used to acquire the load of the processor. Optionally, it may also be determined whether the load of the processor is greater than or equal to a preset threshold.
[0155] It can be understood that the above-mentioned process management module, scene recognition module, and load acquisition module can also be modules outside the application framework layer, or partial modules belonging to the memory release method decision module. That is to say, in one implementation method, the functions performed by the above-mentioned process management module, scene recognition module, and load acquisition module can be performed by the memory release method decision module.
[0156] In addition, the application framework layer may also include modules such as a resource manager, wherein the resource manager provides various resources for the application, such as localized strings, icons, images, layout files, video files, etc.
[0157] The local service layer mainly includes some local services and link libraries. The local service layer can provide feature support for the Android system through some C / C++ libraries. In addition, the local service layer also includes the Android Runtime. Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for the scheduling and management of the Android system. The core library contains two parts: one part is the function functions that need to be called by the Java language, and the other part is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection and other functions.
[0158] Please refer to Fig.11 The local service layer may optionally include a policy notification module, which is used to obtain information indicating the memory release method output by the memory release method decision module in the application framework layer, and forward the information to the memory release control node in the kernel layer.
[0159] The kernel layer is the layer between the hardware and the software. Fig.11 The kernel layer controls the memory release control module, which is used to release multiple background processes in the electronic device 1000 according to the memory release method. In one implementation, the memory release control module learns the memory release method through the policy notification module of the local service layer.
[0160] In addition, if Fig.11 As shown, the kernel layer may also include a CPU driver and a GPU driver, etc.
[0161] It should be noted that the embodiments of the present application are only illustrated using the Android system as an example. In other operating systems (such as the Android system, the IOS system, etc.), the solutions of the present application can also be implemented as long as the functions implemented by each functional module are similar to those of the embodiments of the present application.
[0162] The following is an illustrative description of the software and hardware workflow of the electronic device 1000 in conjunction with the usage scenario of the camera application.
[0163] Please refer to Fig.12 , Fig.12 It is a schematic diagram of a workflow for releasing a background process during the startup and use of a camera application by an electronic device 1000 provided in an embodiment of the present application.
[0164] like Fig.12As shown, assuming that the user starts the camera application at the application layer, the camera application requests memory from the system. When the remaining memory space is insufficient, the process management module learns that the background process needs to be released, and notifies the memory release mode decision module of the process release event.
[0165] On the other hand, the scene recognition module of the application framework layer reads the foreground application (i.e., the camera application) from the application layer and identifies the type of the foreground application (optionally, it can also determine whether the foreground application is a load-sensitive application based on the type of the foreground application), and then sends the type of the foreground application (or the judgment result) to the memory release method decision module.
[0166] Secondly, the load acquisition module of the application framework layer obtains the processor load (optionally, it can also determine whether the processor load is greater than or equal to a preset threshold), and then sends the processor load (or the determination result) to the memory release mode decision module.
[0167] After the memory release method decision module learns from the process management module that a process needs to be released, it determines the memory release method according to the type of foreground application and / or the processor load, and then sends the memory release method to the memory release control module through the policy notification module of the local service layer.
[0168] The specific interaction process of the above scheme is as follows Fig.13 As shown. Fig.13 In the method 200 shown, the memory release mode decision module obtains the processor load and the type of the foreground application from the load acquisition module and the scene recognition module respectively (or only obtains one of the processor load and the foreground application type, which is not limited here), and then determines the memory release mode according to the processor load and / or the type of the foreground application. The specific implementation method can be referred to Figure 8 The description of S110 in method 100 in . Further, the memory release mode decision module sends the memory release mode to the local service layer, and the local service layer sends the received memory release mode to the memory release control module. After obtaining the memory release mode, the memory release control module can release multiple background processes based on the memory release mode. For specific implementation methods, please refer to Figure 8 Description of part S120 in method 100.
[0169] Corresponding to the methods provided in the above-mentioned method embodiments, the embodiments of the present application also provide another architecture of a corresponding electronic device.
[0170] like Fig.14As shown, an embodiment of the present application also provides an electronic device 1100, which includes: at least one processor 1100, a memory 1120, and a computer program 1121 stored in the memory. When the processor calls the computer program 1121 to run, the electronic device 1100 can implement the steps in any method embodiment of the above-mentioned embodiments.
[0171] It can be understood that the technical features described in the above method embodiments are also applicable to the device embodiments of the present application. Therefore, for the contents not described in detail, please refer to the above method embodiments. For the sake of brevity, they will not be repeated here.
[0172] For example, Fig.15 A detailed architecture diagram of an electronic device 1300 to which the present application is applicable is shown.
[0173] like Fig.15 As shown, the electronic device 1300 may include a processor 1310, an internal memory 1321, and one or more display screens 1394 (these multiple display screens may be represented by 1-N).
[0174] Optionally, the electronic device 1300 may also include an external memory interface 1320, a universal serial bus (USB) interface 1330, a charging management module 1340, a power management module 1341, a battery 1342, an antenna 1, an antenna 2, a mobile communication module 1350, a wireless communication module 1360, an audio module 1370, a speaker 1370A, a receiver 1370B, a microphone 1370C, an earphone interface 1370D, a sensor module 1380, a button 1390, a motor 1391, an indicator 1392, a camera 1393, and a subscriber identification module (SIM) card interface 1395, etc. The sensor module 1380 may include a pressure sensor 1380A, a gyroscope sensor 1380B, an air pressure sensor 1380C, a magnetic sensor 1380D, an acceleration sensor 1380E, a distance sensor 1380F, a proximity light sensor 1380G, a fingerprint sensor 1380H, a temperature sensor 1380J, a touch sensor 1380K, an ambient light sensor 1380L, a bone conduction sensor 1380M, and the like.
[0175] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 1300. In other embodiments of the present application, the electronic device 1300 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0176] The processor 1310 may include one or more processing units, for example: the processor 1310 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. It can be understood that the processor 1310 in the embodiment of the present application can be used to schedule the process of releasing the process. For example, during the process release process, the processor 1310 can be used to allocate processing resources, schedule the execution order and priority of tasks, etc.
[0177] The controller may be the nerve center and command center of the electronic device 1300. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0178] The processor 1310 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 1310 is a cache memory. The memory may store instructions or data that the processor 1310 has just used or cyclically used. If the processor 1310 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 1310, and thus improves the efficiency of the system.
[0179] In some embodiments, the processor 1310 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (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 subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0180] The processor 1310 in the embodiment of the present application may be a multi-core processor. Compared with conventional processors, multi-core processors have higher processing speed and performance. Fig.15 As shown, when the processor 1310 is a multi-core processor, it includes multiple cores. Fig.15 The example in FIG. 1 shows that the processor 1310 includes three cores, namely, a large core, a medium core, and a small core. However, it should be understood that the present application is not limited thereto, and when the processor 1310 is a multi-core processor, it may have only two cores or more than three cores.
[0181] In order to improve the processing speed and performance of the processor, a multi-core processor can be used in an electronic device. The processor may include a large core, a medium core, and a small core. The large core has higher computing power than the medium core, but also consumes more power. Similarly, the medium core has higher computing power than the small core, but also consumes more power. A multi-core processor may include multiple types of large cores, medium cores, and small cores.
[0182] The internal memory 1321 can be used to store computer executable program codes, which include instructions. The processor 1310 executes various functional applications and data processing of the electronic device 1300 by running the instructions stored in the internal memory 1321. The internal memory 1321 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 1300 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 1321 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. In an embodiment of the present application, the background process may be stored in the internal memory 1321. In an application scenario, when the foreground application is started, if the storage space of the internal memory 1321 is insufficient, the storage space can be recovered by scheduling the process release process by the processor 1310.
[0183] The electronic device 1300 implements the display function through a GPU, a display screen 1394, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 1394 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 1310 may include one or more GPUs that execute program instructions to generate or change display information.
[0184] The display screen 1394 is used to display images, videos, etc. The display screen 1394 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 1300 may include 1 or N display screens 1394, where N is a positive integer greater than 1.
[0185] In the embodiment of the present application, the display screen 1394 can be used to display the interface of the foreground application, for example, to display the game screen of the game application, such as Figure 2 As shown, or display the shooting screen of the camera application, such as Figure 5 As shown in (b) in .
[0186] Optionally, in one implementation, the electronic device 1300 can implement the shooting function of the camera application through an ISP, a camera 1393, a video codec, a GPU, a display screen 1394, and an application processor.
[0187] ISP is used to process the data fed back by camera 1393. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 1393.
[0188] The camera 1393 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can 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 passes the electrical signal to the ISP to be converted into a digital image signal. 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 or other format. In some embodiments, the electronic device 1300 may include 1 or N cameras 1393, where N is a positive integer greater than 1.
[0189] In other cases, the wireless communication module 1360 can provide a wireless communication solution for the electronic device 1300; the wireless communication module 1360 can be one or more devices integrating at least one communication processing module. In some embodiments, the antenna 1 of the electronic device 1300 is coupled with the mobile communication module 1350, and the antenna 2 is coupled with the wireless communication module 1360, so that the electronic device 1300 can communicate with the network and other devices through wireless communication technology; the external memory interface 1320 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 1300. The electronic device 1300 can implement audio functions through the audio module 1370, the speaker 1370A, the receiver 1370B, the microphone 1370C, the headphone interface 1370D, and the application processor. For example, music playback, recording, etc.; the button 1390 includes a power button, a volume button, etc.; the motor 1391 can generate a vibration prompt; the indicator 1392 can be an indicator light, which can be used to indicate the charging status, the change of power, and can also be used to indicate messages, missed calls, notifications, etc.; the SIM card interface 1395 is used to connect a SIM card.
[0190] It is understandable that if the integrated units in the above-mentioned device embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0191] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0192] An embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, a mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0193] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0194] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0195] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0196] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0197] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A process release method, characterized in that: Applied to electronic equipment, the method comprises: Determining a memory release mode according to a load of a processor in the electronic device and / or a type of a foreground application, wherein the memory release mode includes a serial release mode or a parallel release mode; A plurality of background processes in the electronic device are released according to the memory release method.
2. The method according to claim 1, characterized in that In a case where the determined memory release mode is the serial release mode, releasing multiple background processes in the electronic device according to the memory release mode includes: The multiple background processes are released one by one in the same memory release agent process.
3. The method according to claim 2, characterized in that Before releasing the multiple background processes one by one in the same memory release proxy process, the method further includes: Waking up the memory release agent process in a dormant state, where the memory release agent process is a pre-established process; or, Create the memory release agent process.
4. The method according to claim 2 or 3, characterized in that: The processor is a multi-core processor, and the method further includes: The memory release agent process is bound to the small core or the medium core of the processor.
5. The method according to any one of claims 1 to 3, characterized in that In a case where the determined memory release mode is the serial release mode, releasing multiple background processes in the electronic device according to the memory release mode includes: According to a preset rule, the multiple background processes are released one by one in sequence.
6. The method according to claim 5, characterized in that The preset rules include: The multiple background processes are released in sequence according to the order of the occupied load from large to small.
7. The method according to claim 5, characterized in that The preset rules include: The multiple background processes are released in sequence according to the usage frequencies of the applications corresponding to the multiple background processes from low to high.
8. The method according to any one of claims 1 to 3, characterized in that Determine the memory release method based on the processor load, including: If the load of the processor is greater than or equal to a preset threshold, determining that the memory release mode is the serial release mode; or, If the load of the processor is less than the preset threshold, the memory release mode is determined to be the parallel release mode.
9. The method according to any one of claims 1 to 3, characterized in that Determine the memory release method based on the type of foreground application, including: If the foreground application is a load-sensitive application, determining that the memory release mode is the serial release mode; or, If the foreground application is not a load-sensitive application, determining that the memory release mode is the parallel release mode; The degree to which the performance of the load-sensitive application is affected by the load is higher than a preset level.
10. The method according to any one of claims 1 to 3, characterized in that Determine the memory release method based on the processor load and the type of foreground application, including: If the load of the processor is less than a preset threshold and the foreground application is a load-sensitive application, determining that the memory release mode is the serial release mode; or, If the load of the processor is less than the preset threshold, and the foreground application is not the load-sensitive application, determining that the memory release mode is the parallel release mode; or, If the load of the processor is greater than or equal to the preset threshold, and the foreground application is a load-sensitive application or the foreground application is not the load-sensitive application, determining that the memory release mode is the serial release mode; The degree to which the performance of the load-sensitive application is affected by the load is higher than a preset level.
11. The method according to claim 9, characterized in that The method further comprises: If the foreground application is a media application, it is determined that the foreground application is the load-sensitive application, and the media application is an application for taking pictures, or an application for taking or displaying video images.
12. The method according to any one of claims 1 to 3, characterized in that The method further comprises: Reading classification information of the foreground application through the interface of the foreground application; The type of the foreground application is determined based on the classification information.
13. An electronic device, characterized in that: The electronic device comprises: A memory release mode decision module, used to determine a memory release mode according to a load of a processor in the electronic device and / or a type of a foreground application, wherein the memory release mode includes a serial release mode or a parallel release mode; A memory release control module is used to release multiple background processes in the electronic device according to the memory release method.
14. An electronic device, characterized in that: include: Processor and memory; Wherein, one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the processor, the electronic device performs the method as claimed in any one of claims 1 to 12.
15. A computer storage medium, characterized in that The method comprises computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Method and device for releasing resources
CN104778086A
Method for processing Java instance garbage collection of search system
CN110795248A
Device dormancy method and computing device
CN113467923A
Control method and device and electronic equipment
CN113900819A
Memory recovery method and apparatus, and electronic device
WO2022242683A1