Storage method, electronic device, storage medium and program product
By determining target data based on user and system data and optimizing LRU list management, only frequently accessed file page data is stored, thus solving the problem of wasted memory storage space and improving memory utilization and device response speed.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-06-09
- Publication Date
- 2026-04-02
AI Technical Summary
During memory access, the amount of data in the file to be stored is huge, resulting in wasted linked list storage space. Existing technologies have failed to effectively save memory storage space.
Target data is determined based on user usage data and system operation data. Only data from target file pages that meet preset conditions is stored in memory, while data from other file pages is removed. LRU list management is optimized, including dynamic adjustment of the protection list, active list, and inactive list.
It effectively saves memory storage space, ensures that frequently accessed data is quickly available in memory, and improves the responsiveness of electronic devices and user experience.
Smart Images

Figure CN2025099989_02042026_PF_FP_ABST
Abstract
Description
Storage method, electronic device, storage medium and program product
[0001] The present application claims priority to the Chinese patent application No. 202411336825.0, filed on September 24, 2024, and entitled "Storage method, electronic device, storage medium and program product", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD
[0002] The present application relates to the field of storage, in particular to a storage method, an electronic device, a storage medium and a program product. BACKGROUND
[0003] In the process of caching files using a page cache mechanism, the data in the files can be cached in a random access memory (RAM) in units of pages to form a plurality of file pages. These file pages can be managed in a least recently used (LRU) linked list based on an LRU algorithm.
[0004] 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
[0005] 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.
[0006] To achieve the above-mentioned purpose, the embodiments of the present application provide the following technical solutions:
[0007] In a first aspect, a storage method is provided, which can be executed by an electronic device, or can be executed by a module applied in the electronic device, such as a chip, a chip system or a circuit, or can be realized by a logic module or software which can realize all or part of the functions of the electronic device, and the present application is not limited in this regard. For ease of description, the following will be described by taking the execution by the electronic device as an example.
[0008] The method comprises: determining a target file page in which target data is stored from a persistent storage, and storing related data in the target file page to a memory of the electronic device.
[0009] 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.
[0010] According to the technical solution, the target data is determined according to the use data of the user and the running data of the system, the electronic device can store the related data in the target file page storing the target data into the internal memory, and does not need to store the data in other file pages in the persistent storage except the target file page into the internal memory, thereby effectively saving the storage space of the internal memory.
[0011] In an optional implementation, the first preset condition includes one or more of the following conditions: the number of times of being accessed in a preset time period is greater than a preset number of times, or the length of time of being accessed in the preset time period is greater than a preset length of time.
[0012] According to the technical solution, the target data is frequently accessed data, the electronic device can store the related data in the target file page storing the target data into the internal memory, and does not need to store the data in other file pages in the persistent storage except the target file page into the internal memory, thereby effectively saving the storage space of the internal memory.
[0013] In an optional implementation, the data satisfying the first preset condition includes one or more of the application data of the function or the application.
[0014] The above technical solution limits the target data, that is, the target data can include the function satisfying the first preset condition and / or the application data of the application satisfying the first preset condition. Storing the function satisfying the first preset condition in the internal memory can ensure that the function can be called in time in subsequent calling of the function. Storing the application data of the application satisfying the first preset condition in the internal memory can ensure that the electronic device can quickly access the application data of the application from the internal memory in subsequent use of the application by the user, thereby quickly responding to the operation of the user on the application and enhancing the experience of the user.
[0015] In an optional implementation, the above function can include one or more of the function called in the running process of the operating system, the function called in the running process of the preset service, the function stored in the server, or the function stored locally in the electronic device.
[0016] Storing the function called in the running process of the operating system in the internal memory can enable the electronic device to quickly call the related function from the internal memory when the operating system is running, thereby ensuring the running speed of the operating system and enhancing the experience of the user. Storing the function called in the running process of the preset service in the internal memory can ensure that the storage resources of the internal memory are used for the preset service. In this way, the terminal device can timely call the related function from the internal memory in the process of executing the preset service, so as to quickly respond to the preset service and enhance the experience of the user.
[0017] In an optional implementation, the function called in the preset service running process can include a function called in a target thread running process of the preset service. The target thread is a thread of the preset service that meets a second preset condition. The second preset condition includes one or more of the following conditions: a central processing unit (CPU) usage is greater than a preset threshold, or a memory occupancy rate is greater than a preset threshold.
[0018] The technical solution described above further limits the function called in the preset service running process. The function called in the target thread running process of the preset service can be stored in the memory, so as to further save the storage space of the memory.
[0019] In an optional implementation, when the target data includes the function, the determining, from the persistent storage, the target file page in which the target data is stored can specifically include: determining, based on the function identifier of the function, a starting position and a length of the function, determining a file offset of the function based on the starting position and the length, and determining, based on the file offset, the target file page from the persistent storage.
[0020] The starting position refers to the position of the first character of the function. The length refers to the length between the first character and the last character of the function.
[0021] The technical solution described above provides a method for determining a target file page. In this way, the electronic device can quickly determine the target file page in which the function is stored by using the file offset of the function, thereby effectively improving the efficiency of the electronic device in determining the target data.
[0022] In an optional implementation, the method can further include periodically updating the related data of the target file page stored in the memory.
[0023] Through the technical solution described above, the electronic device can periodically update the related data of the target file page stored in the memory, so that the data in the memory can always be kept up-to-date, so as to ensure that the electronic device can call the data from the memory in time, ensure the running speed of the electronic device, and enhance the user experience.
[0024] In an optional implementation, the storing, into the memory of the electronic device, of the related data of the target file page can specifically include: storing the related data in the target file page in an LRU linked list of the memory. The LRU linked list includes at least one of a protection linked list, an active linked list, and an inactive linked list.
[0025] The LRU linked list can dynamically adjust the data stored therein according to the usage frequency and the recent access time of the data. When the memory space is limited, the least recently used data is automatically discarded to make room for new data, thereby further improving the utilization of the memory.
[0026] The above technical solution also limits the LRU linked list, that is, the LRU linked list is at least one of a guard linked list, an active linked list, and an inactive linked list, which can improve the realizability of the application on the basis of expanding the compatibility of the application.
[0027] In an optional implementation, when the LRU linked list is a guard linked list, the above storing of the related data in the target file page in the LRU linked list of the memory can specifically include storing the related data in the target file page in the guard linked list.
[0028] Through the above technical solution, the related data in the target file page can be stored in the guard linked list, the recovery time of the guard linked list is slow, and the storage duration of the related data in the target file page in the guard linked list can be prolonged.
[0029] In a second aspect, a storage device is provided, which is located in an electronic device and includes function units for performing any one of the methods provided in the first aspect, and the actions performed by each function unit are implemented by hardware or corresponding software executed by hardware.
[0030] The device includes a determination module and a storage module. The determination module is configured to determine a target file page in which target data is stored from a persistent storage. The storage module is configured to store related data of the target file page to a memory of the electronic device.
[0031] The target data is data satisfying a first preset condition, and the first preset condition is determined according to usage data of a user and / or running data of a system.
[0032] In a third aspect, an electronic device is provided, which includes a memory and a processor. The memory is configured to store program code, and the processor is configured to invoke the program code to perform any one of the storage methods provided in the first aspect.
[0033] In a fourth aspect, a computer-readable storage medium is provided, which includes program code. When the program code is executed on a computer or a processor, the computer or the processor performs any one of the storage methods provided in the first aspect.
[0034] In a fifth aspect, a computer program product is provided, which includes instructions. When the instructions are executed on a computer, the computer performs any one of the storage methods provided in the first aspect.
[0035] It should be noted that the technical effects brought by any one of the implementation manners of the second aspect to the fifth aspect can refer to the technical effects brought by the corresponding implementation manners in the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS
[0036] FIG. 1 is a schematic diagram of a memory in the related art;
[0037] FIG. 2 is a schematic diagram of memory recycling in the related art;
[0038] FIG. 3 is a schematic diagram of the structure of an electronic device according to an embodiment of the present application;
[0039] FIG. 4 is a schematic diagram of the flow of a storage method according to an embodiment of the present application;
[0040] FIG. 5 is a schematic diagram of the flow of another storage method according to an embodiment of the present application;
[0041] FIG. 6 is a block diagram of the software structure of a terminal device according to an embodiment of the present application;
[0042] FIG. 7 is a schematic diagram of the structure of another electronic device according to an embodiment of the present application;
[0043] FIG. 8 is a schematic diagram of the structure of a storage device according to an embodiment of the present application. DETAILED DESCRIPTION
[0044] In the description of the present application, unless otherwise specified, " / " means "or", for example, A / B can mean A or B. "And / or" in this document is only a description of the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can mean: A exists alone, A and B exist together, and B exists alone. In addition, "at least one" means one or more, and "multiple" means two or more. "First", "second", and the like do not limit the quantity and execution order, and "first", "second", and the like do not necessarily mean different.
[0045] It should be noted that in the embodiments of the present application, "exemplary" or "for example" and the like are used to mean as an example, illustration or description. Any embodiment or design scheme described as "exemplary" or "for example" in the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the use of "exemplary" or "for example" and the like is intended to present the relevant concept in a specific manner.
[0046] It is to be understood that the terminology "embodiment" mentioned in the specification throughout means that the specific features, structures, or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, in the entire specification, the various embodiments do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics can be combined in one or more embodiments in any suitable manner. It is to be understood that in various embodiments of the present application, the magnitude of the sequence number of each process does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0047] In the present application, the same or similar parts between various embodiments can be mutually referred to, unless otherwise specified. In various embodiments of the present application, if there is no special specification and no logical conflict, the terms and / or descriptions between different embodiments are consistent and can be mutually referred to, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationship. The following embodiments of the present application do not constitute a limitation on the protection scope of the present application.
[0048] Important components for storing data in a computer can include a central processing unit (CPU) cache, a random access memory (RAM), and a read-only memory (ROM). As shown in FIG. 1, when the CPU needs to execute an instruction or access data in a certain file, it will first check whether the required instruction or data is in the memory. Specifically, the CPU can first check whether the required instruction or data is in the CPU cache. If the CPU cache does not have the required instruction or data, the CPU will read the data from the RAM, and the reading delay is 20 nanoseconds (ns). If the RAM also does not have the required instruction or data, the CPU can continue to read the data from the ROM, and the reading delay is 200 ns.
[0049] From the above, it can be seen that the speed of reading data from the ROM by the CPU is much slower than that of reading data from the RAM. In order to avoid the need for reading operation on the ROM every time data is read, a page cache mechanism can be used to cache data in the file in the RAM. Specifically, in the process of using the page cache mechanism to cache the file, the data in the file is cached in the RAM in units of pages, forming a plurality of file pages. These file pages can be managed in an LRU linked list based on the LRU algorithm.
[0050] The common LRU list can include an active LRU and an inactive LRU. The active LRU is used to store the file pages that have been accessed recently, and the inactive LRU is used to store the file pages that have not been accessed recently. Therefore, when the memory is recycled, the file pages in the inactive LRU are recycled first, and then the file pages in the active LRU are recycled.
[0051] In order to better manage the important file pages, a protect Lru scheme is proposed. In the protect Lru scheme, it is proposed in particular that an LRU list (hereinafter referred to as a protection list) is added for storing the important file pages. In addition, as shown in FIG. 2, when the memory is recycled, the file pages in the inactive LRU are recycled first, the file pages in the active LRU are recycled second, and the file pages in the protection list are recycled last.
[0052] At present, in the memory access process, the page fault frequency of each file can be determined according to the page fault frequency of each file, and then the file to be stored can be determined according to the page fault frequency and the file size of each file, and the file to be stored is stored in each list (including the protection list, the active LRU and the inactive LRU) in units of pages. The amount of data in the file to be stored is often very large, but the data that is frequently accessed usually cannot account for 100%. This means that when the file to be stored is stored in the list, the data in the file to be stored that is not frequently accessed will also occupy the storage space of the list, resulting in waste of the storage space of the list, and further waste of the storage space of the memory.
[0053] In view of this, the embodiment of the present application provides a storage method applied to an electronic device. Specifically, the electronic device can determine a target file page in which target data is stored from a persistent storage, and store related data of the target file page to the memory of the electronic device. The target data is data satisfying a first preset condition, and the first preset condition is determined according to user usage data and / or system running data.
[0054] It can be known from the above technical solution that the target data is determined according to the user usage data and the system running data, and the electronic device can store the related data in the target file page in which the target data is stored to the memory of the electronic device, without storing the data in other file pages in the persistent storage to the memory, so that the storage space of the memory can be effectively saved.
[0055] The technical solution provided by the present application will be described below in conjunction with the accompanying drawings. FIG. 3 shows a structural schematic diagram of an electronic device 100.
[0056] The electronic device 100 can include a processor 110, an internal memory 120, a charging management module 130, a power management module 131, a battery 132, an audio module 140, a key 150, a display screen 160, and the like.
[0057] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than shown, or combine certain components, or split certain components, or different arrangement of components. The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0058] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices, or can be integrated in one or more processors.
[0059] The processor 110 can also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can save instructions or data that the processor 110 has just used or repeatedly uses. If the processor 110 needs to use the instructions or data again, it can be directly called from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the system.
[0060] The internal memory 120 can include one or more RAMs. The internal memory 120 can also include one or more ROMs.
[0061] The RAM can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of operating systems or other running programs, and can also be used to store user and application data, etc.
[0062] In the embodiments of the present application, the target data can be stored in the RAM. The target data is data satisfying a first preset condition, and the first preset condition includes one or more of the following conditions: the number of accesses in a preset time period is greater than a preset number, or the access duration in a preset time period is greater than a preset duration.
[0063] In some embodiments, the data satisfying the first preset condition described above can include one or more of the application data of a function or an application. The function refers to a software unit, a software code, or a software program that can implement one or certain functions. The application data of the application can include user data, cache data, and functions called during application running, etc.
[0064] In some embodiments, the function described above includes one or more of the following: a function called during operation of an operating system, a function called during operation of a preset service, a function stored by a server, or a function stored locally by the electronic device.
[0065] In some embodiments, the function called during operation of the preset service can include a function called during operation of a target thread of the preset service. The target thread can be a thread of the preset service that satisfies a second preset condition, and the second preset condition includes one or more of the following: the CPU usage is greater than a preset threshold, or the memory occupancy is greater than a preset threshold.
[0066] The ROM can also store executable programs and data of users and application programs, etc., which can be loaded into the random access memory in advance for direct reading and writing by the processor 110.
[0067] The charging management module 130 is configured to receive charging input from a charger. The charger can be a wireless charger or a wired charger. In some embodiments of wired charging, the charging management module 130 can receive charging input from a wired charger through a USB interface. In some embodiments of wireless charging, the charging management module 130 can receive wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 130 can charge the battery 132 while also supplying power to the electronic device through the power management module 131.
[0068] The power management module 131 is configured to connect 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 supply power to the processor 110, the internal memory 120, and the display screen 160, etc. In other embodiments, the power management module 131 can also be disposed in the processor 110. In still other embodiments, the power management module 131 and the charging management module 130 can also be disposed in the same device.
[0069] The electronic device 100 implements display functions through a GPU, the display screen 160, and an application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 160 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that execute program instructions to generate or change display information.
[0070] 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 can include 1 or N display screens 160, N being a positive integer greater than 1.
[0071] The electronic device 100 can implement audio functions through the audio module 140, and an application processor, etc. For example, music playing, recording, etc.
[0072] The audio module 140 is used to convert digital audio information into an analog audio signal output, and is also used to convert an analog audio input into a digital audio signal. The audio module 140 can also be used to encode and decode audio signals. In some embodiments, the audio module 140 can be disposed in the processor 110, or part of the functions of the audio module 140 can be disposed in the processor 110.
[0073] The keys 150 include a power-on key, a volume key, etc. The keys 150 can be mechanical keys. They can also be touch keys. The electronic device 100 can receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.
[0074] The storage method provided by the embodiments of the present application can be applied to the electronic device 100 shown in FIG. 3, and the electronic device 100 can be a terminal device. For example, the electronic device 100 can be a smartphone, a portable computer, a vehicle-mounted device, a wearable device (such as a smart watch), etc. The following describes a storage method provided by the embodiments of the present application, taking the electronic device as a terminal device.
[0075] FIG. 4 is a flowchart of a storage method provided by the embodiments of the present application, which is applied to a terminal device. As shown in FIG. 4, the method includes the following S401-S402:
[0076] S401, determining a target file page in which target data is stored from a persistent memory.
[0077] The target data is data satisfying a first preset condition. The first preset condition is determined according to user usage data and / or system running data.
[0078] The persistent memory is a non-volatile memory. In the embodiments of the present application, the persistent memory can be a hard disk, a flash memory or the like, and is not limited to the above. The following is described by taking the persistent memory as a hard disk.
[0079] Specifically, the terminal device can first acquire the data identifier of the target data, and then determine the file page in which the target data is stored in the persistent memory, i.e., the target file page, based on the data identifier of the target data.
[0080] In an optional embodiment, the first preset condition can include at least one of a, the number of accesses being greater than a preset number within a preset time period, or b, the access duration being greater than a preset duration within the preset time period. The access duration refers to the cumulative access duration within the preset time period. As can be seen, the target data refers to frequently accessed data, and thus in the embodiments of the present application, the target data can also be referred to as hot data.
[0081] The preset time period, the preset number and the preset duration are not limited in the embodiments of the present application. For example, the preset time period can be the last week or the last three days. The preset number can be 100 or 50. The preset duration can be 1 hour (h) or 30 minutes (min).
[0082] Exemplarily, assuming that the preset time period is 10:00-11:00, the preset number is 20, and the preset duration is 30 minutes, the terminal device can determine the data with the number of accesses greater than 20 within 10:00-11:00 and / or the data with the access duration greater than 30 minutes as the target data.
[0083] In an optional embodiment, the data satisfying the first preset condition includes one or more of functions and application data of an application, i.e., the target data can include one or more of the following: a function (hereinafter referred to as a hot function) satisfying the first preset condition, or application data of an application (hereinafter referred to as a hot application) satisfying the first preset condition. Accordingly, the data identifier of the target data can include a function identifier of the hot function and an application identifier of the hot application.
[0084] In the case where the target data is the hot function, the number of accesses in the first preset condition can be the number of calls of the function, and the access duration can be the call duration of the function. That is, the hot function refers to a function with the number of calls greater than a preset number within a preset time period, and / or a function with the call duration greater than a preset duration.
[0085] In a case where the target data is application data of a hotspot application, the access times in the first preset condition can be the start times of the application, and the access time length can be the running time length of the application. That is, the hotspot application refers to an application with a start time greater than a preset time and / or a running time length greater than a preset time length within a preset time period. The application data of the hotspot application refers to the application data of an application with a start time greater than a preset time and / or a running time length greater than a preset time length within a preset time period.
[0086] The start time refers to the number of times that the application changes from a non-running state to a running state, and the running time length refers to the time length during which the application is in the running state.
[0087] The following takes the first preset condition including a, the access times greater than the preset times within the preset time period, and b, the access time length greater than the preset time length within the preset time period, as an example to describe the process of (1) the terminal device determining the function identifiers of the hotspot functions and (2) the terminal device determining the application identifiers of the hotspot applications.
[0088] (1) The terminal device determines the function identifiers of the hotspot functions.
[0089] Specifically, the terminal device can first determine the functions called within the preset time period, and the call times and call time lengths of the functions. Then, the terminal device can determine the function identifiers of the functions with the call times greater than the preset times and the function identifiers of the functions with the call time lengths greater than the preset time length as the function identifiers of the hotspot functions.
[0090] For example, in an embodiment, it is assumed that the preset time period is from 10:00 on January 1, 2024 to 10:00 on January 2, 2024, and the terminal device calls four functions, namely, function A, function B, function C, and function D, within the time period. Among them, the call times of function A is 100 times, and the cumulative call time length of function A within the time period is 20 hours (h), the call times of function B is 55 times, and the cumulative call time length of function B within the time period is 5 hours, the call times of function C is 30 times, and the cumulative call time length of function C within the time period is 10 hours, the call times of function D is 1 time, and the cumulative call time length of function D within the time period is 1 hour. The preset times is 50 times, and the preset time length is 7 hours. Therefore, the call times of function A and function B are greater than the preset times, the cumulative call time lengths of function A and function C within the preset time period are greater than the preset time length, and the terminal device can determine function A, function B, and function C as the hotspot functions, and determine the function identifier of function A, the function identifier of function B, and the function identifier of function C as the function identifiers of the hotspot functions.
[0091] In an optional embodiment, the hotspot function can include at least one of a function called in a process of running an operating system (hereinafter referred to as a system hotspot function) or a function called in a process of running a preset service (hereinafter referred to as a service hotspot function).
[0092] The preset service can include a service 1 related to a user's sense organ (such as vision and hearing), such as a display service (such as video playing), an audio service (such as voice call and music playing), and a service 2 responding to a user's operation in time.
[0093] The following takes the first preset condition including a, a number of accesses in a preset time period being greater than a preset number, and b, an access time length in the preset time period being greater than a preset time length, as an example to respectively describe a 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 service hotspot function.
[0094] A, the terminal device determines the function identifier of the system hotspot function.
[0095] In an optional embodiment, the terminal device can first collect functions called in a process of running an operating system and a number of calls and a call time length of each function in a preset time period. Then, the terminal device can determine a function identifier of a function with a number of calls greater than a preset number and a function identifier of a function with a call time length greater than a preset time length as the function identifier of the system hotspot function.
[0096] In the embodiment of the present application, the terminal device can collect functions called in a process of running an operating system and a number of calls and a call time length of each function by means of a system log, a performance analysis tool (such as a performance event recorder and analyzer (perf)), a method call counter, or profile guided optimization (PGO), without limitation.
[0097] The system log refers to a log record generated by the terminal device in a process of running an operating system. The system log can include functions called in a process of running an operating system and a number of calls and a call time length of each function.
[0098] perf is used to measure and analyze various performance indicators in the process of operating system running, including CPU usage, function call times and call duration, etc.
[0099] In the foregoing manner, the function identifier of the system hotspot function involved in the process of the terminal device running the operating system in the preset time period can be determined according to the call times and the call duration, so that the target file page in which the system hotspot function is stored can be determined according to the function identifier subsequently, and the data in the target file page can be stored in the memory of the terminal device. In this way, the terminal device can store only the data in the target file page in the memory, without storing all the data in the entire file containing the system hotspot function in the memory, so that the non-target data in the file can be avoided from being stored in the memory, and the storage space of the memory can be effectively saved.
[0100] B, the terminal device determines the function identifier of the business hotspot function.
[0101] In an optional implementation, the terminal device can determine the functions called in the process of running the preset business, and the call times and the call duration of each function. Then, the terminal device can determine the function identifier of the function whose call times are greater than a preset number of times, and the function identifier of the function whose call duration is greater than a preset duration as the function identifier of the business hotspot function.
[0102] In the embodiments of the present application, the preset business can be set by the developer in advance. For example, the terminal device is preconfigured with the business identifiers of multiple businesses, and the terminal device can determine the preset business according to the preconfigured business identifiers. The terminal device can also determine the preset business according to the response time (i.e. the time interval from the user initiating a request to the terminal device giving a response) of each business. For example, if the expected response time of a certain business is less than a preset time interval, the terminal device can determine the business as the preset business, without limitation.
[0103] In an optional implementation, the business hotspot function (i.e. the function called in the process of running the preset business) can include the function called in the process of running the target thread of the preset business (hereinafter referred to as a thread hotspot function, which can also be referred to as a key thread hotspot function).
[0104] The target thread is a thread in the threads of the preset business that meets a second preset condition. The second preset condition includes one or more of the CPU usage being greater than a preset threshold, or the memory occupancy rate being greater than a preset threshold. In the embodiments of the present application, the target thread can also be referred to as a key thread.
[0105] In a case where the preset service includes the service 1 and the service 2, the target thread of the service 1 can include, but is not limited to, one or more of an image rendering thread, an interface updating thread, and an audio playing thread. The image rendering thread is used for rendering an image. The interface updating thread is used for updating a position of an interface element (such as a menu, a toolbar, an application icon, or the like) on a display screen in response to an operation (such as a clicking operation or a sliding operation) of a user. The audio playing thread is used for outputting audio data. The target thread of the service 2 can include, but is not limited to, an input processing thread. The input processing thread is used for receiving an input operation (such as a keyboard input operation, a clicking operation, or a sliding operation) of the user.
[0106] Specifically, the terminal device can determine the function identifiers of the thread hot function by the following method: the terminal device can determine a target thread of a preset service, and determine functions called in a running process of the target thread of the preset service, and a call number and a call duration of each function. Then, the terminal device can determine, as the function identifiers of the thread hot function, a function identifier of a function with a call number greater than a preset number, and a function identifier of a function with a call duration greater than a preset duration.
[0107] In an optional implementation, the terminal device determining the target thread of the preset service can include: obtaining resource occupation information of each thread in a running process of the preset service, and determining a key thread according to the resource occupation information of each thread.
[0108] The resource occupation information of each thread can include, but is not limited to, a CPU usage rate or a memory occupation rate.
[0109] For example, taking the resource occupation information of the thread as the CPU usage rate, it is assumed that the terminal device runs three threads, namely, a thread 1, a thread 2, and a thread 3, in a process of running a service A. The CPU usage rate of the thread 1 is 50%, the CPU usage rate of the thread 2 is 25%, the CPU usage rate of the thread 3 is 25%, and a preset threshold is 30%. Then, the terminal device can determine the thread 1 as the target thread of the service A.
[0110] In an optional implementation, in a process of running an operating system or running a preset service, the terminal device can call not only a locally stored function, but also a function stored in a cloud server. Therefore, the hot function (i.e., the function satisfying the first preset condition) can further include at least one of a function stored in the cloud server or a function stored locally in the terminal device.
[0111] In this way, the function identifier of the business hot function or the thread hot function called by the terminal device in the process of running the target thread of the preset business in the preset time period can be determined according to the number of calls and the call duration, so that the target file page in which the business hot function or the thread hot function is stored can be determined according to the function identifier in the subsequent process, and the data in the target file page is stored in the memory of the terminal device. In this way, the storage space of the memory can be effectively saved, and the storage resources of the memory can be further used for the preset business. The preset business can be related to the user's senses (such as vision and hearing) and operation. In this way, the terminal device can call the related thread hot function from the memory in a timely manner during the execution of the preset business, so as to quickly respond to the preset business and enhance the user's experience.
[0112] (2) The terminal device determines the application identifier of the hot application.
[0113] In an optional embodiment, the terminal device can obtain the number of starts and the running duration of each application in the preset time period. Then, the terminal device can take the identifier of the application whose number of starts is greater than the preset number and the identifier of the application whose running duration is greater than the preset duration as the application identifier of the hot application.
[0114] For example, the terminal device is installed with an application A, an application B and an application C, the preset time period is from 10:00 on January 1, 2024 to 10:00 on January 2, 2024, the number of starts of the application A in the time period is 20, the number of starts of the application B in the time period is 5, the number of starts of the application C in the time period is 1, and the preset number is 10. The cumulative running duration of the application A in the time period is 1 hour, the cumulative running duration of the application B in the time period is 30 minutes, the cumulative running duration of the application C in the time period is 10 hours, and the preset duration is 5 hours. Therefore, the number of starts of the application A in the time period is greater than the preset number, and the cumulative running duration of the application C in the time period is greater than the preset duration. The terminal device can take the identifiers of the application A and the application C as the application identifier of the hot application.
[0115] In an optional embodiment, the terminal device can obtain the running duration and the number of starts of each application in the following manner: (1) The terminal device can obtain the running duration and the number of starts of each application through application logs. (2) The terminal device can obtain the running duration and the number of starts of each application through third-party software, that is, the terminal device can detect the running duration and the number of starts of each application through the third-party software in the preset time period, and determine the hot application based on the running duration and the number of starts of each application detected by the third-party software. The embodiments of the present application do not limit the manner in which the terminal device obtains the running duration and / or the number of starts of each application.
[0116] The application log refers to log records generated by the terminal device in the process of running each application. The application log can include the running duration and the number of starts of each application in a preset time period.
[0117] In this way, for each user, the number of starts and the running duration of each application in a preset time period can be determined according to the usage habit of the user, so as to further determine the application frequently used by the user, that is, the hotspot application. The application data of the hotspot application can be subsequently stored in the memory. In this way, in the process of using the hotspot application by the subsequent user, the terminal device can timely call the application data of the hotspot application from the memory to quickly respond to the operation of the user on the hotspot application, so as to further enhance the experience of the user.
[0118] In the embodiments of the present application, in addition to determining the hotspot application based on the number of starts and the running duration of each application in a preset time period, the terminal device can also determine the hotspot application by at least one of the following methods: determining the application recently used by the user (such as used in the last one minute) as the hotspot application, or determining the hotspot application corresponding to the current time based on the historical time period of the user using each application, or determining the hotspot application based on the association relationship or jump relationship between applications, or determining the hotspot application corresponding to the current location of the user based on the geographic location of the user using each application, or determining the hotspot application according to the state of the terminal device, or determining the hotspot application according to the weight of each application.
[0119] The weight of each application can be pre-set.
[0120] In an optional implementation, for each application, the weight of the application can be updated according to the frequency of the user using the application. For example, if the user does not use the application in a preset time period, the terminal device can reduce the weight of the application.
[0121] After determining the data identifier of the target data in the above manner, the terminal device can determine the target file page based on the data identifier of the target data. The process of determining the target file page based on the data identifier of the target data by the terminal device is further described below by taking (3) the target data as the hotspot function and (4) the target data as the application data of the hotspot application as examples.
[0122] (3) The target data is the hotspot function.
[0123] In an optional implementation, the terminal device can store the function identifier, and the correspondence between the starting position and the length of the function. In this embodiment, the starting position of the function refers to the position of the first character of the function. The length of the function refers to the length between the first character and the last character of the function.
[0124] On this basis, after the terminal device obtains 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 the persistent memory. Finally, based on the file offset of the hotspot function in the persistent memory, the terminal device can determine the file page in which the hotspot function is stored in the persistent memory, i.e., the target file page.
[0125] In an optional implementation, the persistent memory can store a plurality of files, and each file contains different functions. The terminal device can store a correspondence between the function identifier, the file identifier, and the starting position and length of the function.
[0126] On this basis, after the terminal device obtains the function identifier of the hotspot function through S401, the terminal device can determine the file identifier corresponding to the hotspot function, and the starting position and length of the hotspot function. The terminal device can determine, based on the file identifier, a file (referred to as a first file below) in which the hotspot function is stored. 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 a file page in which the hotspot function is stored in the first file, i.e., the target file page.
[0127] In an optional implementation, the first file can include, but is not limited to, a dynamic link library file (such as a.so file), an executable file (such as an.exe file and an.elf file), and a static link library file (such as an.a file and a.lib file), without limitation of the embodiments of the present application.
[0128] In an optional implementation, the terminal device can store a correspondence between the function identifier, the file identifier, and the file page identifier. After the terminal device obtains the function identifier of the hotspot function through S401, the terminal device can determine the file identifier and the file page identifier corresponding to the hotspot function. The terminal device can determine, based on the file identifier, a first file in which the hotspot function is stored, and determine, based on the file page identifier, a file page in the first file for storing the hotspot function, i.e., the target file page.
[0129] (4) The target data is application data of a hotspot application.
[0130] In the case where the target data is application data of a hotspot application, the terminal device can determine the target file page in which the application data of the hotspot application is stored in the manner described in (3) above. The following describes the process in which the terminal device determines the target file page in which the application data of the hotspot application is stored, taking as an example a case where the terminal device stores a correspondence between the application identifier, the file identifier, and the file page identifier.
[0131] After the terminal device obtains the application identifier of the hotspot application through S401, the terminal device can determine a file (hereinafter referred to as a second file) storing application data of the hotspot application according to a file identifier corresponding to the hotspot application, and determine a file page (hereinafter referred to as a target file page) for storing the application data of the hotspot application in the second file according to a file page identifier corresponding to the hotspot application.
[0132] In an optional embodiment, the second file can be a file under a data (data) partition. The data partition is used to store application data of each application installed in the terminal device by a user, such as user data and cache data, and the data can be stored in the data partition in units of pages, so as to realize fast reading and writing when needed.
[0133] S402, storing the related data in the target file page into the memory of the terminal device.
[0134] Specifically, after the terminal device determines the target file page storing the target data through S402, the terminal device can store the related data of the target file page into the memory of the terminal device.
[0135] It can be understood that the related data of the target file page can be the related data of the target file page, or can be data called in the target file page, and the embodiments of the present application do not limit this.
[0136] In the above manner, the terminal device can only store the data in the target file page into the memory, without storing the data stored in other file pages except the target file page, so as to effectively save the memory space.
[0137] In an optional embodiment, after the terminal device determines the target file page storing the target data, the terminal device can read the target data from the target file page and store the target data into the memory of the terminal device.
[0138] Specifically, the terminal device can read the target data from the target file page and store the target data into the memory of the terminal device in units of pages.
[0139] In the above manner, in the case that the target file page contains other data except the target data, the terminal device can only store the target data into the memory, without storing the other data contained in the target file page, so as to further save the memory space.
[0140] In an optional embodiment, the terminal device can store the target data in an LRU linked list of the memory.
[0141] Optionally, the LRU linked list can include at least one of a protection linked list, an active linked list, or an inactive linked list.
[0142] Specifically, taking the terminal device storing target data in the protection chain table as an example, the LRU chain table can include a chain table head and a chain table tail, and the data in the chain table head has a higher activity than the data in the chain table tail. When the terminal device stores the target data in the LRU chain table, the target data can be written in the head position of the protection chain table in page units.
[0143] In some embodiments, after writing the target data in the head position of the protection chain table, if the data in the tail position of the protection chain table overflows, the terminal device can recycle the data overflowing from the tail position of the protection chain table to the hard disk.
[0144] In some other embodiments, after writing the target data in the head position of the protection chain table, if the data in the tail position of the protection chain table overflows, the terminal device can store the data overflowing from the tail position of the protection chain table in the head position of the active chain table in the LRU chain table. After writing the data in the head position of the active chain table, if the data in the tail position of the active chain table overflows, the terminal device can store the data overflowing from the tail position of the active chain table in the head position of the inactive chain table in the LRU chain table. After writing the data in the head position of the inactive chain table, if the data in the tail position of the inactive chain table overflows, the terminal device can recycle the data overflowing from the tail position of the inactive chain table to the hard disk.
[0145] When performing memory recycling on the LRU chain table, the file pages in the inactive chain table are recycled first, then the file pages in the active chain table are recycled, and finally the file pages in the protection chain table are recycled. Therefore, storing the target data in the protection chain table can prolong the residence time of the target data in the memory.
[0146] In an optional implementation, the terminal device can also periodically update the target data stored in the memory.
[0147] Specifically, the terminal device can periodically obtain the target data from the persistent storage by the method shown in FIG. 4, and update the target data stored in the memory according to the periodically obtained target data.
[0148] Through the above technical solutions, the terminal device can store the hot data (i.e., the target data) in the hot page (i.e., the target file page) in the memory, and can avoid storing the data in the cold page (i.e., the file page other than the target file page) in the memory, thereby effectively saving the storage space of the memory.
[0149] The following will be combined with the above various embodiments, and the hotspot data includes system hotspot functions, thread hotspot functions and hotspot application data, the file storing the system hotspot functions is a.so file, the file storing the thread hotspot functions is a.lib file, and the file storing the hotspot application data is a file under a data partition (hereinafter referred to as a data file). The storage method provided by the embodiments of the present application is introduced.
[0150] FIG. 5 is a flow diagram of another storage method provided by the embodiments of the present application. As shown in FIG. 5, the method includes one or more of S501-S506 shown in (a) of FIG. 5, S507-S512 shown in (b) of FIG. 5, and S513-S517 shown in (c) of FIG. 5.
[0151] S501, determining the function identifier of the system hotspot function.
[0152] S502, determining the starting position and length of the system hotspot function in the.so file according to the function identifier of the system hotspot function.
[0153] S503, determining the file offset of the system hotspot function in the.so file according to the starting position and length of the system hotspot function in the.so file.
[0154] S504, determining the target file page of the system hotspot function in the.so file according to the file offset of the system hotspot function in the.so file.
[0155] S505, reading the system hotspot function from the target file page of the system hotspot function in the.so file.
[0156] S506, storing the system hotspot function in the protection chain table.
[0157] The specific steps of S501-S505 can refer to the description in S401 above, which will not be repeated here. The specific steps of S506 can refer to the description in S402 above, which will not be repeated here.
[0158] S507, determining the function identifier of the thread hotspot function.
[0159] S508, determining the starting position and length of the thread hotspot function in the.lib file according to the function identifier of the thread hotspot function.
[0160] S509, determining the file offset of the thread hotspot function in the.lib file according to the starting position and length of the thread hotspot function in the.lib file.
[0161] S510, determining a target file page of the thread hot function in the.lib file according to the file offset of the thread hot function in the.lib file.
[0162] S511, reading the thread hot function from the target file page of the thread hot function in the.lib file.
[0163] S512, storing the thread hot function in the protection chain table.
[0164] The specific steps of S507-S511 can refer to the description in S401 above, which will not be repeated here. The specific steps of S512 can refer to the description in S402 above, which will not be repeated here.
[0165] S513, determining an application identifier of the hot application.
[0166] S514, determining a file page identifier of the hot application in the data file according to the application identifier of the hot application.
[0167] S515, determining a corresponding target file page of the hot application in the data file according to the file page identifier of the hot application in the data file.
[0168] S516, reading application data of the hot application from the corresponding target file page of the hot application in the data file.
[0169] S517, storing the application data of the hot application in the protection chain table.
[0170] The specific steps of S513-S516 can refer to the description in S401 above, which will not be repeated here. The specific steps of S517 can refer to the description in S402 above, which will not be repeated here.
[0171] It can be understood that S501-S506 shown in (a) of FIG. 5, S507-S512 shown in (b) of FIG. 5, and S513-S517 shown in (c) of FIG. 5 have no sequence, 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, or S501-S506 and S507-S512 can be executed first, and then S513-S517, which is not limited.
[0172] It can be understood that S501-S506 shown in (a) of FIG. 5, S507-S512 shown in (b) of FIG. 5, or S513-S517 shown in (c) of FIG. 5 can be used in any combination, that is, the terminal device can execute S501-S506 shown in (a) of FIG. 5, can execute S501-S506 shown in (a) of FIG. 5 and S507-S512 shown in (b) of FIG. 5, or S507-S512 shown in (b) of FIG. 5 and S513-S517 shown in (c) of FIG. 5, can also execute S501-S506 shown in (a) of FIG. 5, S507-S512 shown in (b) of FIG. 5, and S513-S517 shown in (c) of FIG. 5, and is not limited.
[0173] FIG. 6 is a software structure block diagram of a terminal device provided by an embodiment of the present application. As shown in FIG. 6, the terminal device can include a system service layer and a memory management layer.
[0174] The system service layer can include a system hotspot function determination module, a thread hotspot function determination module, a user habit identification module, and a target file page retrieval module. The memory management layer can include a file page configuration module.
[0175] The system hotspot function determination module is configured to periodically determine a system hotspot function from functions stored in a cloud server and functions stored in the terminal device itself during operation of an operating system, and send a function identifier of the system hotspot function to the target file page retrieval module. The target file page retrieval module can determine a file in which the system hotspot function is stored, and a start position and a length of the system hotspot function based on the function identifier of the system hotspot function, determine a file offset of the system hotspot function in the file in which the system hotspot function is stored based on the start position and the length of the system hotspot function, and then determine a target file page in which the system hotspot function is stored in the file in which the system hotspot function is stored based on the file offset.
[0176] The thread hotspot function determination module is configured to periodically determine a thread hotspot function from functions stored in a cloud server and functions stored in the terminal device itself during operation of a key thread of a preset service, and send a function identifier of the thread hotspot function to the target file page retrieval module. The target file page retrieval module can determine a file in which the thread hotspot function is stored, and a start position and a length of the thread hotspot function based on the function identifier of the thread hotspot function, determine a file offset of the thread hotspot function in the file in which the thread hotspot function is stored based on the start position and the length of the thread hotspot function, and then determine a target file page in which the system hotspot function is stored in the file in which the thread hotspot function is stored based on the file offset.
[0177] The user habit identification module is configured to periodically determine a hot application and send an application identifier of the hot application to the target file page retrieval module. The target file page retrieval module can determine a file identifier and a file page identifier corresponding to the application identifier of the hot application according to the application identifier of the hot application. The target file page retrieval module can determine a target file page storing application data of the hot application based on the file identifier and the file page identifier.
[0178] The target file page retrieval module can read the system hot function from the target file page storing the system hot function, read the thread hot function from the target file page storing the thread hot function, and read the application data of the hot application from the target file page storing the application data of the hot application. Then, the target file page retrieval module can send the system hot function, the thread hot function, and the application data of the hot application to the file page configuration module in the memory management layer.
[0179] The file page configuration module can store the system hot function, the thread hot function, and the application data of the hot application in the protection linked list of the LRU linked list.
[0180] In addition, the file page configuration module can also perform memory recycling in the case of insufficient memory space, that is, preferentially recycling the file pages in the non-active linked list in the LRU linked list, then recycling the file pages in the active linked list in the LRU linked list, and finally recycling the file pages in the protection linked list in the LRU linked list.
[0181] The above mainly describes the scheme provided by the embodiments of the present application from the perspective of the electronic device. Correspondingly, the embodiments of the present application also provide a storage device for implementing the various methods described above. The storage device can be the electronic device in the method embodiments, or a component that can be used in the electronic device. It can be understood that the storage device contains the corresponding hardware structure and / or software module for executing each function in order to implement the above functions. Those skilled in the art should easily realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is implemented in hardware or computer software driven hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0182] The embodiments of the present application can divide the storage device into functional modules according to the method embodiments described above. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The integrated module can be realized in the form of hardware or in the form of a software functional module. It should be understood that the division of the modules in the embodiments of the present application is illustrative, and is only a logical functional division. Actual implementation can have another division manner.
[0183] For example, taking the storage device as the electronic device in the method embodiments described above, FIG. 7 shows a structural schematic diagram of an electronic device, which includes a determination module 701 and a storage module 702.
[0184] The determination module 701 is configured to determine a target file page in which target data is stored from the persistent storage.
[0185] The target data is data satisfying a first preset condition, and the first preset condition is determined according to user usage data and / or system running data.
[0186] The storage module 702 is configured to store related data of the target file page to the memory of the electronic device.
[0187] Optionally, the first preset condition includes one or more of the following conditions: a number of times of access in a preset time period is greater than a preset number of times, or a length of access in the preset time period is greater than a preset length of time.
[0188] Optionally, the data satisfying the first preset condition includes one or more of application data of a function or an application.
[0189] Optionally, the function includes one or more of a function called in an operating system running process, a function called in a preset business running process, a function stored by a server, or a function stored locally by the electronic device.
[0190] Optionally, the function called in the preset business running process can include a function called in a target thread running process of the preset business. The target thread is a thread of the preset business that satisfies a second preset condition. The second preset condition includes one or more of the following conditions: a central processing unit (CPU) usage rate is greater than a preset threshold, or a memory occupancy rate is greater than a preset threshold.
[0191] Optionally, in the case where the target data includes a function, the determination module 701 is specifically configured to determine a starting position and a length of the function based on a function identifier of the function, determine a file offset of the function based on the starting position and the length, and determine the target file page from the persistent storage based on the file offset.
[0192] Optionally, the electronic device further includes an updating module, which is specifically configured to periodically update the related data of the target file page stored in the memory.
[0193] Optionally, the storage module 702 is specifically configured to store the related data in the target file page in an LRU list of the memory. The LRU list includes at least one of a protected list, an active list and an inactive list.
[0194] Optionally, when the LRU list is the protected list, the storage module 702 is specifically configured to store the related data in the target file page in the protected list.
[0195] It should be understood that one or more of the above modules or units can be implemented in software, hardware or a combination of both. When any of the above modules or units is implemented in software, the software exists in the form of computer program instructions and is stored in the memory, and the processor can be used to execute the program instructions and implement the above method flow. The processor can be built in the SoC (system on chip) or the ASIC, or be a separate semiconductor chip. The processor further includes the necessary hardware accelerator, such as the field programmable gate array (FPGA), the PLD (programmable logic device), or the logic circuit implementing the special logic operation, in addition to the core for executing the software instructions to perform the operation or processing.
[0196] When any of the above modules or units is implemented in hardware, the hardware can be any one or any combination of the CPU, the microprocessor, the digital signal processing (DSP) chip, the micro controller unit (MCU), the artificial intelligence processor, the ASIC, the SoC, the FPGA, the PLD, the special digital circuit, the hardware accelerator or the non-integrated discrete device, which can run the necessary software or be independent of the software to execute the above method flow.
[0197] Optionally, the embodiments of the present application further provide a storage device. As shown in FIG. 8, 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 through the bus 801. The storage device can be a terminal device. It should be understood that the number of processors and memories in the storage device is not limited in the present application.
[0198] The bus 801 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one line is shown in FIG. 8, but it does not mean that there is only one bus or only one type of bus. The bus 801 can include a path for transmitting information between various components of the storage device (for example, the memory 803, the processor 802, the communication interface 804).
[0199] The processor 802 can include any one or more of a CPU, a GPU, a microprocessor (MP), or a digital signal processor (DSP), etc.
[0200] The memory 803 can include a volatile memory, such as a RAM. The processor 802 can also include a non-volatile memory, such as a ROM, a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0201] The memory 803 stores executable program code, and the processor 802 executes the executable program code to respectively implement the functions of the foregoing acquisition module and the response module, so as to implement the storage method provided by the embodiments of the present application. That is, the memory 803 stores instructions for executing the storage method provided by the embodiments of the present application.
[0202] The communication interface 804 uses a transceiver module such as, but not limited to, a network interface card, a transceiver, etc., to implement communication between the storage device and other devices or communication networks.
[0203] In a possible implementation, the embodiments of the present application further provide a computer readable storage medium, which stores a computer program or instructions, and when the computer program or instructions are executed on the storage device, the storage device can execute the method described in any of the method embodiments or any implementation manner thereof.
[0204] In a possible implementation, the embodiments of the present application further provide a storage method, which includes the method described in any of the method embodiments or any implementation manner thereof.
[0205] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The 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 processes or functions according to the embodiments of the present application are generated. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions can be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer readable storage medium can be any available medium that can be accessed by a computer or data storage device including one or more servers, data centers, etc. integrated with the medium. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state drive (SSD)), etc.
[0206] Although the present application is described herein in conjunction with various embodiments, it is understood that other variations of the disclosed embodiments can be understood and effected by those skilled in the art in practicing the claimed application, from an inspection of the drawings, the disclosure, and the appended claims. The word "comprising" does not exclude other components or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. A single processor or other unit can fulfill the functions of several items recited in the claims. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to an advantage.
[0207] Although the present application is described herein in conjunction with various embodiments, it is understood that other variations of the disclosed embodiments can be understood and effected by those skilled in the art in practicing the claimed application, from an inspection of the drawings, the disclosure, and the appended claims. The word "comprising" does not exclude other components or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. A single processor or other unit can fulfill the functions of several items recited in the claims. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to an advantage.
[0207] Although the present application is described herein in conjunction with various embodiments, it is understood that other variations of the disclosed embodiments can be understood and effected by those skilled in the art in practicing the claimed application, from an inspection of the drawings, the disclosure, and the appended claims. The word "comprising" does not exclude other components or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. A single processor or other unit can fulfill the functions of several items recited in the claims. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to an advantage.
Claims
A storage method characterized by comprising: The method is applied to an electronic device, and the method comprises: determining a target file page storing target data from a persistent storage; wherein the target data is data satisfying a first preset condition; the first preset condition is determined according to user usage data and / or system running data; storing relevant data in the target file page to a memory of the electronic device. The method of claim 1, wherein The first preset condition comprises one or more of the following: a number of times of being accessed in a preset time period is greater than a preset number of times; a length of time of being accessed in a preset time period is greater than a preset length of time. The method according to claim 1 or 2, characterized in that The data satisfying the first preset condition comprises one or more of the following: a function; application data of an application. The method according to claim 3, characterized in that The function comprises one or more of the following: a function called in a running process of an operating system; a function called in a running process of a preset service; a function stored by a server; a function stored locally by the electronic device. The method according to claim 4, characterized in that The function called in the running process of the preset service comprises a function called in a running process of a target thread of the preset service. The target thread is a thread of the preset service satisfying a second preset condition; the second preset condition comprises one or more of the following conditions: a central processing unit (CPU) usage rate is greater than a preset threshold, or a memory occupancy rate is greater than a preset threshold. The method according to any one of claims 1-5, characterized in that In a case where the target data comprises a function, the determining of the target file page storing the target data from the persistent storage comprises: determining a starting position and a length of the function based on a function identifier of the function; determining a file offset of the function based on the starting position and the length; determining the target file page from the persistent storage based on the file offset. The method according to any one of claims 1-6, characterized in that The method further comprises: periodically updating relevant data of the target file page stored in the memory. The method according to any one of claims 1-7, characterized in that The storing of the relevant data in the target file page to the memory of the electronic device comprises: storing the relevant data in the target file page in a least recently used (LRU) linked list of the memory; the LRU linked list comprises at least one of a protection linked list, an active linked list and an inactive linked list. The method of claim 8, wherein The LRU linked list is a protection linked list. The storing of the relevant data in the target file page in the LRU linked list of the memory comprises: storing the relevant data in the target file page in the protection linked list. An electronic device, characterized by comprising: A computer program product comprising a program code which, when executed on a computer or a processor, causes the computer or the processor to perform the method according to any one of claims 1-9. A computer-readable storage medium, characterized by A computer program product comprising a program code which, when executed on a computer or a processor, causes the computer or the processor to perform the method according to any one of claims 1-9. A computer program product, characterized in that The computer program product comprises instructions which, when executed on a computer, cause the computer to perform the method according to any one of the preceding claims 1-9.
Citation Information
Patent Citations
Storage method and storage device of distributive-type file system
CN102841931A
Memory recovery method and device, storage medium and electronic equipment
CN111274039A
File page management method and device and electronic equipment
CN115328856A
Memory access optimization method and device, equipment, medium and program product
CN118051189A
Methods for In-Place Access of Serialized Data
US20150293962A1