Storage method, electronic device, storage medium and program product

By storing target data determined based on user and system data in memory, the problem of wasted memory storage space is solved, achieving efficient utilization and fast response.

CN121722306APending Publication Date: 2026-03-24HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

During memory access, the amount of data in the files to be stored in existing technologies is huge, resulting in wasted linked list storage space, especially since data that is not frequently accessed occupies a large amount of storage space.

Method used

Target data is determined based on user usage data and system operation data. Only data in target file pages that meet preset conditions is stored in memory. The data is managed through an LRU list, prioritizing the retention of frequently accessed data and reducing the space occupied by infrequently accessed data.

Benefits of technology

It effectively saves memory storage space, ensures fast response to frequently accessed data, improves user experience, and increases memory utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121722306A_ABST
    Figure CN121722306A_ABST
Patent Text Reader

Abstract

The invention discloses a storage method, electronic equipment, a storage medium and a program product, relates to the field of storage, and can effectively save the storage space of a memory. The method comprises the steps of determining a target file page storing target data from a persistent memory, and storing related data of the target file page into a memory of the electronic equipment. Wherein the target data is data meeting a first preset condition. The first preset condition comprises one or more of the following conditions: the number of visited times in the preset time period is greater than the preset number of times, or the visited duration in the preset time period is greater than the preset duration.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the storage field, and in particular to a storage method, an electronic device, a storage medium and a program product. BACKGROUND

[0002] In the process of caching files using a page cache mechanism, data in the files can be cached in a random access memory (RAM) in units of pages to form a plurality of file pages. The file pages can be managed in a least recently used (LRU) linked list based on an LRU algorithm.

[0003] At present, in the process of memory access, the page fault frequency of each file can be determined according to the number of page faults in the pages of each file, and then the file to be stored can be determined according to the page fault frequency of each file and the file size, and the file to be stored is stored in each linked list in units of pages. The amount of data in the file to be stored is often very large, which requires a large amount of storage space in the linked list. SUMMARY

[0004] The embodiments of the present application provide a storage method, an electronic device, a storage medium and a program product, which can effectively save the storage space of the memory.

[0005] To achieve the above object, the embodiments of the present application provide the following technical solutions.

[0006] In a first aspect, a storage method is provided, which can be executed by an electronic device, or by a module applied in the electronic device, such as a chip, a chip system or a circuit, or by a logic module or software capable of realizing all or part of the functions of the electronic device, without limitation. For ease of description, the following will be described by taking the execution by the electronic device as an example.

[0007] The method comprises: determining a target file page storing target data from a persistent storage, and storing relevant data in the target file page to a memory of the electronic device.

[0008] The target data is data satisfying a first preset condition. The first preset condition is determined according to the use data of a user and / or the running data of a system.

[0009] It can be known from the above technical solution that the target data is determined according to the use data of a user and the running data of a system, and the electronic device can store the relevant data in the target file page storing the target data to the memory of the electronic device, without storing the data in other file pages in the persistent storage to the memory, which can effectively save the storage space of the memory.

[0010] In one optional implementation, the first preset condition includes one or more of the following conditions: the number of times the device is accessed within a preset time period is greater than a preset number of times, or the duration of access within a preset time period is greater than a preset duration.

[0011] As can be seen from the above technical solution, the target data is frequently accessed data. Electronic devices can store the relevant data of the target file page containing the target data in their own memory, instead of storing the data of other file pages in persistent storage, which can effectively save memory storage space.

[0012] In one alternative implementation, the data that satisfies the first preset condition includes one or more of the application data of the function or application.

[0013] The above technical solution defines the target data, which can include functions that meet the first preset condition and / or application data of applications that meet the first preset condition. Storing functions that meet the first preset condition in its own memory ensures that they can be invoked promptly when called subsequently. Storing application data of applications that meet the first preset condition in its own memory ensures that when users use the application, the electronic device can quickly access the application data from memory, thereby quickly responding to user operations on the application and enhancing the user experience.

[0014] In one optional implementation, the above-mentioned functions may include one or more of the following: functions called during the operation of the operating system, functions called during the operation of preset services, functions stored on the server, or functions stored locally on the electronic device.

[0015] Storing functions called during operating system operation in memory allows electronic devices to quickly retrieve relevant functions from memory while the operating system is running, ensuring operating system speed and enhancing user experience. Storing functions called during preset service execution in memory ensures that memory resources are used for preset services. Thus, the terminal device can promptly retrieve relevant functions from memory to quickly respond to preset services, enhancing the user experience.

[0016] In one optional implementation, the functions called during the operation of the aforementioned preset service may include: functions called during the operation of the target thread of the preset service. The target thread is a thread in the preset service that meets a second preset condition; the second preset condition includes one or more of the following conditions: the central processing unit (CPU) utilization rate is greater than a preset threshold, or the memory occupancy rate is greater than a preset threshold.

[0017] The above technical solution further limits the functions called during the operation of the preset business, and can store the functions called during the operation of the target thread of the preset business in memory to further save memory storage space.

[0018] In an alternative implementation, when the target data includes a function, the above-mentioned determination of the target file page storing the target data from the persistent storage may specifically include: determining the starting position and length of the function based on the function identifier, determining the file offset of the function based on the starting position and length, and determining the target file page from the persistent storage based on the file offset.

[0019] Here, "starting position" refers to the position of the first character of the function. "Length" refers to the distance between the first and last characters of the function.

[0020] The above technical solution provides a method for determining a target file page. Using this method, electronic devices can quickly determine the target file page containing the function by utilizing the function's file offset, thereby effectively improving the efficiency of the electronic device in determining target data.

[0021] In an alternative implementation, the method may further include: periodically updating relevant data of the target file page stored in memory.

[0022] Through the above technical solution, electronic devices can periodically update the relevant data of the target file pages stored in memory, ensuring that the data in memory is always up-to-date. This guarantees that the electronic device can retrieve data from memory in a timely manner, maintains the operating speed of the electronic device, and enhances the user experience.

[0023] In one optional implementation, storing the relevant data of the target file page into the memory of the electronic device may specifically include storing the relevant data of the target file page in an LRU linked list in memory. The LRU linked list includes at least one of a protection linked list, an active linked list, and an inactive linked list.

[0024] The LRU (Least Recently Used) list can dynamically adjust the data stored within it based on the frequency of data usage and the time of most recent access. When memory space is limited, the least recently used data is automatically evicted to make room for new data, thereby further improving memory utilization.

[0025] The above technical solution also limits the LRU linked list, that is, the LRU linked list is at least one of the protection linked list, the active linked list and the inactive linked list, which can improve the implementability of this application while expanding the compatibility of this application.

[0026] In an alternative implementation, when the LRU list is a protection list, storing the relevant data in the target file page in the LRU list in memory may specifically include storing the relevant data in the target file page in the protection list.

[0027] The above technical solution allows the relevant data in the target file page to be stored in a protection list. The protection list has a slow recycling time, which can extend the storage time of the relevant data in the target file page in the protection list.

[0028] In a second aspect, a storage device is provided, located in an electronic device, comprising: functional units 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.

[0029] The device includes a determination module and a storage module. The determination module is used to determine the target file page containing the target data from persistent storage. The storage module is used to store the relevant data of the target file page into the memory of the electronic device.

[0030] The target data is the data that meets the first preset condition, which is determined based on the user's usage data and / or the system's operating data.

[0031] Thirdly, an electronic device is provided, including a memory and a processor, wherein the memory is used to store program code and the processor is used to invoke the program code to execute any of the storage methods provided in the first aspect.

[0032] 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.

[0033] 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.

[0034] 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

[0035] Figure 1 This is a memory diagram from a related technology;

[0036] Figure 2 This is a schematic diagram of memory reclamation in related technologies;

[0037] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0038] Figure 4 A schematic flowchart illustrating a storage method provided in an embodiment of this application;

[0039] Figure 5 A flowchart illustrating another storage method provided in an embodiment of this application;

[0040] Figure 6 A software structure block diagram of a terminal device provided in an embodiment of this application;

[0041] Figure 7 This is a schematic diagram of the structure of another electronic device provided in an embodiment of this application;

[0042] Figure 8 This is a schematic diagram of the structure of a storage device provided in an embodiment of this application. Detailed Implementation

[0043] 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.

[0044] 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.

[0045] 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.

[0046] 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.

[0047] Key components in a computer used for data storage include the central processing unit (CPU) cache, random access memory (RAM), and read-only memory (ROM). For example... Figure 1 As shown, when the CPU needs to execute an instruction or access data in a file, it first checks if the required instruction or data exists in memory. Specifically, the CPU can first check if the required instruction or data exists in the CPU cache. If the required instruction or data is not in the CPU cache, the CPU will read the data from RAM, with a read latency of 20 nanoseconds (ns). If the required instruction or data is also not in RAM, the CPU can continue to read the data from ROM, with a read latency of 200 ns.

[0048] As discussed above, the CPU reads data from ROM much slower than from RAM. To avoid having to read from ROM every time data is accessed, a page cache mechanism can be used to cache data from files in RAM. Specifically, when using a page cache mechanism to cache files, the data in the file is cached in RAM in units of pages, forming multiple file pages. These file pages can be managed in an LRU linked list based on the LRU algorithm.

[0049] Common LRU (Least Recently Used) linked lists can include an active LRU list and an inactive LRU list. The active list stores recently accessed file pages, while the inactive list stores file pages that have not been accessed recently. Therefore, during memory reclamation, file pages in the inactive list are reclaimed first, followed by those in the active list.

[0050] To better manage critical file pages, the protected LRU scheme was proposed. Specifically, the protected LRU scheme introduces the addition of a dedicated LRU linked list for storing critical file pages (hereinafter referred to as the protection list). Additionally, as... Figure 2 As shown, when reclaiming memory, file pages in the inactive list are reclaimed first, then file pages in the active list are reclaimed, and finally file pages in the protected list are reclaimed.

[0051] Currently, during memory access, the page fault frequency of each file can be determined based on the number of page faults for each file. Then, based on the page fault frequency and file size of each file, the files to be stored are determined and stored in units of pages. Figure 2 The linked lists shown (including the protection list, active list, and inactive list) contain a large amount of data. However, the data in the file to be stored is often very large, but the frequently accessed data usually does not account for 100%. This means that when the file to be stored is stored in a linked list, the data infrequently accessed in the file will also occupy the storage space of the linked list, resulting in wasted storage space of the linked list and, consequently, wasted memory storage space.

[0052] In view of this, embodiments of this application provide a storage method applied to an electronic device. Specifically, the electronic device can determine a target file page containing target data from persistent storage, and store the relevant data of the target file page into the memory of the electronic device. The target data is data that satisfies a first preset condition, which is determined based on user usage data and / or system operating data.

[0053] As can be seen from the above technical solution, the target data is determined based on the user's usage data and the system's operating data. The electronic device can store the relevant data in the target file page containing the target data into its own memory, instead of storing the data in other file pages in the persistent storage, which can effectively save memory storage space.

[0054] The technical solution provided in this application will now be described with reference to the accompanying drawings. Figure 3 A schematic diagram of the structure of the electronic device 100 is shown.

[0055] Electronic device 100 may include processor 110, internal memory 120, charging management module 130, power management module 131, battery 132, audio module 140, buttons 150, and display screen 160, etc.

[0056] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 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.

[0057] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (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.

[0058] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0059] The internal memory 120 may include one or more RAMs. The internal memory 120 may also include one or more ROMs.

[0060] RAM can be directly read and written by the processor 110. It can be used to store executable programs (such as machine instructions) of the operating system or other running programs, as well as user and application data.

[0061] In this embodiment, target data may be stored in RAM. The target data is data that satisfies a first preset condition, which includes one or more of the following conditions: the number of times it is accessed within a preset time period is greater than a preset number of times, or the access duration within the preset time period is greater than a preset duration.

[0062] In some embodiments, the data that satisfies the first preset condition may include one or more of the application data of functions or applications. A function refers to a software unit, software code, or software program that can implement a function or a certain purpose. The application data of an application may include user data, cached data, and functions called during application execution, etc.

[0063] In some embodiments, the above-mentioned functions include one or more of the following: functions called during the operation of the operating system, functions called during the operation of a preset business, functions stored on the server, or functions stored locally on the electronic device.

[0064] In some embodiments, the functions called during the execution of the preset service may include functions called during the execution of the target thread of the preset service. The target thread may be a thread among the threads of the preset service that meets a second preset condition, which includes one or more of the following: CPU utilization is greater than a preset threshold, or memory usage is greater than a preset threshold.

[0065] ROM can also store executable programs and data of users and applications, and can be pre-loaded into random access memory for direct reading and writing by the processor 110.

[0066] 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 electronic device 100. While charging the battery 132, the charging management module 130 can also supply power to the electronic device via the power management module 131.

[0067] 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, internal 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.

[0068] Electronic device 100 implements display functions through a GPU, a display screen 160, and an application processor. The GPU is a microprocessor for image processing, connecting 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.

[0069] The display screen 160 is used to display images, videos, etc. The display screen 160 includes a display panel. In some embodiments, the electronic device 100 may include one or N display screens 160, where N is a positive integer greater than 1.

[0070] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 140 and application processor.

[0071] 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.

[0072] Buttons 150 include a power button, volume buttons, etc. Buttons 150 can be mechanical buttons or touch-sensitive buttons. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.

[0073] The storage method provided in this application embodiment can be applied to... Figure 3 The electronic device 100 shown can be a terminal device. For example, the electronic device 100 can be a smartphone, laptop, in-vehicle device, or wearable device (such as a smartwatch). The following description uses an electronic device as an example of a terminal device to illustrate a storage method provided in this application.

[0074] Figure 4 This is a flowchart illustrating a storage method provided in an embodiment of this application, which is applied to a terminal device. Figure 4 As shown, the method includes the following S401-S404:

[0075] S401, determine the target file page containing the target data from the persistent memory.

[0076] The target data is data that meets the first preset condition. The first preset condition is determined based on user usage data and / or system operation data.

[0077] The persistent memory is non-volatile memory. In the embodiments of this application, the persistent memory can be a hard disk or flash memory, etc., and there is no limitation thereto. The following description uses a hard disk as the persistent memory as an example.

[0078] Specifically, the terminal device can first obtain the data identifier of the target data, and then, based on the data identifier of the target data, determine the file page in the persistent storage that stores the target data, i.e., the target file page.

[0079] In one optional implementation, the first preset condition may include at least one of the following: a) the number of accesses within a preset time period is greater than a preset number of accesses, or b) the access duration within a preset time period is greater than a preset duration. Access duration refers to the cumulative access duration within the preset time period. Therefore, the target data refers to frequently accessed data; thus, in this embodiment, the target data can also be referred to as hotspot data.

[0080] In this application embodiment, there are no limitations on the preset time period, preset number of times, and preset duration. For example, the preset time period can be the most recent week or the most recent three days. The preset number of times can be 100 times or 50 times. The preset duration can be 1 hour (h) or 30 minutes (min).

[0081] For example, assuming the preset time period is 10:00-11:00, the preset number of accesses is 20, and the preset duration is 30 minutes, the terminal device can identify the data that has been accessed more than 20 times within the 10:00-11:00 period and / or the data that has been accessed for more than 30 minutes as the target data.

[0082] In one optional implementation, the data satisfying the first preset condition includes one or more of the application data of functions and applications. That is, the target data may include one or more of the application data of functions satisfying the first preset condition (hereinafter referred to as hot functions) or applications satisfying the first preset condition (hereinafter referred to as hot applications). Accordingly, the data identifier of the target data may include the function identifier of the hot functions and the application identifier of the hot applications.

[0083] When the target data is a hot function, the access count in the first preset condition mentioned above can be the number of times the function is called, and the access duration can be the duration of the function call. In other words, a hot function is a function that, within a preset time period, has a more than preset number of calls and / or a longer call duration than a preset duration.

[0084] When the target data is application data of a popular application, the access count in the first preset condition mentioned above can be the number of times the application is launched, and the access duration can be the runtime of the application. In other words, a popular application refers to an application that, within a preset time period, has a launch count greater than a preset number of times and / or a runtime longer than a preset duration. Application data of a popular application refers to application data of applications that, within a preset time period, have a launch count greater than a preset number of times and / or a runtime longer than a preset duration.

[0085] Among them, the number of launches refers to the number of times the application changes from a non-running state to a running state, and the runtime refers to the duration the application remains in a running state.

[0086] The following uses the first preset conditions, including a) the number of visits within a preset time period is greater than the preset number of visits and b) the access duration within a preset time period is greater than the preset duration, as examples to explain the process of (1) the terminal device determining the function identifier of the hotspot function and (2) the terminal device determining the application identifier of the hotspot application.

[0087] (1) The terminal device determines the function identifier of the hotspot function.

[0088] Specifically, the terminal device can first determine the functions called within a preset time period, as well as the number of times each function is called and the duration of each call. Then, the terminal device can identify the function identifiers of functions with a call count greater than a preset number of calls, and the function identifiers of functions with a call duration greater than a preset duration, as the function identifiers of hotspot functions.

[0089] For example, in one embodiment, assuming the preset time period is from 10:00 AM on January 1, 2024 to 10:00 AM on January 2, 2024, the terminal device calls four functions during this time period: function A, function B, function C, and function D. Function A is called 100 times, with a cumulative call duration of 20 hours during this time period; function B is called 55 times, with a cumulative call duration of 5 hours during this time period; function C is called 30 times, with a cumulative call duration of 10 hours during this time period; and function D is called once, with a cumulative call duration of 1 hour during this time period. The preset number of calls is 50, and the preset duration is 7 hours. Therefore, it can be seen that the number of times functions A and B are called is greater than the preset number, and the cumulative call duration of functions A and C within the preset time period is greater than the preset duration. The terminal device can identify functions A, B, and C as hot functions, and identify the function identifiers of functions A, B, and C as the function identifiers of the hot functions.

[0090] In one optional implementation, hotspot functions may include at least one of the following: functions called during the operation of the operating system (hereinafter referred to as system hotspot functions) or functions called during the operation of a preset service (hereinafter referred to as service hotspot functions).

[0091] Pre-defined services may include: services related to user senses (such as sight and hearing) 1, such as display services like video playback, and audio services like voice calls and music playback. And services that provide timely responses to user actions 2.

[0092] The following uses the first preset conditions, including a) the number of accesses within a preset time period is greater than the preset number of accesses and b) the access duration within a preset time period is greater than the preset duration, as examples to explain the process of A) the terminal device determining the function identifier of the system hotspot function and B) the terminal device determining the function identifier of the business hotspot function.

[0093] A. The terminal device determines the function identifier of the system's hotspot functions.

[0094] In one optional implementation, the terminal device can first collect the functions called during the operation of the operating system within a preset time period, as well as the number of times each function is called and the duration of each call. Then, the terminal device can identify the function identifiers of functions with a call count greater than a preset number of times and the function identifiers of functions with a call duration greater than a preset duration as the function identifiers of system hotspot functions.

[0095] In the embodiments of this application, the terminal device can collect the functions called during the operation of the operating system, as well as the number of times and duration of each function call, through system logs. Alternatively, it can collect the functions called during the operation of the operating system, as well as the number of times and duration of each function call, through performance analysis tools (such as performance event recorder and analyzer (perf)). It can also collect the functions called during the operation of the operating system, as well as the number of times and duration of each function call, through method call counters. Or, it can use offline profile guided optimization (PGO) to determine the functions called during the operation of the operating system, as well as the number of times and duration of each function call. There are no limitations on this.

[0096] System logs refer to the log records generated by a terminal device during the operation of its operating system. System logs can include information such as the functions called during the operation of the operating system, the number of times each function is called, and the duration of each call.

[0097] perf is used to measure and analyze various performance metrics during the operation of the operating system, including CPU utilization, number of function calls, and call duration.

[0098] Using the above method, the function identifiers of system hotspot functions involved in the operation of the operating system on the terminal device within a preset time period can be determined based on the number of calls and the call duration. This allows the target file page containing the system hotspot functions to be located based on the function identifier, and the data in the target file page is then stored in the terminal device's memory. In this way, the terminal device can store only the data in the target file page in memory, instead of storing all the data in the entire file containing the system hotspot functions, thus avoiding storing non-target data from that file in memory and effectively saving memory storage space.

[0099] B. The terminal device determines the function identifier of the business hotspot function.

[0100] In one optional implementation, the terminal device can determine the functions called during the operation of a preset service, as well as the number of times each function is called and the duration of each call. Then, the terminal device can identify the function identifiers of functions with a call count greater than a preset number of calls and functions with a call duration greater than a preset duration as the function identifiers of the service's hot-spot functions.

[0101] In this embodiment, the preset service can be pre-configured by the developers. For example, the terminal device may have multiple service identifiers pre-configured, and the terminal device can determine the preset service based on the pre-configured service identifiers. The terminal device can also determine the preset service based on the response time of each service (i.e., the time interval from when the user initiates a request to when the terminal device provides a response). For example, if the expected response time of a certain service is less than the preset time interval, the terminal device can determine that service as the preset service without limitation.

[0102] In one optional implementation, the business hotspot function (i.e. the function called during the execution of the preset business) may include: the function called during the execution of the target thread of the preset business (hereinafter referred to as the thread hotspot function, or critical thread hotspot function).

[0103] The target thread is a thread among the threads of a preset business that meets a second preset condition. The second preset condition includes one or more of the following: CPU utilization is greater than a preset threshold, or memory usage is greater than a preset threshold. In this embodiment, the target thread may also be referred to as a critical thread.

[0104] When the preset services include Service 1 and Service 2 as described above, the target thread for Service 1 may include, but is not limited to, one or more of the following: image rendering thread, interface update thread, and audio playback thread. The image rendering thread is used to render images. The interface update thread is used to respond to user operations (clicks or swipes, etc.) and update the position of interface elements (such as menus, toolbars, application icons, etc.) on the display screen. The audio playback thread is used to output audio data. The target thread for Service 2 may include, but is not limited to, the input processing thread. The input processing thread is used to receive user input operations, such as keyboard input, clicks, swipes, etc.

[0105] Specifically, the terminal device can determine the function identifiers of thread hotspot functions using the following method: The terminal device can determine the target thread of a preset service, and determine the functions called during the execution of the target thread of the preset service, as well as the number of times each function is called and the call duration. Then, the terminal device can identify the function identifiers of functions whose number of calls exceeds a preset number, and the function identifiers of functions whose call duration exceeds a preset duration, as the function identifiers of thread hotspot functions.

[0106] In one optional implementation, the terminal device may determine the target thread of the preset service by: obtaining resource usage information of each thread during the operation of the preset service, and determining the key thread based on the resource usage information of each thread.

[0107] The resource usage information for each thread may include, but is not limited to, CPU utilization or memory utilization.

[0108] For example, taking CPU utilization as the resource usage information of threads, suppose that the terminal device runs three threads during the execution of service A, namely thread 1, thread 2 and thread 3. The CPU utilization of thread 1 is 50%, the CPU utilization of thread 2 is 25%, the CPU utilization of thread 3 is 25%, and the preset threshold is 30%. Then the terminal device can use thread 1 as the target thread of service A.

[0109] In one optional implementation, during the operation of the operating system or the execution of preset services, the terminal device can call functions not only those stored locally but also those stored in the cloud server. Therefore, the aforementioned "hotspot functions" (i.e., functions that satisfy the first preset condition) may further include at least one of the following: functions stored in the cloud server or functions stored locally on the terminal device.

[0110] By using the above method, the function identifiers of the business hotspot functions or thread hotspot functions called by the target thread during the execution of the preset business within a preset time period can be determined based on the number of calls and the call duration. This allows the target file page containing the business hotspot functions or thread hotspot functions to be located based on the function identifier, and the data in the target file page is stored in the terminal device's memory. In this way, while effectively saving memory storage space, it further ensures that memory storage resources are used for the preset business. The preset business can be related to the user's senses (such as sight and hearing) and operations. Thus, during the execution of the preset business, the terminal device can promptly call the relevant thread hotspot functions from memory to quickly respond to the preset business and enhance the user experience.

[0111] (2) The terminal device determines the application identifier of the hot application.

[0112] In one optional implementation, the terminal device can obtain the number of times each application is launched and its runtime within a preset time period. Then, the terminal device can identify applications with more than a preset number of launches and applications with a runtime exceeding a preset duration as "hot" application identifiers.

[0113] For example, a terminal device has applications A, B, and C installed. The preset time period is from 10:00 AM on January 1, 2024 to 10:00 AM on January 2, 2024. During this time period, application A is launched 20 times, application B is launched 5 times, and application C is launched 1 time, with a preset launch count of 10 times. The cumulative runtime of application A during this time period is 1 hour, application B is launched 30 minutes, and application C is launched 10 hours, with a preset runtime of 5 hours. Therefore, it can be seen that the number of times application A is launched during this time period exceeds the preset launch count, and the cumulative runtime of application C during this time period exceeds the preset runtime. The terminal device can use the identifiers of application A and application C as the application identifiers of the frequently used applications.

[0114] In one optional implementation, the terminal device can obtain the runtime and launch count of each application in the following ways: (1) The terminal device can obtain the runtime and launch count of each application through application logs. (2) The terminal device can obtain the runtime and launch count of each application through third-party software, that is: the terminal device can detect the runtime and launch count of each application through third-party software within a preset time period, and determine the hot applications based on the runtime and launch count of each application detected by the third-party software. This application embodiment does not limit the method by which the terminal device obtains the runtime and / or launch count of each application.

[0115] Application logs refer to the log records generated by a terminal device during the running of various applications. Application logs can include the runtime and number of times each application is launched within a preset time period.

[0116] Using the methods described above, for each user, the number of times each application is launched and its runtime within a preset time period can be determined based on the user's usage habits. This allows for the identification of frequently used applications, i.e., "hot" applications. This data can then be stored in memory. Subsequently, when the user uses these hot applications, the terminal device can promptly retrieve their application data from memory to quickly respond to user actions related to these applications, thereby enhancing the user experience.

[0117] In this embodiment of the application, in addition to determining hot applications based on the number of times each application is launched and the runtime of each application within a preset time period, the terminal device can also determine hot applications through at least one of the following methods: determining the applications recently used by the user (such as those used in the last minute) as hot applications; or determining the hot applications corresponding to the current moment based on the historical time period of the user's use of each application; or determining the hot applications based on the association or jump relationship between applications; or determining the hot applications corresponding to the user's current location based on the geographical location of the user's use of each application; or determining the hot applications based on its own state; or determining the hot applications based on the weight of each application.

[0118] The weights of each application can be preset.

[0119] In one alternative implementation, the weight of each application can be updated based on the frequency with which the user uses the application. For example, if the user does not use the application within a preset time period, the terminal device can reduce the weight of the application.

[0120] After determining the data identifier of the target data using the above method, the terminal device can determine the target file page based on the data identifier of the target data. The following examples, taking (3) target data as hotspot function and (4) target data as application data of hotspot application, further illustrate the process by which the terminal device determines the target file page based on the data identifier of the target data.

[0121] (3) The target data is a hotspot function.

[0122] In one optional implementation, the terminal device may store function identifiers and the correspondence between the function's starting position and length. In this embodiment, the function's starting position refers to the position of the first character of the function. The function's length refers to the length between the first and last characters of the function.

[0123] Based on this, after obtaining the function identifier of the hotspot function through S401, the terminal device can determine the starting position and length of the hotspot function. Based on the starting position and length of the hotspot function, the terminal device can determine the file offset of the hotspot function in persistent storage. Finally, based on the file offset of the hotspot function in persistent storage, the terminal device can determine the file page in persistent storage that stores the hotspot function, i.e., the target file page.

[0124] In one alternative implementation, the persistent storage may contain multiple files, each containing a different function. The terminal device may store function identifiers, file identifiers, and the correspondence between the function's start position and length.

[0125] Based on this, after obtaining the function identifier of the hotspot function through S401, the terminal device can determine the file identifier corresponding to the hotspot function, as well as the starting position and length of the hotspot function. Based on the file identifier, the terminal device can determine the file containing the hotspot function (hereinafter referred to as the first file). Based on the starting position and length of the hotspot function, the terminal device can determine the file offset of the hotspot function in the first file. Finally, based on the file offset of the hotspot function in the first file, the terminal device can determine the file page in the first file containing the hotspot function, i.e., the target file page.

[0126] In one optional implementation, the first file mentioned above may include, but is not limited to, dynamic link library files (such as .so files), executable files (such as .exe files and .elf files), and static link library files (such as .a files and .lib files), etc., and this application embodiment does not limit this.

[0127] In one optional implementation, the terminal device may store the correspondence between function identifiers, file identifiers, and file page identifiers. After obtaining the function identifier of the hotspot function through S401, the terminal device can determine the file identifier and file page identifier corresponding to the hotspot function. Based on the file identifier, the terminal device can determine the first file storing the hotspot function, and based on the file page identifier, determine the file page in the first file used to store the hotspot function, i.e., the target file page.

[0128] (4) The target data is application data of popular applications.

[0129] When the target data is application data of a hot application, the terminal device can refer to the description in (3) above to determine the target file page corresponding to the application data of the hot application. The following describes the process of the terminal device determining the target file page corresponding to the application data of the hot application by taking the correspondence between the application identifier, file identifier and file page identifier stored in the terminal device as an example.

[0130] After obtaining the application identifier of the hot application through S401, the terminal device can determine the file containing the application data of the hot application (hereinafter referred to as the second file) based on the file identifier corresponding to the hot application, and determine the file page in the second file used to store the application data of the hot application, i.e., the target file page, based on the file page identifier corresponding to the hot application.

[0131] In one alternative implementation, the second file can be a file under the data partition. The data partition is used to store application data of various applications installed by the user on the terminal device, such as user data, cache data, etc., and this data can be stored in the data partition in units of pages to enable fast reading and writing when needed.

[0132] S402 stores the relevant data in the target file page into the memory of the terminal device.

[0133] Specifically, after the terminal device determines the target file page containing the target data through S402, it can store the relevant data of the target file page into the memory of the terminal device.

[0134] It is understood that the relevant data of the target file page can be the relevant data of the target file page itself, or the data called in the target file page. This application embodiment does not limit this.

[0135] By using the above method, the terminal device can store only the data in the target file page in memory, without storing the data stored in other file pages besides the target file page, which can effectively save memory space.

[0136] In one alternative implementation, after the terminal device determines the target file page containing the target data, it can read the target data from the target file page and store the target data in the terminal device's memory.

[0137] Specifically, the terminal device can read target data from the target file page and store the target data in its own memory in units of pages.

[0138] By using the above method, when the target file page contains data other than the target data, the terminal device can store only the target data in memory, without storing the other data contained in the target file page, which can further save memory space.

[0139] In one alternative implementation, the terminal device may store the target data in an LRU list in memory.

[0140] Optionally, the LRU list may include at least one of the following: a protection list, an active list, or an inactive list.

[0141] Specifically, taking the storage of target data in a protection list by a terminal device as an example, the LRU list can include a head and a tail, and the data at the head of the list has a higher activity level than the data at the tail. When storing target data in the LRU list, the terminal device can write the target data in page units at the head position of the protection list.

[0142] In some embodiments, after writing target data at the head of the protection list, if data overflows at the tail of the protection list, the terminal device can reclaim the overflowing data at the tail of the protection list to the hard disk.

[0143] In other embodiments, after writing target data to the head of the protection list, if data overflows from the tail of the protection list, the terminal device can store the overflowing data from the tail of the protection list at the head of the active list in the LRU list. After writing data to the head of the active list, if data overflows from the tail of the active list, the terminal device can store the overflowing data from the tail of the active list at the head of the inactive list in the LRU list. After writing data to the head of the inactive list, if data overflows from the tail of the inactive list, the terminal device can reclaim the overflowing data from the tail of the inactive list to the hard disk.

[0144] When reclaiming memory from an LRU list, the file pages in the inactive list are reclaimed first, then the file pages in the active list are reclaimed, and finally the file pages in the protection list are reclaimed. Therefore, storing the target data in the protection list can extend the time that the target data resides in memory.

[0145] In one alternative implementation, the terminal device may also periodically update the target data stored in memory.

[0146] Specifically, the terminal device can be accessed through the above... Figure 4 The method shown periodically retrieves target data from persistent storage and updates the target data stored in its own memory based on the periodically retrieved target data.

[0147] Through the above technical solution, the terminal device can store the hot data (i.e., target data) stored in the hot page (i.e. target file page) in memory, which can avoid storing the data in the cold page (file pages other than the target file page) in memory, thus effectively saving memory storage space.

[0148] The following will describe the storage method provided in this application embodiment, taking the hot data including system hot functions, thread hot functions and application data of hot applications, with the file storing system hot functions being a .so file, the file storing thread hot functions being a .lib file, and the file storing application data of hot applications being a file under the data partition (hereinafter referred to as the data file).

[0149] Figure 5 A flowchart illustrating another storage method provided in an embodiment of this application is shown below. Figure 5 As shown, the method includes the following Figure 5 S501-S506 shown in (a) Figure 5 S507-S512 shown in (b) and Figure 5 One or more of S513-S517 shown in (c).

[0150] S501, determine the function identifier of the system hotspot function.

[0151] S502, based on the function identifier of the system hotspot function, determine the starting position and length of the system hotspot function in the .so file.

[0152] S503 determines the file offset of the system hotspot function in the .so file based on the starting position and length of the system hotspot function in the .so file.

[0153] S504 determines the target file page of the system hotspot function in the .so file based on the file offset of the system hotspot function in the .so file.

[0154] S505 reads system hotspot functions from the object file pages of the .so file.

[0155] S506 stores system hotspot functions in a protection list.

[0156] The specific steps for S501-S505 can be found in the description in S401 above, and will not be repeated here. The specific steps for S506 can be found in the description in S402 above, and will not be repeated here.

[0157] S507, Determine the function identifier of the thread hotspot function.

[0158] S508 determines the starting position and length of the thread hotspot function in the .lib file based on the function identifier of the thread hotspot function.

[0159] S509, determine the file offset of the thread hotspot function in the .lib file based on the starting position and length of the thread hotspot function in the .lib file.

[0160] S510 determines the target file page of the thread hotspot function in the .lib file based on the file offset of the thread hotspot function in the .lib file.

[0161] S511 reads the thread hotspot function from the object file page of the .lib file.

[0162] S512 stores thread hotspot functions in a protected linked list.

[0163] The specific steps of S507-S511 can be found in the description of S401 above, and will not be repeated here. The specific steps of S512 can be found in the description of S402 above, and will not be repeated here.

[0164] S513, identify the application identifier of hot applications.

[0165] S514, determine the file page identifier of the hot application in the data file based on the application identifier of the hot application.

[0166] S515: Determine the target file page corresponding to the hot application in the data file based on the file page identifier of the hot application in the data file.

[0167] S516: Read the application data of the hot application from the target file page corresponding to the hot application in the data file.

[0168] S517 stores application data for hot applications in the protection list.

[0169] The specific steps of S513-S516 can be found in the description in S401 above, and will not be repeated here. The specific steps of S517 can be found in the description in S402 above, and will not be repeated here.

[0170] Understandable. Figure 5 S501-S506 shown in (a) Figure 5 S507-S512 shown in (b) and Figure 5 The order of S513-S517 shown in (c) is not fixed. That is, S501-S506, S507-S512 and S513-S517 can be executed simultaneously, or S501-S506 can be executed first, then S507-S512, and finally S513-S517. Alternatively, S501-S506 and S507-S512 can be executed first, and then S513-S517 can be executed.

[0171] Understandable. Figure 5 S501-S506 shown in (a) Figure 5 S507-S512 shown in (b) orFigure 5 S513-S517 shown in (c) can be used in any combination, that is, the terminal device can execute Figure 5 S501-S506 shown in (a) can also be executed. Figure 5 S501-S506 and shown in (a) Figure 5 S507-S512 shown in (b) or, Figure 5 S507-S512 and shown in (b) Figure 5 S513-S517 shown in (c) can also execute Figure 6 S501-S506 shown in (a) Figure 6 S507-S512 shown in (b) and Figure 7 S513-S517 shown in (c) are not limited.

[0172] Figure 8 This is a software structure block diagram of a terminal device provided in an embodiment of this application. For example... Figure 8 As shown, the terminal device may include a system service layer and a memory management layer.

[0173] The system service layer may include a system hotspot function determination module, a thread hotspot function determination module, a user habit recognition module, and a target file page retrieval module. The memory management layer may include a file page configuration module.

[0174] The system hotspot function determination module periodically identifies system hotspot functions from functions stored on the cloud server and functions stored on the terminal device itself during operating system operation. It then sends the function identifiers of the system hotspot functions to the target file page retrieval module. Based on the function identifiers, the target file page retrieval module can determine the file containing the system hotspot function, as well as the starting position and length of the system hotspot function. Based on the starting position and length of the system hotspot function, it can determine the file offset of the system hotspot function within the file containing the system hotspot function. Finally, based on the file offset, it can determine the target file page containing the system hotspot function within the file containing the system hotspot function.

[0175] The thread hotspot function determination module is used to periodically determine thread hotspot functions from functions stored on the cloud server and functions stored on the terminal device itself during the execution of critical threads of preset business processes. It then sends the function identifier of the thread hotspot function to the target file page retrieval module. The target file page retrieval module can determine the file containing the thread hotspot function, as well as the starting position and length of the thread hotspot function, based on the function identifier. Based on the starting position and length of the thread hotspot function, it can determine the file offset of the thread hotspot function in the file containing the thread hotspot function, and then determine the target file page containing the system hotspot function in the file containing the thread hotspot function based on the file offset.

[0176] The user habit recognition module periodically identifies frequently used applications and sends their application identifiers to the target file page retrieval module. Based on these application identifiers, the target file page retrieval module determines the corresponding file identifier and file page identifier. Then, based on these file identifiers and file page identifiers, the target file page retrieval module identifies the target file page containing the application data for the frequently used applications.

[0177] The target file page retrieval module can read system hot functions from target file pages storing system hot functions, thread hot functions from target file pages storing thread hot functions, and application data for hot applications from target file pages storing application data for hot applications. Then, the target file page retrieval module can send the system hot functions, thread hot functions, and application data for hot applications to the file page configuration module in the memory management layer.

[0178] The file page configuration module can store application data for system hot functions, thread hot functions, and hot applications in the protection list of the LRU list.

[0179] In addition, the file page configuration module can also perform memory reclamation when memory space is insufficient. Specifically, it prioritizes reclamating file pages in the inactive list of the LRU list, then reclaims file pages in the active list of the LRU list, and finally reclaims file pages in the protected list of the LRU list.

[0180] The above primarily describes the solutions provided by the embodiments of this application from the perspective of electronic devices. Correspondingly, the embodiments of this application also provide a storage device for implementing the various methods described above. This storage device can be an electronic device as described in the method embodiments above, or a component that can be used in an electronic device. 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.

[0181] 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.

[0182] For example, taking a storage device as an example of the electronic device in the above method embodiments, ​ A schematic diagram of an electronic device is shown, which includes a determination module 701 and a storage module 702.

[0183] The determination module 701 is used to determine the target file page containing the target data from the persistent storage.

[0184] The target data is the data that meets the first preset condition, which is determined based on the user's usage data and / or the system's operating data.

[0185] Storage module 702 is used to store the relevant data of the target file page into the memory of the electronic device.

[0186] Optionally, the first preset condition includes one or more of the following conditions: the number of times the device is accessed within a preset time period is greater than the preset number of times, or the duration of access within a preset time period is greater than the preset duration.

[0187] Optionally, the data that satisfies the first preset condition includes one or more of the application data of the function or application.

[0188] Optionally, the above functions include one or more of the following: functions called during the operation of the operating system, functions called during the operation of preset services, functions stored on the server, or functions stored locally on the electronic device.

[0189] Optionally, the functions called during the execution of the aforementioned preset service may include: functions called during the execution of the target thread of the preset service. The target thread is a thread in the preset service that meets the second preset condition; the second preset condition includes one or more of the following conditions: the central processing unit (CPU) utilization rate is greater than a preset threshold, or the memory utilization rate is greater than a preset threshold.

[0190] Optionally, when the target data includes a function, the determination module 701 is specifically used to: determine the starting position and length of the function based on the function identifier, determine the file offset of the function based on the starting position and length, and determine the target file page from the persistent storage based on the file offset.

[0191] Optionally, the aforementioned electronic device also includes an update module, which is specifically used to periodically update the relevant data of the target file page stored in memory.

[0192] Optionally, the aforementioned storage module 702 is specifically used to: store relevant data in the target file page in an LRU linked list in memory. The LRU linked list includes at least one of a protection linked list, an active linked list, and an inactive linked list.

[0193] Optionally, when the LRU list is a protection list, the above storage module 702 is specifically used to: store the relevant data in the target file page in the protection list.

[0194] 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.

[0195] 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.

[0196] Optionally, embodiments of this application also provide a storage device. For example... ​ As shown, the storage device includes a bus 801, a processor 802, a memory 803, and a communication interface 804. The processor 802, the memory 803, and the communication interface 804 communicate with each other via the bus 801. The storage device can be a terminal device. It should be understood that this application does not limit the number of processors and memories in the storage device.

[0197] The 801 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, ​ The bus 801 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 801 may include a path for transmitting information between various components of the storage device (e.g., memory 803, processor 802, communication interface 804).

[0198] Processor 802 may include any one or more processors such as CPU, GPU, microprocessor (MP), or digital signal processor (DSP).

[0199] The memory 803 may include volatile memory, such as RAM. The processor 802 may also include non-volatile memory, such as ROM, flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0200] The memory 803 stores executable program code, and the processor 802 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 803 stores instructions for executing the storage method provided in this application embodiment.

[0201] The communication interface 804 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.

[0202] 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.

[0203] 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.

[0204] 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)).

[0205] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, the disclosure, and the 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 instances. 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.

[0206] 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 electronic devices, the method includes: The target file page containing the target data is determined from the persistent storage; wherein the target data is data that satisfies a first preset condition; the first preset condition is determined based on user usage data and / or system operation data; The relevant data in the target file page is stored in the memory of the electronic device.

2. The method according to claim 1, characterized in that, The first preset condition includes one or more of the following: The number of visits within a preset time period exceeds the preset number; The access duration within the preset time period exceeds the preset duration.

3. The method according to claim 1 or 2, characterized in that, The data that satisfies the first preset condition includes one or more of the following: function; Application data.

4. The method according to claim 3, characterized in that, The function includes one or more of the following: Functions called during the operation of the operating system; Preset functions to be called during business operations; Functions stored on the server; The functions stored locally by the electronic device.

5. The method according to claim 4, characterized in that, The functions called during the operation of the preset service include: functions called during the operation of the target thread of the preset service; The target thread is the thread in the preset service that meets the second preset condition; the second preset condition includes one or more of the following conditions: the CPU utilization rate is greater than a preset threshold, or the memory occupancy rate is greater than a preset threshold.

6. The method according to any one of claims 1-5, characterized in that, In the case that the target data includes a function, determining the target file page storing the target data from the persistent storage includes: Based on the function identifier, determine the starting position and length of the function; Based on the starting position and the length, determine the file offset of the function; The target file page is determined from the persistent storage based on the file offset.

7. The method according to any one of claims 1-6, characterized in that, The method further includes: The relevant data of the target file page stored in the memory is updated periodically.

8. The method according to any one of claims 1-7, characterized in that, The step of storing the relevant data in the target file page into the memory of the electronic device includes: The relevant data in the target file page is stored in a Least Recently Used (LRU) linked list in the memory; the LRU linked list includes at least one of a protection linked list, an active linked list, and an inactive linked list.

9. The method according to claim 8, characterized in that, The LRU list is a protected list; The storage of relevant data in the target file page in the Least Recently Used (LRU) linked list in memory includes: The relevant data in the target file page is stored in the protection chain list.

10. An electronic device, 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-9.

11. 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-9.

12. 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-9.