Storage method, terminal, storage medium and program product
By freezing the target application data in the terminal's memory and storing it in external storage, the problem of insufficient memory caused by large models is solved, improving terminal response speed and user experience. It is suitable for smartphones, tablets, laptops, in-vehicle devices, and wearable devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2024-11-21
- Publication Date
- 2026-04-24
AI Technical Summary
Deploying large models on the terminal reduces available memory, affecting terminal speed and user experience.
The application interface data of the target application stored in the terminal memory is frozen and stored in external storage. A mapping relationship between the data and the external storage address is created, and the data is deleted from memory, leaving only the frequently accessed data in memory.
It effectively avoids lag caused by insufficient terminal memory, improves response speed and user experience, while avoiding increased costs and constraints on the operating system, and is suitable for various terminal devices.
Smart Images

Figure CN121919129A_ABST
Abstract
Description
[0001] This application claims priority to Chinese patent application filed on October 22, 2024, with application number 202411482015.6, entitled "Storage Method, Bandwidth Adjustment Method, Terminal, Storage Medium and Program Product", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of storage, and more particularly to a storage method, terminal, storage medium, and program product. Background Technology
[0003] With the rapid development of terminals such as smartphones, manufacturers are attempting to deploy large models within these terminals to effectively improve performance and responsiveness. However, large models have a large number of parameters, requiring significant memory. Therefore, deploying large models on the terminal reduces available memory, thereby impacting operating speed and degrading the user experience. Summary of the Invention
[0004] This application provides a storage method, terminal, storage medium, and program product, which can effectively expand the available memory of the terminal, improve the terminal's operating speed, and enhance the user experience.
[0005] To achieve the above objectives, the embodiments of this application provide the following technical solutions:
[0006] Firstly, a storage method is provided, which can be executed by a terminal; or by a module applied in the terminal, such as a chip, chip system, or circuit; or by a logic module or software capable of implementing all or part of the terminal's functions, without limitation. For ease of description, the following explanation uses execution by a terminal as an example.
[0007] The method includes: in response to freezing the target application, storing first data stored in memory to external memory, creating a mapping relationship between the first data and the external memory address, and deleting the first data from memory.
[0008] The first data includes data from the application interface of the target application, which is an application running in the background of the terminal. The external storage address refers to the storage location of the first data in external memory.
[0009] As described above, after the target application is frozen, it does not need to display its interface on the screen. Therefore, the application interface data is not accessed, but it still occupies some memory. By replacing the application interface data with external storage using the above technical solution, the available memory on the terminal can be increased, freeing up more memory space for running applications. This effectively avoids lag caused by insufficient terminal memory, improves terminal responsiveness, and ultimately enhances the user experience.
[0010] In one optional implementation, the first data is the target data volume of the application interface data of the target application stored in memory, and the target data volume is less than or equal to the maximum data volume that can be read from the external storage within a preset time period.
[0011] By limiting the amount of data read from memory in the above way, it can be ensured that before switching the target application back to the foreground, the first data stored in external storage can be replaced in memory in a timely manner (within a preset time), without spending too much time loading a large amount of data from external storage. This allows for faster response to the user and enhances the user experience.
[0012] In one optional implementation, the terminal determines the first data from the data of the target application's application interface based on the access timestamp of the data. Specifically, this may include: for each application interface in the target application, the terminal can obtain the access timestamp of the data, and then determine the access time interval of the data based on the current time and the access timestamp of the data. The first data is obtained by retrieving the target amount of data from the data of the target application's application interfaces in descending order of access time intervals.
[0013] By limiting the amount of data read from memory in the above way, it can be ensured that before switching the target application back to the foreground, the first data stored in external storage can be replaced in memory in a timely manner (within a preset time), without spending too much time loading a large amount of data from external storage. This allows for faster response to the user and enhances the user experience.
[0014] In one optional implementation, the first data is data stored in memory from the application interface of the target application with an access time interval greater than a preset time interval.
[0015] Using the above method, the terminal can replace data that has not been accessed for a long time (i.e., the first data) in the target application's interface with data in external storage. This further expands the terminal's available memory. Furthermore, this method can also save frequently accessed data from the target application's interface into memory. When this data is needed, the terminal can quickly retrieve it from memory, effectively improving the terminal's response speed.
[0016] In one optional implementation, the terminal determines the first data from the data of the target application's application interface based on the access timestamp of the data. Specifically, this may include: for each application interface in the target application, the terminal can obtain the access timestamp of the data, and then determine the access time interval of the data based on the current time and the access timestamp of the data. After obtaining the access time interval of the data for each application interface in the target application, the terminal can use data whose access time interval is greater than a preset time interval as the first data.
[0017] Using the above method, the terminal can replace data that has not been accessed for a long time (i.e., the first data) in the target application's interface with data in external storage. This further expands the terminal's available memory. Furthermore, this method can also save frequently accessed data from the target application's interface into memory. When this data is needed, the terminal can quickly retrieve it from memory, effectively improving the terminal's response speed.
[0018] In an alternative implementation, the terminal may also delete the mapping between the virtual address and the memory address of the first data. The memory address refers to the storage location of the first data in memory before the target application switches from the foreground to the background.
[0019] Deleting the mapping between the virtual address and the first memory address of the target application's interface data can prevent situations where data cannot be accessed or is empty when accessing the target application's interface data later.
[0020] In an alternative implementation, the terminal may also, in response to a triggering operation that switches the target application from the background to the foreground, store first data stored in external storage into the memory, and display the last interface displayed before the target application switches from the foreground to the background based on the first data stored in the memory.
[0021] Through the above technical solution, the terminal can store the first data in memory. This allows the terminal to quickly retrieve the first data from memory and display the corresponding application interface on the screen when needed, without requiring the data to be read from external storage. This effectively reduces the latency of the terminal reading the first data and enhances the user experience.
[0022] In one alternative implementation, after the terminal stores the first data in memory, it can delete the first data from the external storage. This allows for an expansion of the external storage space.
[0023] In one optional implementation, storing the first data from the external memory into memory can specifically include: reading the first data from the external memory based on the mapping relationship between the virtual address of the first data and the external memory address, and storing the first data into memory.
[0024] The mapping relationship between the virtual address and the external memory address of the first data is generated after the first data is stored in the external memory.
[0025] The above technical solution provides a specific implementation method for storing the first data in memory, which can effectively improve the feasibility of this application.
[0026] In one alternative implementation, the terminal may also display a switching animation in response to a trigger operation that switches the target application from the background to the foreground. The duration of the switching animation is greater than or equal to the duration for which the terminal stores the application interface data from external storage into memory.
[0027] Through the above technical solution, the terminal can store the first data stored in the external memory into the memory during the time of displaying the switching animation, so as to realize the replacement of the storage location of the first data without the user's awareness.
[0028] In one alternative implementation, the first data may include at least one of media data, texture data, and data generated by the target process of the target application during its operation.
[0029] Media data is used to present visuals, such as image data and video data. The memory used to store media data can be called media memory or DMA memory. Texture data is used to describe the visual attributes of the application interface, such as dynamic display effects, resolution, and pixel data. The memory used to store texture data can be called texture memory or GPU memory. A target process refers to a process whose expected response time is longer than a preset time.
[0030] In one alternative implementation, a data processing model is deployed in the terminal.
[0031] In an optional implementation, the above method may further include: when the triggering condition is met, storing the data generated by the target process of the target application stored in memory during its operation in an external storage device, and deleting the data generated by the target process during its operation from memory.
[0032] The target process refers to a process whose expected response time is longer than the preset response time.
[0033] Through the above technical solution, the terminal can swap data generated during the execution of processes with an expected response time longer than a preset time from anonymous page memory to external storage, further expanding the terminal's available memory. Furthermore, storing data generated during the execution of processes with an expected response time less than or equal to the preset time (i.e., latency-sensitive processes) in application anonymous page memory avoids the need for the terminal to read data generated by latency-sensitive processes from external storage. This ensures that the terminal can read data generated by latency-sensitive processes from memory in a very short time, improving terminal response speed and enhancing user experience.
[0034] In an optional implementation, based on the deployment of a data processing model in the terminal, the above method may further include: adjusting the memory bandwidth (also referred to as bandwidth) occupied by the data processing model when the processor utilization rate of the terminal is greater than a preset threshold.
[0035] The adjusted data processing model uses less bandwidth than the original data processing model.
[0036] The above technical solution can limit the bandwidth occupied by the data processing model to ensure that there is sufficient bandwidth available for the processor. This can effectively improve the response speed of the terminal and enhance the user experience.
[0037] In one optional implementation, adjusting the memory bandwidth occupied by the data processing model includes:
[0038] Adjust the memory bandwidth occupied by the data processing model according to the preset bandwidth adjustment ratio.
[0039] The above technical solution provides a specific implementation method for adjusting the bandwidth occupied by the data processing model, which can effectively improve the feasibility of this application.
[0040] In one optional implementation, the bandwidth adjustment ratio includes a first adjustment ratio and a second adjustment ratio, wherein the first adjustment ratio is greater than the second adjustment ratio.
[0041] The step of adjusting the memory bandwidth occupied by the data processing model according to a preset bandwidth adjustment ratio includes:
[0042] Adjust the memory bandwidth occupied by the data processing model according to the first adjustment ratio;
[0043] If the adjusted processor utilization rate is greater than the preset threshold, the memory bandwidth occupied by the data processing model will continue to be adjusted according to the second adjustment ratio.
[0044] Through the above technical solution, the terminal can limit the bandwidth occupied by the data processing model in multiple steps to further ensure that there is sufficient bandwidth available for the processor. This can effectively improve the terminal's response speed and enhance the user experience.
[0045] In one optional implementation, adjusting the memory bandwidth occupied by the data processing model includes:
[0046] Adjust the memory bandwidth used by the Neural Processing Unit (NPU).
[0047] The above technical solution provides a specific implementation method for limiting the bandwidth occupied by the data processing model, which can effectively improve the feasibility of this application.
[0048] In a second aspect, a storage device is provided, located in a terminal, comprising: a functional unit for performing any of the methods provided in the first aspect, wherein the actions performed by each functional unit are implemented by hardware or by hardware executing corresponding software.
[0049] The device includes a storage module, a creation module, and a deletion module. The storage module, in response to freezing the target application, stores first data from memory to external storage. The creation module creates a mapping between the first data and the external storage address. The deletion module removes the first data from memory.
[0050] The first data includes data from the application interface of the target application, which is an application running in the background of the terminal. The external storage address refers to the storage location of the first data in external memory.
[0051] Thirdly, a terminal is provided, including a memory and a processor, wherein the memory is used to store program code and the processor is used to call the program code to execute any of the storage methods provided in the first aspect.
[0052] Fourthly, a computer-readable storage medium is provided, including program code, which, when executed on a computer or processor, causes the computer or processor to perform any of the storage methods provided in the first aspect.
[0053] Fifthly, a computer program product is provided, the computer program product including instructions, which, when executed on a computer, cause the computer to perform any of the storage methods provided in the first aspect.
[0054] It should be noted that the technical effects of any of the implementation methods in aspects two through five can be found in the technical effects of the corresponding implementation methods in aspect one, and will not be repeated here. Attached Figure Description
[0055] Figure 1 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application;
[0056] Figure 2 A memory diagram provided for an embodiment of this application;
[0057] Figure 3 A schematic diagram of a DMA memory provided in an embodiment of this application;
[0058] Figure 4 This is a schematic diagram of a storage method provided in an embodiment of this application;
[0059] Figure 5 A software structure block diagram of a terminal provided in an embodiment of this application;
[0060] Figure 6 This is a schematic diagram of the structure of an SMMU provided in an embodiment of this application;
[0061] Figure 7 A schematic flowchart illustrating a storage method provided in an embodiment of this application;
[0062] Figure 8 A flowchart illustrating another storage method provided in an embodiment of this application;
[0063] Figure 9 This application provides a schematic diagram of a structure for switching a target application from the background to the foreground, as shown in an embodiment of the present application.
[0064] Figure 10 This application provides a schematic diagram of media data access in an embodiment.
[0065] Figure 11 This is a schematic diagram of texture data access provided in an embodiment of this application;
[0066] Figure 12 A module interaction diagram provided for an embodiment of this application;
[0067] Figure 13 This is another schematic diagram of media data access provided in an embodiment of this application;
[0068] Figure 14 An interactive flowchart of a storage method provided in an embodiment of this application;
[0069] Figure 15 A structural block diagram of a storage method provided in an embodiment of this application;
[0070] Figure 16 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application;
[0071] Figure 17 This is a schematic diagram of the structure of a storage device provided in an embodiment of this application. Detailed Implementation
[0072] In the description of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. The "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Furthermore, "at least one" means one or more, and "multiple" means two or more. The terms "first," "second," etc., do not limit the quantity or order of execution, and "first," "second," etc., do not necessarily imply differences.
[0073] It should be noted that, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0074] It is understood that the term "embodiment" used throughout the specification means that a specific feature, structure, or characteristic related to an embodiment is included in at least one embodiment of this application. Therefore, throughout the specification, various embodiments do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It is understood that in the various embodiments of this application, the sequence number of each process does not imply the order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0075] In this application, unless otherwise specified, the same or similar parts between the various embodiments can be referred to each other. In the various embodiments of this application, unless otherwise specified or logically conflicting, the terminology and / or descriptions between different embodiments are consistent and can be mutually referenced. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships. The following embodiments of this application do not constitute a limitation on the scope of protection of this application.
[0076] With the rapid development of terminals such as smartphones (hereinafter referred to as mobile phones), manufacturers are attempting to deploy large models in these terminals to effectively improve their performance and response speed. However, large models have a large number of parameters, requiring significant memory. As shown in Table 1, a large model with 1.5 billion parameters (i.e., 1.5 billion (B)) requires 1 gigabyte (G) of memory; a large model with 3B parameters requires 2.5G of memory; and a large model with 7B parameters requires 4G of memory. Taking mobile phones as an example, current mobile phones typically have relatively small memory, such as 12G. Furthermore, as large models continue to develop and their parameters expand year by year, the memory they require will increase. Therefore, deploying large models in terminals such as mobile phones will reduce the available memory of the terminal, thus affecting its operating speed.
[0077] Table 1
[0078] Number of parameters (B) Memory 1.5B 1G 3B 2.5G 7B 4G
[0079] Taking mobile phones as an example, there are currently four ways to expand the available memory of a mobile phone.
[0080] The first method: Increase the phone's memory.
[0081] Expanding a phone's memory refers to increasing the capacity of its memory devices, such as increasing the capacity from 12GB to 16GB. However, this method increases the cost of the phone.
[0082] The second method: system slimming and system memory reclamation.
[0083] System slimming refers to deleting unnecessary files, applications, or data from the operating system to reduce the system's memory usage. However, this method places strong constraints on the operating system; that is, during the cleanup process, it is necessary to accurately identify the parts that need to be deleted to avoid causing the operating system to malfunction due to accidental deletion.
[0084] System memory reclamation refers to releasing cached data generated by the operating system during operation. However, when this cached data is used subsequently, it needs to be recalculated or loaded, which consumes a lot of time and can lead to frame drops, lag, and other issues on the phone, affecting the user experience.
[0085] The third method: applying weight loss techniques.
[0086] App slimming refers to reducing the memory occupied by third-party applications installed on a phone. However, for already released third-party applications, the memory they require is fixed, and as these applications are updated and developed, their memory usage will increase year by year.
[0087] The fourth method: Scanning and killing background applications.
[0088] Background app removal increases the phone's available memory by freeing up memory used by background apps, making it more usable for foreground apps. Foreground apps are those currently in use by the user. For example, when using the camera, the camera is the foreground app, while other apps running in the background are background apps. The phone can close background apps, freeing up memory for the camera. However, in this method, when the user accesses a background app again, the phone needs to restart the app, preventing the page the user just visited from being displayed directly, thus degrading the user experience. Furthermore, removal takes time, affecting the time it takes for apps to allocate memory, leading to longer latency for large memory-intensive tasks and a worse user experience.
[0089] In summary, all four solutions have limitations that prevent their widespread application. Therefore, addressing the issue of reduced available memory on devices such as mobile phones resulting from the introduction of large models is a pressing problem that needs to be solved.
[0090] Therefore, embodiments of this application provide a storage method applied to a terminal. Specifically, in response to freezing a target application, the terminal can store first data in memory to external storage and delete the first data from memory. The first data includes data from the application interface of the target application, which is an application running in the background of the terminal.
[0091] As can be seen from the above technical solution, after the target application is frozen, the terminal can swap the first data, including the application interface data, from memory to external storage and then delete the first data from memory. This expands the terminal's available memory, freeing up more memory space for the running application. This effectively avoids lag caused by insufficient terminal memory, improves terminal response speed, and thus enhances the user experience.
[0092] Furthermore, the aforementioned methods for expanding the available memory of a terminal do not require increasing the capacity of memory devices, thus avoiding any increase in terminal costs. They also do not require slimming down the operating system or reclaiming its memory, thus eliminating the need for strong constraints on the operating system and preventing the need to recalculate or reload cached data when using it. Moreover, they do not require slimming down applications or killing background applications. Therefore, the storage method provided in this application not only improves user experience but is also easily applicable.
[0093] The technical solution provided in this application will now be described with reference to the accompanying drawings.
[0094] Figure 1 A structural schematic diagram of terminal 100 is shown. For example... Figure 1 As shown, the terminal 100 may include a processor 110, memory 120, charging management module 130, power management module 131, battery 132, audio module 140, buttons 150, display screen 160, external memory interface 170, etc.
[0095] It is understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the terminal 100. In other embodiments of this application, the terminal 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0096] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, GPUs, image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.
[0097] Memory 120 is an important component of a computer system, used to temporarily store running programs or data. Typically, memory can include nine storage areas, each used to store different data. For example, as... Figure 2As shown, memory can include chip reserved area, kernel area, system anonymous page area, application anonymous page area, compressed data area, direct memory access (DMA) area, graphics processing unit (GPU) area, file page area, and free area.
[0098] The chip reserved area is a memory area reserved for future hardware upgrades or new feature expansions.
[0099] The kernel region is used to store data related to the operating system kernel, such as kernel code and kernel data structures.
[0100] The system anonymous page area is used to store temporary data generated by the terminal's operating system during operation.
[0101] The application anonymous page region is used to store temporary data generated by applications installed on the terminal during runtime. The application anonymous page region can also be referred to as application anonymous page memory.
[0102] The compressed data area is used to store data that has been processed by compression algorithms, such as application installation packages.
[0103] The Interruptible Object Notation (ION) / DMA area, used for allocating and managing fragmented memory, is used to store media data; therefore, the DMA area can also be called media memory or DMA memory.
[0104] The GPU region is used to store texture data and can also be referred to as GPU memory or texture memory.
[0105] The file page area is used to store data read from the disk in units of pages.
[0106] Free space refers to the unused storage area in memory.
[0107] For example, suppose application M is a video playback application, and the terminal's display screen is showing the video playback interface of application M. This video playback interface includes multiple controls, such as a play control, a follow control, and a search control. The play control is used to play videos posted by users registered with application M, the follow control is used to play videos posted by followed users, and the search control is used to display the search interface. The data corresponding to the play control, follow control, and search control is temporary data generated by application M during its operation. Therefore, the terminal can store the data corresponding to the play control, follow control, and search control in the application's anonymous page memory. The data corresponding to the video being played in the video playback interface belongs to media data; therefore, the terminal can store the data corresponding to the video in DMA memory. The resolution and pixel data of the video playback interface belong to texture data; therefore, the terminal can store the resolution and pixel texture data of the video playback interface in GPU memory.
[0108] The media data stored in the aforementioned DMA memory can generally be, for example, image data or video data. DMA memory is typically managed using a buffer queue structure for asynchronous access by data generation modules (also known as producers), such as the central processing unit (CPU) and GPU, and data consumption modules (also known as consumers), such as the display subsystem (DSS). Specifically, such as... Figure 3 As shown, after the data generation module generates media data, it can call a display component (such as a surface component) to store the media data in the buffer queue of DMA memory, waiting for the data consumption module to read it. The data consumption module can then retrieve the media data from the buffer queue of DMA memory and render it on the display screen.
[0109] The memory 120 can store application interface data for multiple applications. These multiple applications include applications running in the foreground of the terminal (also known as foreground applications) and applications running in the background of the terminal (also known as background applications). Based on this, when the terminal 100 runs an application in the foreground, it can display the application interface of that application on the display screen 160 based on the application interface data of that application stored in the memory 120.
[0110] The external storage interface 170 can be used to connect external storage devices, which refer to storage devices other than the terminal's internal memory, such as hard disks (also known as disk drives), flash memory, Micro SD cards, etc. This expands the storage capacity of the terminal 100. The external storage device communicates with the processor 110 through the external storage interface 170 to perform data storage functions.
[0111] When an application is brought to the background, it is not killed immediately, but rather the application is frozen. That is, the application is no longer running, but in order to allow the user to quickly return to the state it just left the background when using the application again, the application's running state and accessed data are temporarily frozen, and this part of the data is stored in memory.
[0112] In this embodiment, after freezing the target application, the processor 110 can read the application interface data (hereinafter referred to as first data) of the target application from the memory 120. Then, the processor 110 can store the read first data in external memory and delete the first data from memory. The target application refers to an application running in the background of the terminal 100.
[0113] This application does not limit the triggering conditions for freezing the target application. For example, the triggering condition for freezing the target application can be that the target application is switched from the foreground to the background. In this case, the terminal can respond to the user's triggering operation of switching the target application from the foreground to the background, run the target application in the background, and freeze the target application. As another example, the triggering condition for freezing the target application can be that the memory usage rate is greater than a preset memory usage rate threshold. In this case, the terminal can freeze the application running in the background of the terminal when the memory usage rate is greater than the preset memory usage rate threshold, that is, freeze the target application.
[0114] For example, consider the trigger condition for freezing a target application as switching the application from the foreground to the background. The user can execute a trigger operation to switch the target application from the foreground to the background. The processor 110 can respond to this trigger operation by running the target application in the background and freezing the target application. Additionally, as... Figure 4 As shown in (a), the processor can read first data from memory 120 in response to freezing the target application. Then, the processor can store the first data in external memory via external memory interface 170 and delete the first data from memory 120.
[0115] In some embodiments, the user can also perform a triggering operation on the target application to switch the target application from the background to the foreground, such as... Figure 4 As shown in (b), in response to a trigger operation that switches the target application from the background to the foreground, the processor 110 can read first data from external memory via external memory interface 170 and store the first data in memory 120. Then, the processor 110 can unfreeze the target application and read data from memory 120 of the last displayed application interface before switching from the foreground to the background. Based on the data of the last displayed application interface before switching from the foreground to the background, the processor 110 can display the last displayed application interface before switching from the foreground to the background on display screen 160 to switch the target application to the foreground.
[0116] The charging management module 130 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 130 receives charging input from the wired charger via a USB interface. In some wireless charging embodiments, the charging management module 130 receives wireless charging input via the wireless charging coil of the terminal 100. While charging the battery 132, the charging management module 130 can also supply power to the terminal via the power management module 131.
[0117] The power management module 131 connects the battery 132, the charging management module 130, and the processor 110. The power management module 131 receives input from the battery 132 and / or the charging management module 130 to power the processor 110, memory 120, and display screen 160, etc. In some other embodiments, the power management module 131 may also be located within the processor 110. In still other embodiments, the power management module 131 and the charging management module 130 may be located in the same device.
[0118] Terminal 100 implements display functions through a GPU, display screen 160, and application processor. The GPU is a microprocessor for image processing, connected to the display screen 160 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0119] The display screen 160 is used to display application interfaces, images, videos, etc. The display screen 160 includes a display panel. In some embodiments, the terminal 100 may include one or N display screens 160, where N is a positive integer greater than 1.
[0120] Terminal 100 can implement audio functions, such as music playback and recording, through audio module 140 and application processor.
[0121] The audio module 140 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 140 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 140 may be located in the processor 110, or some functional modules of the audio module 140 may be located in the processor 110.
[0122] Buttons 150 include a power button, volume buttons, etc. Buttons 150 can be mechanical buttons or touch-sensitive buttons. Terminal 100 can receive button input and generate key signal inputs related to user settings and function control of terminal 100.
[0123] The software system of Terminal 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This embodiment of the invention uses a layered architecture. Taking the system as an example, the software structure of terminal 100 is illustrated.
[0124] Figure 5 This is a software structure block diagram of the terminal 100 according to an embodiment of the present invention.
[0125] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into three layers: the application layer, the system layer, and the kernel layer, from top to bottom.
[0126] The application layer can include a series of application packages.
[0127] like Figure 5 As shown, the application package can include applications such as camera, gallery, calendar, call, map, navigation, Bluetooth, music, and video.
[0128] The system layer can include the component layer, the native interface layer, and the native service layer.
[0129] The component layer provides specific functional modules and reusable software components to the application layer, which can be called by the application.
[0130] The component layer can include surface components, codec components, web components, image components, and xcomponent components, etc.
[0131] The surface component can be used to store application media data in DMA memory.
[0132] The local interface layer can provide applications with interfaces to access local services and resources.
[0133] The local interface layer may include DMA memory interface, user mode driver (UMD) interface, etc.
[0134] The DMA memory interface provides an interface for applications to access DMA memory.
[0135] The local service layer is used to provide services for the local system.
[0136] like Figure 5As shown, the local service layer may include an application management module (Activity Manager Service, AMS), a global resource management module (Resource Scheduling System, RSS) (also known as a freeze module or iware), an application memory reclamation module (Application Thread Trim Memory), a multimedia codec module, etc.
[0137] The kernel layer is the layer between hardware and software. The kernel layer includes at least the codec driver, the kernel mode driver (KMD), the system memory manager (memmgr) (also called the system memmgr), and the system memory management unit (SMMU).
[0138] The SMMU stores the mapping between memory addresses and virtual addresses, used to determine the memory address corresponding to a virtual address. Specifically, for example... Figure 6 As shown, after receiving a virtual address from any module (such as a picture decoder, codec, GPU, or DSS), SMMU can determine the memory address corresponding to the virtual address based on the mapping relationship between its stored memory addresses and virtual addresses, and return the memory address to that module.
[0139] The storage method provided in this application embodiment can be applied to... Figure 1 The terminal 100 shown is an example. For instance, the terminal 100 can be a smartphone, tablet, laptop, in-vehicle device, or wearable device (such as a smartwatch). The following description uses a terminal as an example to illustrate the storage method provided in this application embodiment.
[0140] Figure 7 This is a flowchart illustrating a storage method provided in an embodiment of this application, as shown below. Figure 7 As shown, the method includes the following S701-S702:
[0141] S701, in response to freezing the target application, stores the first data stored in memory to external memory.
[0142] The first data includes data about the target application's user interface. The target application is an application that runs in the background on the terminal.
[0143] External storage refers to storage devices other than terminal memory. External storage can be non-volatile memory. In the embodiments of this application, external storage can be a hard disk (also known as a disk drive), flash memory, etc., and there is no limitation thereto.
[0144] This application does not limit the triggering condition for freezing the target application (hereinafter referred to as the first triggering condition). For example, the first triggering condition can be that the target application is switched from the foreground to the background. In this case, the terminal can respond to the user's triggering operation of switching the target application from the foreground to the background, run the target application in the background, and freeze the target application. As another example, the first triggering condition can be that the memory usage rate is greater than a preset memory usage rate threshold. In this case, the terminal can freeze the application running in the background of the terminal when the memory usage rate is greater than the preset memory usage rate threshold, that is, freeze the target application.
[0145] This application does not limit the preset memory usage threshold. For example, the preset memory usage threshold can be 50% or 60%.
[0146] Freezing a target application means temporarily stopping the target application from running. Specific freezing procedures can be found in relevant technical documents and will not be elaborated upon here.
[0147] Specifically, taking the first trigger condition of the target application switching from the foreground to the background as an example, when the terminal is running the target application in the foreground, the terminal's screen can display the application interface of the target application. The terminal can store the data of the target application's interface generated during the running of the target application (hereinafter referred to as the first data) in its own memory, and store the target application's process identifier (PID) and the storage location of the first data in memory (hereinafter referred to as the first memory address of the first data) accordingly. Users can use the functions provided by the application through the application interface displayed on the terminal. For example, opening a video in the video application, or searching for a contact in the contacts application.
[0148] If a user intends to operate any application other than the target application on the terminal's display interface, the user can perform a trigger operation on the display screen to switch the target application from the foreground to the background. The terminal can respond to the user's trigger operation by running the target application in the background and freezing the target application. Then, the terminal can determine the first memory address of the first data based on the target application's PID, and then read the first data from memory based on the first memory address, and store the first data in external memory.
[0149] In this embodiment, the user's triggering operation is not limited. For example, the user's triggering operation can be a touch operation such as a click or swipe, an input voice command, or an operation of a physical button, etc.
[0150] S702, creates a mapping relationship between the first data and the external memory address.
[0151] External memory address refers to the storage location of the first data in external memory.
[0152] After the terminal stores the first data in external memory, it can obtain the storage location of the first data in external memory (i.e., the external memory address of the first data). Then, the terminal can generate a mapping relationship between the virtual address of the first data and its external memory address.
[0153] The mapping relationship between the virtual address and the external memory address of the first data can ensure that when the terminal accesses the first data, it can quickly read the first data from the external memory based on this mapping relationship.
[0154] S703, delete the first data from memory.
[0155] After the terminal stores the first data in external storage, it can delete the first data from memory.
[0156] It is understood that the execution order between S702 and S703 is not limited in the embodiments of this application. For example, S702 can be executed first and then S703 can be executed, or S703 can be executed first and then S702 can be executed, or S702 and S703 can be executed simultaneously.
[0157] As described above, after a target application is frozen, its interface is not displayed on the screen, and therefore its interface data is not accessed. However, this interface data still consumes memory, and the memory required increases when multiple target applications exist. For example, if one target application is frozen, its interface data requires 300MB of memory; with 10 target applications, this requires over 3GB of memory. This technical solution replaces the target application's interface data with external storage, expanding the terminal's available memory (up to 2-4GB), freeing up more memory for running applications. This effectively avoids lag caused by insufficient terminal memory, improves terminal responsiveness, and ultimately enhances the user experience.
[0158] The following will combine various optional implementation methods to describe... Figure 7 The storage method shown will be further described.
[0159] Figure 8 This is a flowchart illustrating another storage method provided in an embodiment of this application. This method is executed by a terminal, such as... Figure 8As shown in (a), the method includes the following S801-S806.
[0160] S801, in response to freezing the target application, determines the first data from the data in the application interface of the target application.
[0161] In response to freezing the target application, the terminal can obtain the access timestamp of the application interface data of the target application stored in memory, and then determine the first data from the application interface data of the target application based on the access timestamp of the application interface data.
[0162] The data in the target application's interface can include data that has been read by the data consumption module (hereinafter referred to as read data) and data that has not been read by the data consumption module (hereinafter referred to as unread data). For example, suppose the target application is application A, which can include three application interfaces: interface 1, interface 2, and interface 3. Interfaces 1 and 2 are the displayed application interfaces, while interface 3 is the undisplayed application interface. Thus, the data of interface 1 and interface 2 can be referred to as read data, and the data of interface 3 can be referred to as unread data.
[0163] The access timestamp of read data is used to indicate the most recent time the data was accessed. For example, if the access timestamp of the data on interface 1 is 12:21:20, it means that the terminal last accessed the data on interface 1 at 12:21:20.
[0164] The access timestamp for unread data can be a preset timestamp. This application does not limit the preset timestamp; for example, it can be 00:00:00 or XX:XX:XX.
[0165] In one optional implementation, the terminal determines the first data from the data of the target application's application interface based on the access timestamp of the data. Specifically, this may include: for each application interface in the target application, the terminal can obtain the access timestamp of the data, and then determine the access time interval of the data based on the current time and the access timestamp of the data. After obtaining the access time interval of the data for each application interface in the target application, the terminal can use data whose access time interval is greater than a preset time interval as the first data.
[0166] The embodiments of this application do not limit the preset time interval. For example, the preset time interval can be 1 minute or 30 seconds (s).
[0167] For data whose access timestamp is a preset timestamp, the terminal can confirm the access time interval of the data as a preset time interval (e.g., 0).
[0168] For example, assuming the current time is 12:12:13, the preset timestamp can be 00:00:00, the preset time interval is 30 seconds, the target application is application A, and application A can include three application interfaces: interface 1, interface 2, and interface 3. The access timestamp of the data on interface 1 is 12:11:13, the access timestamp of the data on interface 2 is 12:12:11, and the access timestamp of the data on interface 3 is 00:00:00. Therefore, the access time interval for the data on interface 1 is 1 minute, the access time interval for the data on interface 2 is 2 seconds, and the access time interval for the data on interface 3 is 0 seconds. Thus, since the access time interval for the data on interface 1 is greater than the preset time interval, the terminal can use the data on interface 1 as the first data.
[0169] In one optional implementation, after the terminal obtains the access time interval of the data of each application interface in the target application in the above manner, it can obtain the target amount of data from the data of the application interfaces in the target application in descending order of access time interval to obtain the first data.
[0170] The target data volume is less than or equal to the maximum amount of data that can be read from external storage within a preset time period.
[0171] The embodiments of this application do not limit the preset duration. For example, the preset duration can be 200ms or 250ms.
[0172] The embodiments of this application do not limit the setting method of the preset duration. For example, the preset duration can be set in advance by the staff or determined by the terminal based on the bandwidth of the universal flash storage input / output (UFS IO).
[0173] By limiting the amount of data read from memory in the above way, it can be ensured that before switching the target application back to the foreground, the first data stored in external storage can be replaced in memory in a timely manner (within a preset time), without spending too much time loading a large amount of data from external storage. This allows for faster response to the user and enhances the user experience.
[0174] In one alternative implementation, the terminal may include an RSS feed and a system memmgr. For example... Figure 12 As shown, RSS is used to freeze the target application and send a first memory reclamation command to the system memmgr. The system memmgr can respond to the first memory reclamation command by determining the first data from the data in the target application's application interface.
[0175] S802, determine the first memory address of the first data.
[0176] The first memory address refers to the storage location of the first data in memory.
[0177] S803, based on the first memory address, stores the first data stored in memory to the external memory.
[0178] S804, delete the first data from memory.
[0179] Specifically, the terminal can store a mapping relationship between the virtual address and the first memory address of the first data. Based on this, after determining the first data via S802, the terminal can obtain the virtual address of the first data, and then obtain the first memory address of the first data based on the virtual address. Afterwards, the terminal can read the first data from memory based on the first memory address, store the first data in external memory, and delete the first data from memory.
[0180] In one alternative implementation, the terminal stores the first data in an external memory, which may specifically include storing the first data in a swap space (SWAP) of the external memory.
[0181] A swap partition is a contiguous storage area on external storage. The first data is stored in the SWAP, allowing the terminal to quickly locate and retrieve the data when reading it later, thus improving the terminal's response speed and enhancing the user experience.
[0182] S805, delete the mapping relationship between the virtual address and the first memory address of the first data.
[0183] Deleting the mapping between the virtual address and the first memory address of the target application's interface data can prevent situations where data cannot be accessed or empty data is accessed when accessing the target application's interface data later.
[0184] S806 generates the mapping relationship between the virtual address and the external memory address of the first data.
[0185] In an optional implementation, the terminal may include an SMMU in addition to the RSS and system memory. The processes described in S802-S806 can be implemented through interaction between the system memory and the SMMU. The system memory can determine the virtual address of the first data and then send the virtual address of the first data to the SMMU. The SMMU can determine the first memory address of the first data based on the virtual address of the first data. Afterwards, the SMMU can send the first memory address of the first data to the system memory. (Continue to see...) Figure 12The system memmgr can read the first data from memory based on the first memory address, store the first data in external storage (i.e., write the first data to disk), and delete the first data from memory.
[0186] After deleting the first data from memory, the system memmgr can send a mapping release instruction to the SMMU, and this instruction contains the virtual address of the first data. The SMMU can respond to the mapping release instruction by deleting the mapping relationship between the virtual address of the first data and the first memory address. After the system memmgr stores the first data in external memory, it can also generate a mapping relationship between the virtual address of the first data and the external memory address.
[0187] In one alternative implementation, after the SMMU deletes the mapping between the virtual address and the first memory address of the first data, an exception function can be constructed for the first data. In this way, when the SMMU subsequently receives the virtual address of the first data, it can return an exception value, preventing system crashes caused by accessing empty data.
[0188] In one optional implementation, the system memmgr deletes the first data from memory, specifically including: the system memmgr marking the memory region used to store the first data with a first tag value. Then, the kernel thread can reclaim the marked memory region, that is, the kernel thread can delete the data stored in the marked memory region. Alternatively, the system memmgr can mark the memory region other than the region used to store the first data with a second tag value. Then, the kernel thread can reclaim the unmarked memory region.
[0189] In the embodiments of this application, the first and second marker values are not limited. For example, the first marker value can be a number (such as 0) or a string (such as asd), and the second marker value can be a number (such as 1) or a string (such as Attach).
[0190] After storing the first data from memory to external storage using the above method, the terminal can also, in response to a trigger operation that switches the target application from the background to the foreground, read the first data from the external storage and store it in memory. Specifically, as follows... Figure 8 As shown in (b) of the figure, the method includes the following steps S807-S811.
[0191] S807, in response to a trigger operation that switches the target application from the background to the foreground, reads the first data from the external memory based on the mapping relationship between the virtual address and the external memory address of the first data.
[0192] S808 stores the first data in memory.
[0193] Specifically, when a user intends to operate a target application on the terminal's display screen, a trigger operation can be performed to switch the target application from the background to the foreground. The terminal can respond to the user's trigger operation, obtain the virtual address of the first data, and then determine the external storage address of the first data based on the mapping relationship between the virtual address and the external storage address. Afterwards, the terminal can read the first data from the external storage based on the external storage address and store the first data in memory.
[0194] In one alternative implementation, after the terminal stores the first data in memory, it can delete the first data from the external storage. This allows for an expansion of the external storage space.
[0195] In one alternative implementation, the terminal may also display a switching animation in response to a trigger operation that switches the target application from the background to the foreground, and the duration of the switching animation is greater than or equal to the duration during which the terminal stores the first data stored in the external memory into its own memory.
[0196] This application does not limit the duration of the switching animation. For example, assuming it takes 200ms for the terminal to store the application interface data of the target application stored in the external storage to its own memory, the duration of the switching animation can be 200ms or 250ms.
[0197] Through the above technical solution, the terminal can store the first data stored in the external memory into the memory during the time of displaying the switching animation, so as to realize the replacement of the storage location of the first data without the user's awareness.
[0198] S809 generates a mapping relationship between the virtual address of the first data and the second memory address.
[0199] After the terminal stores the first data in memory via the above-described S808 process, it can obtain the storage location of the first data in memory (i.e., the second memory address of the first data). Then, the terminal can generate a mapping relationship between the virtual address and the second memory address of the first data.
[0200] S810, delete the mapping relationship between the virtual address and the external memory address of the first data.
[0201] S811, unfreeze the target application and display the last screen displayed before the target application switched from the foreground to the background.
[0202] After unfreezing the target application, the terminal can determine the data of the application interface with the access timestamp closest to the current time as the data of the last interface displayed before the target application switches from the foreground to the background, based on the access timestamp of the data of each application interface. The terminal can then display the interface on the screen based on the data of the last interface displayed before the target application switches from the foreground to the background, thereby switching the target application from the background to the foreground.
[0203] The contents of S809-S811 will be explained below with reference to the accompanying drawings.
[0204] like Figure 9 As shown in (1), after the terminal replaces the first data from external storage to memory, it can obtain the second memory address of the first data. Then, as... Figure 9 As shown in (2), the terminal can generate a mapping relationship between the virtual address of the first data and the second memory address, and delete the mapping relationship between the virtual address of the first data and the external memory address. Finally, as Figure 9 As shown in (3), the terminal can unfreeze the target application and read the data of the last displayed interface of the target application before it was switched from the foreground to the background from memory. Based on the read data, the interface of the target application is displayed on the screen to switch the target application to the foreground.
[0205] Before unfreezing the target application, the terminal can store the first data in memory. This allows the terminal to quickly retrieve the first data from memory and display the corresponding application interface on the screen when needed, without having to read the first data from external storage. This effectively reduces the latency of the terminal reading the first data and enhances the user experience.
[0206] In an optional implementation, the processes S807-S811 described above can be implemented through interaction between RSS, system memory, and SMMU. Specifically, in response to a trigger operation that switches the target application from the background to the foreground, RSS sends an unfreeze command to the system memory. The system memory obtains the virtual address of the first data and determines the external storage location of the first data based on the virtual address. Then, the system memory can read the first data from the external storage based on the external storage location and store the first data in memory. Furthermore, the system memory can also send a mapping relationship generation command to the SMMU, and this mapping relationship generation command contains the virtual address and the second memory address of the first data. The SMMU can respond to the mapping relationship generation command and generate a mapping relationship between the virtual address and the second memory address of the first data. Afterwards, RSS can unfreeze the target application and display the last interface displayed before the target application switched from the foreground to the background.
[0207] In one alternative implementation, the first data may include at least one of media data, texture data, and data generated by the target process of the target application during operation (which may also be called anonymous page data).
[0208] Media data is used to present visuals, such as image data and video data. The memory used to store media data can be called media memory or DMA memory. Texture data is used to describe the visual attributes of the application interface, such as dynamic display effects, resolution, and pixel data. The memory used to store texture data can be called texture memory or GPU memory. A target process refers to a process whose expected response time is longer than a preset time.
[0209] Specifically, taking the first data as including media data and texture data as an example, the terminal can store the storage location of the media data in DMA memory (hereinafter referred to as the DMA memory address) and the storage location of the texture data in GPU memory (hereinafter referred to as the GPU memory address). Based on this, after determining the first data, the terminal can read the media data from the DMA memory based on the DMA memory address of the media data in the first data, and read the texture data from the GPU memory based on the GPU memory address of the first data. After storing the read media data and texture data in external memory, the terminal can delete the media data from the DMA memory and delete the texture data from the GPU memory.
[0210] In one optional implementation, the terminal may include a data generation module and a data consumption module. The data generation module generates application interface data (including media data and texture data) for the target application, storing the media data in DMA memory and the texture data in GPU memory. The data consumption module reads the media data from DMA memory and the texture data from GPU memory, and renders the read media data and texture data onto the terminal's display screen. The data generation module and the data consumption module work together in an asynchronous consumption mode.
[0211] In response to a user's launch command for any application, the terminal launches the application and allocates buffer queues from both DMA memory and GPU memory for that application. For ease of description, the buffer queue allocated from DMA memory for any application will be referred to as the application's DMA memory, and the buffer queue allocated from GPU memory will be referred to as the application's GPU memory. Based on this, when the terminal is running an application in the foreground, the data generation module can temporarily store the generated media data of the application's interface in the application's DMA memory and the generated texture data of the application's interface in the application's GPU memory for the data consumption module to read. The data consumption module can read the media data from the application's corresponding DMA memory and the texture data from the application's corresponding GPU memory, and render the interface on the terminal's display screen based on the read media data and texture data.
[0212] In response to the user's triggering operation of switching the target application from the foreground to the background, the terminal runs the target application in the background and freezes the target application. Then, the data generation module and the data consumption module will switch to the DMA memory and GPU memory corresponding to the new foreground application (i.e., the application running in the foreground) for consumption. That is, the data generation module can temporarily store the media data of the application interface of the new foreground application in the DMA memory of the new foreground application, and temporarily store the texture data of the application interface of the new foreground application in the GPU memory of the new foreground application for the data consumption module to read.
[0213] In other words, the data generation module will not generate media data or texture data for the target application's interface, nor will it store data in the target application's DMA memory or GPU memory. The data consumption module will no longer read data from the target application's DMA memory or GPU memory. At this point, the terminal can store media data in the target application's DMA memory in external storage and delete the media data in the target application's DMA memory. Similarly, it can store texture data in the target application's GPU memory in external storage and delete the texture data in the target application's GPU memory.
[0214] For example, in one embodiment, taking media data as an example, assuming that the data generation module is a CPU and the data consumption module is a DSS, during the process of the terminal running application A in the foreground, the media data generated by the CPU includes image data 1, image data 2 and image data 3, and image data 1 is stored in buffer1 in DMA memory, image data 2 is stored in buffer2 in DMA memory, and image data 3 is stored in buffer3 in DMA memory.
[0215] like Figure 10As shown in (1), after the terminal freezes application A, the CPU will not generate new media data for application A, nor will it store new media data in the DMA memory of application A. The DSS will no longer read media data from the DMA memory of application A. The terminal can store image data 1, image data 2, and image data 3 in the DMA memory of application A into external memory and delete the media data in the DMA memory of application A. In addition, as Figure 10 As shown in (2), the terminal can delete the mapping relationship between the virtual address of image data 1 and buffer1, the mapping relationship between the virtual address of image data 2 and buffer2, and the mapping relationship between the virtual address of image data 3 and buffer3 of the target application, and generate the mapping relationship between the virtual address and external memory address of image data 1, image data 2 and image data 3.
[0216] In another embodiment, taking texture data as an example, assuming that the data generation module is a CPU and the data consumption module is a GPU, during the process of the terminal running application B in the foreground, the texture data generated by the CPU includes texture data 1, texture data 2 and texture data 3, and texture data 1 is stored in buffer A in GPU memory, texture data 2 is stored in buffer B in DMA memory, and texture data 3 is stored in buffer C in DMA memory.
[0217] like Figure 11 As shown in (1), after the terminal freezes application B, the CPU will not generate new texture data for application B, nor will it store new texture data in the GPU memory of application B. The GPU will no longer read texture data from the GPU memory of application B. The terminal can store texture data 1, texture data 2, and texture data 3 in the GPU memory in external memory and delete the texture data in the GPU memory of the target application. Afterwards, as Figure 11 As shown in (2), the terminal can delete the mapping relationship between the virtual address of texture data 1 and bufferA, the mapping relationship between the virtual address of texture data 2 and bufferB, and the mapping relationship between the virtual address of texture data 3 and bufferC of the target application, and generate the mapping relationship between the virtual address and external memory address of texture data 1, texture data 2 and texture data 3.
[0218] Furthermore, in response to a user's trigger to switch the target application from the background to the foreground, the terminal can read the target application's media and texture data from external storage, storing the media data in the target application's DMA memory and the texture data in the target application's GPU memory. Afterward, the terminal can unfreeze the target application. Once unfrozen, the data generation and consumption modules can revert to DMA and GPU memory corresponding to the target application for consumption. Specifically, the data generation module can temporarily store the generated media data of the target application's interface in the target application's DMA memory and the generated texture data of the target application's interface in the target application's GPU memory for the data consumption module to read.
[0219] For example, in one embodiment, taking media data as an example, assuming the data generation module is the CPU and the data consumption module is the DSS, after the terminal freezes application A, the CPU will not generate new media data for application A, nor will it store new media data in the DMA memory of application A. The DSS will no longer read media data from the DMA memory of application A. Image data 1, image data 2, and image data 3 of application A are stored in the external memory.
[0220] like Figure 13 As shown in (1), the terminal can respond to a user's trigger operation of switching the target application from the background to the foreground, read image data 1, image data 2, and image data 3 from external memory, and store image data 1 in buffer 4 of application A's DMA memory, image data 2 in buffer 5 of application A's DMA memory, and image data 3 in buffer 6 of application A's DMA memory. Figure 13 As shown in (2), the terminal can delete the mapping relationship between the virtual address and the external memory address of image data 1, image data 2 and image data 3, and generate the mapping relationship between the virtual address of image data 1 and buffer4, the mapping relationship between the virtual address of image data 2 and buffer5, and the mapping relationship between the virtual address of image data 3 and buffer6.
[0221] Afterwards, the terminal can unfreeze application A. Once application A is unfrozen, as follows: Figure 13 As shown in (3), the CPU and DSS can be transferred back to the DMA memory corresponding to application A for consumption. That is, the CPU can temporarily store the media data of the application interface of application A in the DMA memory of application A, and the DSS can read the media data from the DMA memory of application A and render the application interface of application A on the terminal display screen based on the read media data.
[0222] In an alternative implementation, the terminal may further include an application memory reclamation module and an AMS. The following example illustrates the interaction between RSS, AMS, the reclaimable memory module in the system memory, the multimedia codec module, and the application memory reclamation module. Figure 7 The method shown will be introduced.
[0223] Figure 14 An interactive flowchart of another storage method provided in the embodiments of this application is shown below. Figure 14 As shown, the method includes the following steps S1401-S1418.
[0224] S1401, RSS freeze target application.
[0225] S1402, RSS responds to freezing the target application by sending a first memory reclamation command to the application management module.
[0226] In some embodiments, after receiving a first memory reclamation instruction, the application management module may, in response to the first memory reclamation instruction, execute the following S1403-S1405:
[0227] S1403, AMS responds to the first memory reclamation instruction by determining the maximum amount of data and / or the target application's trim memory level.
[0228] Maximum data volume refers to the maximum amount of data that can be read from external storage within a preset time period.
[0229] The target application's reclamation level is used to determine the target data volume. The target application's reclamation level can also be called the background reclamation level.
[0230] The recycling level of the target application is related to the amount of data stored in memory.
[0231] The AMS can store the correspondence between data volume and reclamation level. After receiving the first memory reclamation instruction, the AMS can determine the reclamation level of the target application based on the correspondence between data volume and reclamation level.
[0232] S1404, AMS sends a second memory reclamation command to the application memory reclamation module.
[0233] The second memory reclamation instruction carries the reclamation level and / or maximum data amount.
[0234] S1405, the application memory reclamation module determines the target data volume based on the second memory reclamation instruction.
[0235] In some embodiments, when the second memory reclamation instruction carries a maximum data amount, the application memory reclamation module can use the maximum data amount as the target data amount after receiving the second memory reclamation instruction.
[0236] In other embodiments, the application memory reclamation module may store a correspondence between reclamation levels and data volumes. Based on this, when a reclamation level is included in the second memory reclamation instruction, the application memory reclamation module, upon receiving the second memory reclamation instruction, can determine the data volume corresponding to that reclamation level and use that data volume as the target data volume.
[0237] In some other embodiments, the application memory reclamation module may store a correspondence between reclamation levels and data volume adjustment ratios. Based on this, when the second memory reclamation instruction carries the reclamation level and the maximum data volume, the application memory reclamation module, upon receiving the second memory reclamation instruction, can determine the data volume adjustment ratio corresponding to the reclamation level, and adjust the maximum data volume based on the data volume adjustment ratio corresponding to the reclamation level to obtain the target data volume.
[0238] For example, suppose the data volume adjustment ratio corresponding to recycling level B is 20%, and the target data volume is 500MB. The application memory recycling module can adjust the target data volume of 500MB using a 20% data volume adjustment ratio, resulting in a target data volume of 100MB.
[0239] In one optional implementation, the application memory reclamation module determines the target data volume, which may specifically include: the application memory reclamation module calling the rendering service through the rendering proxy interface to determine the target data volume.
[0240] S1406, The application memory reclamation module sends the target data amount to the reclaimable memory module.
[0241] S1407, the reclaimable memory module reclaims memory from the target application based on the target data volume.
[0242] Specifically, after receiving the target data volume, the reclaimable memory module can reclaim the target data volume from the data in the target application's interface to obtain the first data, and then reclaim the first data. The specific reclamation process can be referred to the above. Figure 8 The description in the text will not be repeated here.
[0243] In other embodiments, after receiving the first memory reclamation instruction, the AMS may, in response to the first memory reclamation instruction, execute the following S1408-S1418:
[0244] S1408, AMS responds to the first memory reclamation instruction by sending the first memory reclamation instruction to the reclaimable memory module.
[0245] S1409, the reclaimable memory module determines the first memory address of the first data.
[0246] S1410, the recyclable memory module reads the first data from memory based on the first memory address of the first data, and stores the first data in an external memory.
[0247] S1411, the reclaimable memory module sends the first memory address to the multimedia codec module.
[0248] S1412, the multimedia codec module deletes the first data from memory based on the first memory address.
[0249] The multimedia codec module can delete the first data from memory by calling the codec interface based on the first memory address.
[0250] S1413, RSS responds to the triggering operation that switches the target application from the background to the foreground by sending an unfreezing command to AMS.
[0251] S1414, AMS responds to the unfreeze command by updating the process state of the target application.
[0252] Updating the process state of the target application refers to activating the process of the target application.
[0253] S1415, AMS sends a memory loading instruction to the application memory reclamation module.
[0254] S1416, the application memory reclamation module responds to the memory load instruction and reads the first data from the external storage.
[0255] S1417, the application memory reclamation module stores the first data in memory.
[0256] S1418, RSS unfreezes the target application and reads the data of the last screen displayed before the target application switched from the foreground to the background from memory.
[0257] After AMS reads the data of the last screen displayed before the target application switches from the foreground to the background, it can display the last screen displayed before the target application switches from the foreground to the background based on the data of the last screen displayed before the target application switches from the foreground to the background.
[0258] The execution process of S1408-S1418 described above can be referred to the above. Figure 8 The description in the text will not be repeated here.
[0259] In addition to the methods mentioned above, the terminal can further expand its available memory through the following methods.
[0260] In an alternative implementation, the terminal may also, upon meeting a triggering condition (hereinafter referred to as the second triggering condition), store the data generated by the target process of the target application during its operation (which may also be called anonymous page data) stored in memory to external storage, and delete the data generated by the target process during its operation from memory.
[0261] This application does not limit the second triggering condition. For example, the second triggering condition may be that the terminal's memory usage rate is greater than a preset memory usage rate threshold. Another example is that the second triggering condition may be that an application switches from the foreground to the background. Yet another example is that the second triggering condition may be that the CPU usage rate is greater than a preset CPU usage rate threshold, etc.
[0262] This application does not limit the process by which the terminal determines the target process. For example, the target process may be preset by the staff, in which case the terminal can determine the preset process as the target process. Alternatively, the target process may be determined by the terminal based on the expected response time of each process. For example, the terminal can determine a process whose expected response time is longer than a preset time as the target process. The expected response time may be preset by the staff.
[0263] Specifically, data generated by the target process during its execution is stored in the application anonymous page memory. Taking a trigger condition where the terminal's memory usage exceeds a preset threshold as an example, the terminal can determine its own memory usage at preset time intervals. If its memory usage exceeds the threshold, it determines the storage location of the data generated by the target process during its execution within the application anonymous page memory. Subsequently, the terminal can read the data generated by the target process from the application anonymous page memory, store the data in external storage, and delete the data generated by the target process from the application anonymous page memory.
[0264] In an alternative implementation, the terminal can also store file data (such as .so files) accessed by the target process during its execution in external storage and remove the file data accessed by the target process during its execution from memory. This further expands the available memory of the terminal.
[0265] Through the above technical solution, the terminal can replace data generated during the execution of processes with an expected response time longer than a preset time from anonymous page memory to external storage, further expanding the terminal's available memory. Furthermore, storing data generated during the execution of processes with an expected response time less than or equal to the preset time (i.e., latency-sensitive processes) in application anonymous page memory avoids the need for the terminal to read data generated by latency-sensitive processes from external storage, compared to related technologies that store all data generated during process execution in external storage. This ensures that the terminal can read data generated by latency-sensitive processes from memory in a very short time, improving the terminal's response speed (tests show an improvement of 1ms-10ms in response speed and over 10% in terminal performance), thus enhancing the user experience.
[0266] In one alternative implementation, a data processing model may be deployed in the terminal.
[0267] Data processing models require significant double data rate (DDR) bandwidth during operation; for example, data processing models with 1.5B and 3B parameters each require 40G / s of DDR bandwidth. This can lead to insufficient bandwidth utilization by the terminal's own processor, resulting in slower terminal response times and negatively impacting user experience. Therefore, in this embodiment, the bandwidth utilization of the terminal's processor can be increased through the following methods.
[0268] In one optional implementation, the terminal can adjust the bandwidth used by its deployed data processing model if its processor utilization exceeds a preset threshold. The adjusted data processing model will then use less bandwidth than the original data processing model.
[0269] The processor can be any of a CPU, NPU, or GPU. Accordingly, when the processor is a CPU, the preset threshold can be a CPU utilization threshold; when the processor is an NPU, the preset threshold can be an NPU utilization threshold; and when the processor is a GPU, the preset threshold can be a GPU utilization threshold.
[0270] This application does not limit the method by which the terminal adjusts the bandwidth occupied by its deployed data processing model. For example, the terminal can adjust the bandwidth occupied by the data processing model according to a preset bandwidth adjustment ratio. Another example is that the terminal can adjust the bandwidth occupied by the data processing model to a first bandwidth, which can be preset by staff and is less than the bandwidth occupied by the data processing model before adjustment.
[0271] This application does not limit the preset bandwidth adjustment ratio. For example, the bandwidth adjustment ratio can be 30%, meaning the terminal can adjust the bandwidth occupied by its deployed data processing model to 30% of the original bandwidth. Alternatively, the bandwidth adjustment ratio can be 10%, meaning the terminal can adjust the bandwidth occupied by its deployed data processing model to 10% of the original bandwidth.
[0272] Taking the processor as the CPU as an example, the terminal adjusts the bandwidth occupied by the data processing model according to a preset bandwidth adjustment ratio. The terminal can detect its own CPU utilization rate at preset time intervals, and if its own CPU utilization rate is greater than the preset CPU utilization rate threshold, it can adjust the bandwidth occupied by the data processing model deployed on its own according to the preset bandwidth adjustment ratio.
[0273] The embodiments of this application do not limit the preset time interval. For example, the preset time interval can be 1 millisecond (ms) or 5 ms.
[0274] For example, assuming a CPU utilization threshold of 50%, a preset bandwidth adjustment ratio of 30%, and a preset time interval of 5ms, the terminal can check its own CPU utilization every 5ms and, if its CPU utilization is greater than 50%, adjust the bandwidth used by its deployed data processing model to 30% of the original bandwidth.
[0275] The above technical solution can limit the bandwidth occupied by the data processing model to ensure that there is sufficient bandwidth available for the processor. This can effectively improve the response speed of the terminal and enhance the user experience.
[0276] In one optional implementation, the bandwidth adjustment ratio may include a first adjustment ratio and a second adjustment ratio, wherein the first adjustment ratio is greater than the second adjustment ratio. Based on this, the terminal adjusts the bandwidth occupied by the data processing model according to the preset bandwidth adjustment ratio. Specifically, this may include: adjusting the bandwidth occupied by the data processing model according to the first adjustment ratio; and if the adjusted processor utilization rate is greater than a preset threshold, continuing to adjust the bandwidth occupied by the data processing model according to the second adjustment ratio.
[0277] Specifically, taking the CPU as an example, the terminal can detect its own CPU utilization rate at preset time intervals. If its own CPU utilization rate is greater than a preset CPU utilization rate threshold, it can adjust the bandwidth occupied by its deployed data processing model according to a first adjustment ratio. If the adjusted CPU utilization rate is still greater than the preset CPU utilization rate threshold, it can adjust the bandwidth occupied by its deployed data processing model according to a second adjustment ratio.
[0278] For example, assuming a CPU utilization threshold of 50%, a first bandwidth adjustment ratio of 30%, a second bandwidth adjustment ratio of 10%, and a preset time interval of 5ms, the terminal can check its own CPU utilization every 5ms. If its CPU utilization is greater than 50%, it can adjust the bandwidth used by its deployed data processing model to 30% of the original bandwidth. Afterward, the terminal can continue to check its own CPU utilization, obtain the adjusted CPU utilization, and if the adjusted CPU utilization is greater than 50%, continue to adjust the bandwidth used by the data processing model to bring it down to 10% of the original bandwidth.
[0279] In addition, to ensure the accuracy of the terminal's detection of processor utilization, the terminal determines its own processor utilization, which may specifically include: determining its own processor utilization based on the results of a preset number of detections.
[0280] This application does not limit the preset number of times or the feature value. For example, the preset number of times can be 3 times. In this case, the terminal can detect its own processor utilization rate 3 times at preset time intervals and determine its own processor utilization rate based on the 3 detection results, such as using the average of the 3 detection results as its own processor utilization rate, or using the median of the 3 detection results as its own processor utilization rate. As another example, the preset number of times can also be 5 times. In this case, the terminal can detect its own processor utilization rate 5 times at preset time intervals and determine its own processor utilization rate based on the 5 detection results.
[0281] Through the above technical solution, the terminal can limit the bandwidth occupied by the data processing model in multiple steps to further ensure that there is sufficient bandwidth available for the processor. This can effectively improve the terminal's response speed and enhance the user experience.
[0282] In one alternative implementation, the NPU is hardware within the terminal used for processing large model calculations. Therefore, the terminal can adjust the bandwidth used by the data processing model as described above by adjusting the bandwidth occupied by the NPU. Accordingly, adjusting the bandwidth occupied by the data processing model can include adjusting the bandwidth occupied by the NPU.
[0283] It is understandable that the NPU's clock frequency determines its data processing speed. The faster the NPU's data processing speed, the larger the bandwidth it occupies; conversely, the slower the data processing speed, the smaller the bandwidth it occupies. Therefore, adjusting the bandwidth occupied by the NPU can specifically include adjusting the NPU's clock frequency, ensuring that the adjusted clock frequency is lower than the original clock frequency.
[0284] The above technical solution provides a specific implementation method for limiting the bandwidth occupied by the data processing model, which can effectively improve the feasibility of this application.
[0285] In one alternative implementation, the CPU has the highest bandwidth priority (first priority), the GPU has the second highest bandwidth priority (second priority), and the NPU has the third highest bandwidth priority (third priority). The first priority is higher than the second priority, and the second priority is higher than the third priority.
[0286] Bandwidth priority is used to characterize the order in which bandwidth is used. The higher the bandwidth priority, the earlier the bandwidth is used.
[0287] By implementing the above technical solution, setting the CPU's bandwidth priority to the highest level means that in the event of bandwidth congestion, the CPU can obtain sufficient bandwidth to execute its tasks, effectively improving the CPU's quality of service (QoS). Ensuring sufficient CPU bandwidth guarantees the stable operation of the terminal operating system, the rapid response of applications, and the high efficiency of multitasking, thereby effectively improving the user experience.
[0288] Figure 15 A structural block diagram of a storage method provided in an embodiment of this application is shown below. Figure 15 As shown in the diagram, the block diagram may include a memory replacement module (also known as a storage module or memory replacement system) 1501 and a bandwidth adjustment module 1502.
[0289] The memory swapping module 1501 may include a memory swapping-out module (also known as a memory swapping-out subsystem) and a memory swapping-in module (also known as a memory swapping-in subsystem).
[0290] The memory swapping module can read the first data (including media data and texture data) from memory after the target application is frozen, store it in external storage, and then delete the first data from memory.
[0291] The memory swapping module can also delete the mapping relationship between the virtual address and the first memory address of the first data after the first data is stored in the external storage, and generate a mapping relationship between the virtual address and the external storage address of the first data.
[0292] In addition, the memory swap-out module can also retrieve data generated by the target process during its execution from memory (such as...) if the second triggering condition is met. Figure 15 The anonymous page data in the target process is stored in the external memory, and the data generated during the execution of the target process is stored in the external memory.
[0293] The memory swapping module can respond to a trigger operation that switches the target application from the background to the foreground, start the switching animation, read the first data from external storage, and store the first data into memory. Afterwards, the terminal can unfreeze the target application and display the last screen displayed before the target application switched from the foreground to the background.
[0294] In addition, the memory swapping module can also delete the mapping relationship between the virtual address and the external storage address of the first data and generate a mapping relationship between the virtual address and the second memory address of the first data before unfreezing the target application.
[0295] The bandwidth adjustment module 1502 can adjust the bandwidth used by its deployed data processing model according to a preset bandwidth adjustment ratio when the processor utilization rate is greater than a preset processor utilization rate threshold.
[0296] The bandwidth adjustment module 1502 can also set the CPU bandwidth priority to the first priority, the GPU bandwidth priority to the second priority, and the NPU bandwidth priority to the third priority.
[0297] The above primarily describes the solutions provided by the embodiments of this application from the perspective of the terminal. Correspondingly, the embodiments of this application also provide a storage device for implementing the various methods described above. This storage device can be the terminal in the above method embodiments, or a component that can be used in a terminal. It is understood that, in order to achieve the above functions, the storage device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0298] This application embodiment can divide the storage device into functional modules according to the above method embodiment. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be understood that the module division in this application embodiment is illustrative and is only a logical functional division. In actual implementation, there may be other division methods.
[0299] For example, taking a storage device as the terminal in the above method embodiment as an example, Figure 16A schematic diagram of a terminal is shown, which includes a storage module 1601, a creation module 1602, and a deletion module 1603.
[0300] The storage module 1601 is used to store the first data stored in memory to an external storage device in response to freezing the target application.
[0301] The first data includes data about the target application's user interface. The target application is an application that runs in the background on the terminal.
[0302] Module 1602 is used to create the mapping relationship between the first data and the external memory address. The external memory address refers to the storage location of the first data in external memory.
[0303] The deletion module 1603 is used to delete the first data from memory.
[0304] It should be understood that one or more of the above modules or units can be implemented by software, hardware, or a combination of both. When any of the above modules or units are implemented by software, the software exists as computer program instructions and is stored in memory. The processor can be used to execute the program instructions and implement the above method flow. The processor can be built into a SoC (System-on-a-Chip) or ASIC, or it can be a separate semiconductor chip. In addition to the core that executes software instructions for computation or processing, the processor may further include necessary hardware accelerators, such as field-programmable gate arrays (FPGAs), PLDs (Programmable Logic Devices), or logic circuits that implement dedicated logic operations.
[0305] When the above modules or units are implemented in hardware, the hardware can be any one or any combination of a CPU, microprocessor, digital signal processing (DSP) chip, micro controller unit (MCU), artificial intelligence processor, ASIC, SoC, FPGA, PLD, application-specific digital circuit, hardware accelerator, or non-integrated discrete device, which can run the necessary software or perform the above method flow independently of software.
[0306] Optionally, embodiments of this application also provide a storage device. For example... Figure 17 As shown, the storage device includes: a bus 1701, a processor 1702, a memory 1703, and a communication interface 1704. The processor 1702, the memory 1703, and the communication interface 1704 communicate with each other via the bus 1701. The storage device can be a terminal. It should be understood that this application does not limit the number of processors and memories in the storage device.
[0307] The 1701 bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 17 The bus 1701 may be represented by a single line, but this does not mean that there is only one bus or one type of bus. The bus 1701 may include a path for transmitting information between various components of the storage device (e.g., memory 1703, processor 1702, communication interface 1704).
[0308] Processor 1702 may include any one or more processors such as CPU, GPU, microprocessor (MP), or digital signal processor (DSP).
[0309] The memory 1703 may include volatile memory, such as RAM. The processor 1702 may also include non-volatile memory, such as ROM, flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0310] The memory 1703 stores executable program code, and the processor 1702 executes the executable program code to implement the functions of the aforementioned acquisition module and response module, thereby implementing the storage method provided in this application embodiment. That is, the memory 1703 stores instructions for executing the storage method provided in this application embodiment.
[0311] The communication interface 1704 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the storage device and other devices or communication networks.
[0312] In one possible implementation, this application also provides a computer-readable storage medium storing a computer program or instructions that, when executed on a storage device, enable the storage device to perform the methods described in any of the above method embodiments or any implementation thereof.
[0313] In one possible implementation, this application embodiment also provides a storage method, which includes the method described in any of the above method embodiments or any implementation thereof.
[0314] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, implementation can be, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device containing one or more servers, data centers, etc., that can be integrated with the medium. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
[0315] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, disclosure, and appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple components. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.
[0316] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.
Claims
1. A storage method, characterized in that, Applied to a terminal, the method includes: In response to freezing the target application, the first data stored in memory is transferred to an external storage device; the first data includes data of the application interface of the target application, which is an application running in the background of the terminal. Create a mapping relationship between the first data and the external storage address; the external storage address refers to the storage location of the first data in the external memory. Delete the first data from the memory.
2. The method according to claim 1, characterized in that, The method further includes: Delete the mapping relationship between the virtual address and the memory address of the first data; the memory address refers to the storage location of the first data in memory before the target application switches from the foreground to the background.
3. The method according to claim 1 or 2, characterized in that, The method further includes: In response to a trigger operation that switches the target application from the background to the foreground, the first data stored in the external storage is stored in the memory; Based on the first data stored in the memory, the last interface displayed by the target application before it switches from the foreground to the background is shown.
4. The method according to claim 3, characterized in that, The step of storing the first data from the external memory into the main memory includes: Based on the mapping relationship between the virtual address and the external memory address of the first data, the first data is read from the external memory; The first data is stored in the memory.
5. The method according to any one of claims 1-4, characterized in that, The method further includes: In response to a triggering operation that switches the target application from the background to the foreground, a switching animation is displayed; the duration of the switching animation is greater than or equal to the duration for which the terminal stores the first data from the external storage to the memory.
6. The method according to any one of claims 1-5, characterized in that, The first data is the target data volume in the application interface data of the target application stored in the memory; the target data volume is less than or equal to the maximum data volume that can be read from the external storage within a preset time period.
7. The method according to any one of claims 1-5, characterized in that, The first data is the data in the application interface of the target application stored in the memory whose access time interval is greater than a preset time interval.
8. The method according to any one of claims 1-5, characterized in that, The first data includes at least one of media data, texture data, or data generated by the target process of the target application during its operation; The media data is used to present the image; the texture data is used to describe the visual attributes of the application interface of the target application; and the target process refers to a process whose expected response time is longer than a preset time.
9. The method according to any one of claims 1-8, characterized in that, The terminal is equipped with a data processing model.
10. The method according to any one of claims 1-9, characterized in that, The method includes: When the triggering conditions are met, the data generated by the target process of the target application during its operation, stored in memory, will be transferred to external storage; the target process refers to a process whose expected response time is longer than a preset time. Remove the data generated by the target process during its execution from the memory.
11. The method according to any one of claims 1-10, characterized in that, The terminal is equipped with a data processing model, and the method includes: If the processor utilization rate of the terminal exceeds a preset threshold, adjust the memory bandwidth occupied by the data processing model. The adjusted data processing model occupies less memory bandwidth than the original data processing model.
12. The method according to claim 11, characterized in that, Adjusting the memory bandwidth occupied by the data processing model includes: Adjust the memory bandwidth occupied by the data processing model according to the preset bandwidth adjustment ratio.
13. The method according to claim 12, characterized in that, The bandwidth adjustment ratio includes a first adjustment ratio and a second adjustment ratio, wherein the first adjustment ratio is greater than the second adjustment ratio; The step of adjusting the memory bandwidth occupied by the data processing model according to a preset bandwidth adjustment ratio includes: Adjust the memory bandwidth occupied by the data processing model according to the first adjustment ratio; If the adjusted processor utilization rate is greater than the preset threshold, the memory bandwidth occupied by the data processing model will continue to be adjusted according to the second adjustment ratio.
14. The method according to any one of claims 11-13, characterized in that, Adjusting the memory bandwidth occupied by the data processing model includes: Adjust the memory bandwidth used by the Neural Processing Unit (NPU).
15. A terminal, characterized in that, It includes a memory and a processor; the memory is used to store program code; the processor is used to invoke the program code to perform the method as described in any one of claims 1-14.
16. A computer-readable storage medium, characterized in that, Includes program code that, when run on a computer or processor, causes the computer or processor to perform the method as described in any one of claims 1-14.
17. A computer program product, characterized in that, The computer program product includes instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1-14.