File page management method and device, electronic equipment and storage medium

By differentiating target file pages based on their access frequency and compressing unaccessed file pages when memory is insufficient, the low cache hit rate and system performance issues caused by the LRU algorithm are resolved, resulting in a higher cache hit rate and faster application startup speed.

CN115344511BActive Publication Date: 2026-02-27VIVO MOBILE COMM CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211049793.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-30
Publication Date
2026-02-27
Estimated Expiration
2042-08-30

AI Technical Summary

Technical Problem

In existing technologies, the use of the LRU algorithm for system memory reclamation leads to low cache hit rates, resulting in system lag, frame drops, and slower application startup speeds.

Method used

By determining the first and second target file pages based on their application access frequency, and compressing unaccessed second target file pages when system memory is insufficient, instead of reclaiming the more frequently used first target file pages, the cache hit rate is improved.

Benefits of technology

It improves cache hit rate, avoids system lag and slow application startup speed, and enhances system performance and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115344511B_ABST
    Figure CN115344511B_ABST
Patent Text Reader

Abstract

The application discloses a file page management method and device, electronic equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: determining at least one first target file page according to the application access frequency of at least one file page, wherein the application access frequency of the at least one first target file page is greater than a preset access threshold; and compressing at least one second target file page in the case that the system available memory is less than a first preset threshold, wherein the at least one second target file page is a file page that has not been accessed within a preset time in the at least one first target file page.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of computers, and particularly relates to a file page management method and device, electronic equipment and a storage medium. BACKGROUND

[0002] In order to improve file read-write performance, the electronic equipment can use a part of physical memory as a cache. When the system receives a read request, it can first search the cache for whether the requested data exists. If the data exists, the data in the cache can be directly taken, which is called cache hit. If the data does not exist, the data needs to be read from the hard disk. The reading speed of the physical memory is faster than that of the hard disk. Therefore, the higher the cache hit rate is, the smoother the system is.

[0003] The current system memory recycling uses the Least Recently Used (LRU) algorithm to select the least recently used file page for elimination. However, in the case of a small amount of available memory in the current system, memory recycling is frequently triggered, and file pages are easily released, which reduces the cache hit rate and causes system lag, frame loss, and slow application startup speed. SUMMARY

[0004] The embodiments of the present application provide a file page management method, device, electronic equipment and storage medium, which can solve the problems of system lag, frame loss and slow application startup speed.

[0005] In a first aspect, the embodiments of the present application provide a file page management method, which comprises:

[0006] determining at least one first target file page according to application access frequency of at least one file page, wherein the application access frequency of the at least one first target file page is greater than a preset access threshold;

[0007] compressing at least one second target file page in the case that the available memory of the system is less than a first preset threshold, wherein the at least one second target file page is a file page that has not been accessed within a preset time in the at least one first target file page.

[0008] In a second aspect, the embodiments of the present application provide a file page management device, which comprises:

[0009] a first determining module configured to determine at least one first target file page according to application access frequency of at least one file page, wherein the application access frequency of the at least one first target file page is greater than a preset access threshold;

[0010] The first compression module is configured to compress at least one second target file page when the system available memory is less than a first preset threshold, the at least one second target file page being a file page that is not accessed within a preset time in the at least one first target file page.

[0011] In a third aspect, an electronic device is provided, which includes a processor and a memory. The memory stores programs or instructions executable on the processor. When the programs or instructions are executed by the processor, the steps of the method according to the first aspect are implemented.

[0012] In a fourth aspect, a readable storage medium is provided, which stores programs or instructions. When the programs or instructions are executed by a processor, the steps of the method according to the first aspect are implemented.

[0013] In a fifth aspect, a chip is provided, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is configured to run programs or instructions to implement the method according to the first aspect.

[0014] In a sixth aspect, a computer program product is provided, which is stored in a storage medium. The program product is executed by at least one processor to implement the method according to the first aspect.

[0015] In the embodiments of the present application, by determining the first target file page with an access frequency greater than a preset access threshold, and then compressing the second target file page in the first target file page that is not accessed within a preset time when the system available memory is less than a first preset threshold, the file page with a high usage frequency can be ensured not to be easily recycled, and some file pages with a low usage frequency can be avoided from occupying the cache, the cache hit rate is improved, and the situation of system lag, frame loss, or slow application startup speed is avoided. BRIEF DESCRIPTION OF DRAWINGS

[0016] Figure 1 is a flowchart of a file page management method provided by the embodiments of the present application;

[0017] Figure 2 is a schematic diagram of the correspondence between the bitmaps of an application program and the bitmaps;

[0018] Figure 3 is a schematic diagram of a bitmap provided by the embodiments of the present application;

[0019] Figure 4 is a flowchart of memory recycling provided by the embodiments of the present application;

[0020] Figure 5is a schematic diagram of a memory recycling test case provided by an embodiment of the present application.

[0021] Figure 6 is a structural schematic diagram of a file page management apparatus provided by an embodiment of the present application.

[0022] Figure 7 is a structural schematic diagram of an electronic device provided by an embodiment of the present application.

[0023] Figure 8 is a hardware structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0024] The technical solutions in the embodiments of the present application will be clearly described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some, but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art belong to the scope of protection of the present application.

[0025] The terms "first", "second", and the like in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than that illustrated or described herein, and the objects distinguished by "first", "second", etc. are usually a class, and are not limited to the number of objects, for example, the first object can be one or more. In addition, "and / or" in the specification and claims indicates at least one of the connected objects, and the character " / ", generally indicates that the front and rear associated objects are in an "or" relationship.

[0026] The file page management method, apparatus, electronic device and storage medium provided by the embodiments of the present application will be described in detail below with reference to the drawings and specific embodiments and application scenarios.

[0027] Figure 1 is a flow schematic diagram of a file page management method provided by an embodiment of the present application, as shown in Figure 1 the method comprises the following processes:

[0028] Step 100, determining at least one first target file page according to an application access frequency of at least one file page, the application access frequency of the at least one first target file page being greater than a preset access threshold value;

[0029] Optionally, the application access frequency can be used to represent the frequency of file pages being used or accessed.

[0030] Optionally, at least one first target file page with a higher frequency of use or access can be determined from the at least one file page based on the frequency of use or access of the at least one file page, such as a first target file page with an application access frequency greater than a preset access threshold.

[0031] In step 110, at least one second target file page is compressed when the system available memory is less than a first preset threshold, the at least one second target file page being a file page that has not been accessed within a preset time in the at least one first target file page.

[0032] Optionally, the second target file page can be a file page with a higher frequency of access but not accessed within a short time.

[0033] Optionally, the preset time can be within 5 minutes, within 10 minutes, within half an hour, or within 1 minute, and embodiments of the present application do not limit this.

[0034] Optionally, the preset time can be set by the electronic device when it is manufactured, set or adjusted by the user through a relevant input operation, or determined based on big data or machine learning technology to statistically or learn the file page access of the electronic device.

[0035] Optionally, the first preset threshold can be set by the electronic device when it is manufactured, set or adjusted by the user through a relevant input operation, or determined based on big data or machine learning technology to statistically or learn the file page access of the electronic device.

[0036] Optionally, the preset access threshold can be set by the electronic device when it is manufactured, set or adjusted by the user through a relevant input operation, or determined based on big data or machine learning technology to statistically or learn the file page access of the electronic device.

[0037] Optionally, for some file pages with a higher frequency of access but not accessed within a short time (such as the second target file page), in the case of system memory shortage (such as when the system available memory is less than the first preset threshold), this type of file page can not be recovered, but can be compressed to alleviate the memory shortage without causing the file page with a higher frequency of access to be recovered.

[0038] Optionally, compressing the second target file page can be compressing the second target file page and then placing the compressed data in the memory, and if the second target file page needs to be accessed again, the compressed second target file page can be decompressed, so that the system performance is improved and the system memory shortage is effectively alleviated.

[0039] Optionally, the system memory recycling can use a Least Recently Used (LRU) algorithm to select the least recently used file page for recycling, and therefore, the pointers corresponding to the at least one file page can be stored in a certain linked list for management (the linked list can be named as an LRU linked list or a file page management linked list, etc., and the present embodiments do not limit this, and the present embodiments can be explained by taking the "LRU linked list" as an example, as long as the linked list or other similar file or database used for managing the file pages are applicable to the present embodiments, and can be directly substituted for the "LRU linked list" in the present embodiments).

[0040] Optionally, the LRU linked list can include a plurality of initial pointers, and different initial pointers point to different file pages; wherein the file pages corresponding to the plurality of initial pointers respectively include some file pages with a higher usage frequency and some file pages with a lower usage frequency, and therefore, the two can be distinguished, and only the file pages with the lower usage frequency are recycled during the memory recycling.

[0041] Optionally, the application of the LRU algorithm and the LRU linked list is only taken as an example of a file page recycling scheme, and various schemes that can realize file page recycling or compression are applicable to the present embodiments, and can be directly substituted for or adaptively substituted for the "LRU algorithm" or the "LRU linked list" in the present embodiments.

[0042] Optionally, the file pages with the higher usage frequency can be referred to as first target file pages, and correspond to first pointers.

[0043] Optionally, for any one of the at least one file page, the corresponding file page can be determined as the first target file page when it is determined that the application access frequency of the file page is greater than a preset access threshold.

[0044] Optionally, the first target file page, the second target file page, and other file pages can be efficiently managed through three different chain tables; for example, a first type of chain table (for example, Vital chain table or a type of chain table, which is not limited in the embodiments of the present application, and the embodiments of the present application can be explained by taking the "Vital chain table" as an example, as long as the chain table used for managing the first target file page is applicable to the embodiments of the present application, and can be directly replaced by the "Vital chain table" in the embodiments of the present application) can be used to specially manage the first target file page; for example, a second type of chain table (for example, Prime chain table or a type of chain table, which is not limited in the embodiments of the present application, and the embodiments of the present application can be explained by taking the "Prime chain table" as an example, as long as the chain table used for managing the second target file page is applicable to the embodiments of the present application, and can be directly replaced by the "Prime chain table" in the embodiments of the present application) can be used to specially manage the second target file page; for example, an LRU chain table can be used to specially manage other file pages.

[0045] Optionally, the electronic device can set a Vital chain table.

[0046] Optionally, the first pointer of the first target file page can be moved from the LRU chain table to the Vital chain table for separate management.

[0047] Optionally, the electronic device can also set a Prime chain table.

[0048] Optionally, the Vital chain table can be traversed, the pointer (second pointer) of the file page (second target file page) with low frequency of use in the first target file page indicated by the first pointer in the Vital chain table can be moved to the Prime chain table, and the second pointer can be deleted from the Vital chain table to generate an updated Vital chain table.

[0049] Optionally, the second target file page can also be compressed and saved to save memory space.

[0050] Optionally, when it is determined that the file page (second target file page) with low frequency of use in the first target file page indicated by the first pointer in the Vital chain table is the first target file page pointed to by the first pointer in the Vital chain table and has not been used in a second time period, the file page can be determined as the second target file page, and the second pointer thereof can be moved to the Prime chain table.

[0051] Optionally, when the frequency of using the first target file page indicated by the first pointer in the Vital list is low, the frequency of using the second target file page is determined, and if the frequency of using the second target file page is less than P, the first target file page indicated by the first pointer in the Vital list is determined to be used for less than P times in the second time period, the first target file page is taken as the second target file page, and the second pointer is moved to the Prime list.

[0052] Optionally, when the electronic device accesses the second target file page indicated by the second pointer in the Prime list, the second target file page needs to be decompressed first, and the decompression speed is faster than re-reading from the hard disk.

[0053] Optionally, after the electronic device accesses the second target file page indicated by the second pointer, the second target file page can be decompressed, and the second pointer of the second target file page can be moved back to the Vital list.

[0054] Optionally, in the embodiments of the present application, in order to avoid that the first target file page with high frequency of use is easily recycled in the LRU list, the first pointer of the first target file page with high frequency of use is moved from the LRU list to the Vital list; and in the case of recycling memory based on the updated LRU list, the file page with high frequency of use will not be easily recycled.

[0055] Optionally, after the first target file page is determined, if it is found that a first target file page is not accessed within a preset time, it can be determined that the first target file page can be compressed to avoid occupying too much cache memory; that is, the second target file page in the first target file page which is not accessed within the preset time can be compressed to reduce the memory of the cache.

[0056] In the embodiments of the present application, by determining the first target file page with an application access frequency greater than a preset access threshold, and then compressing the second target file page in the first target file page which is not accessed within a preset time in the case that the system available memory is small, such as less than a first preset threshold, the file page with a frequency of use no longer high can be avoided from occupying the cache on the basis of ensuring that the file page with high frequency of use will not be easily recycled, the cache hit rate is improved, and the situation of system lag, frame loss, or slow application startup speed is avoided.

[0057] Optionally, before the at least one second target file page is compressed, the method further includes:

[0058] According to the application access frequency of the at least one file page, at least one third target file page is determined, and the application access frequency of the at least one third target file page is less than a preset access threshold;

[0059] reclaiming the at least one third target file page.

[0060] Optionally, the at least one third target file page with a low application access frequency, such as lower than a preset access threshold, can be determined first.

[0061] Optionally, for any one of the at least one file page, if it is determined that the application access frequency of the file page is less than the preset access threshold, the file page is determined to be a non-frequently accessed file page, i.e., the file page can be reclaimed.

[0062] Optionally, taking the LRU list for managing the at least one file page as an example, the LRU list can include a plurality of initial pointers, and different initial pointers point to different file pages; wherein, among the file pages corresponding to the plurality of initial pointers, some file pages have a high usage frequency, and some file pages have a low usage frequency (i.e., the third target file page), so that the two can be distinguished, and only the file pages with a low usage frequency, i.e., the third target file pages, can be reclaimed during memory reclaiming.

[0063] Optionally, taking the LRU list for managing the at least one file page as an example, the LRU list can be traversed to determine that the file pages with an application access frequency less than a preset access threshold in the at least one file page managed by the LRU list are third target file pages, and then the third target file pages can be reclaimed.

[0064] Optionally, taking the LRU list for managing the at least one file page as an example, the LRU list can be traversed to determine that the file pages with an application access frequency less than a preset access threshold in the at least one file page managed by the LRU list are third target file pages, and the file pages with an application access frequency greater than the preset access threshold are first target file pages, and then the pointers corresponding to the first target file pages can be moved from the LRU list to the Vital list, and then the file pages indicated by the remaining pointers in the LRU list, i.e., the third target file pages, can be reclaimed.

[0065] In the embodiments of the present application, when the system memory is tight, the file pages with a low usage frequency are reclaimed, and these file pages are directly eliminated from the memory without being cached and / or compressed. Thus, the file pages with a low usage frequency are avoided from being compressed and / or cached in the memory, and then the memory waste is avoided, and the system performance is improved.

[0066] Optionally, after the at least one second target file page is compressed, the method further includes:

[0067] In the case that the available memory of the system is less than a second preset threshold, the at least one second target file page is reclaimed.

[0068] Optionally, after the at least one second target file page is compressed, if the system available memory is still less than the second preset threshold, or the system available memory is less than the second preset threshold within a period of time after the at least one second target file page is compressed, the second target file pages can be recycled.

[0069] Optionally, after the at least one second target file page is compressed, the system available memory can be increased to a certain extent, but the compressed second target file pages still occupy the cache space; therefore, if the system available memory is still insufficient (for example, the system available memory is less than the second preset threshold), the compressed second target file pages can be recycled, that is, the compressed second target file pages can be directly eliminated from the memory. Thus, the file pages with low frequency of use in a short time or the file pages not used in a short time are prevented from being compressed and / or cached in the memory, thereby avoiding memory waste and improving system performance.

[0070] Optionally, taking the second target file pages managed by the Prime chain table as an example, if the system available memory is still less than the second preset threshold after the file pages managed by the Prime chain table are compressed, or the system available memory is less than the second preset threshold within a period of time after the file pages managed by the Prime chain table are compressed, the file pages indicated by the pointers in the Prime chain table, that is, the second target file pages, can be recycled.

[0071] In the embodiments of the present application, when the system memory is still insufficient after the file pages with low frequency of use are collected, the file pages with high overall frequency of use but low recent frequency of use or not used recently are recycled, and the file pages are directly eliminated from the memory. Thus, the file pages with high overall frequency of use but low recent frequency of use or not used recently are prevented from being cached in the memory, system memory is further saved, and system performance is improved. Optionally, the at least one first target file page includes at least one fourth target file page, the at least one fourth file page is a file page accessed within a preset time in the at least one first target file page, and after the at least one second target file page is recycled, the method further includes:

[0072] In the case where the system available memory is less than a third preset threshold, the fourth target file page is recycled.

[0073] Optionally, after the at least one second target file page is recycled, if the system available memory is less than a third preset threshold, or within a period of time after the at least one second target file page is recycled, if the system available memory is less than the third preset threshold, the fourth file page accessed within a preset time in the at least one first target file page can be recycled.

[0074] Optionally, after the memory is recycled based on the updated LRU list, if it is determined that the system is short of available memory, the pointers in the entire or part of the Prime list can be recycled.

[0075] For example, the second target file page pointed to by the second pointer in the Prime list can be recycled first.

[0076] Optionally, if the Prime list is empty, or if the system is still short of available memory after the second target file page pointed to by the second pointer in the Prime list is recycled, the first target file page pointed to by the first pointer in the Vital list can be recycled.

[0077] In the embodiments of the present application, when the system memory is still tight after collecting the file pages with high usage frequency but low recent usage frequency or not used recently, the first target file page with high usage frequency is further recycled, i.e., all the cached file pages are recycled, so as to avoid the system memory being occupied by the page cache and further save the system memory and protect the system performance. Optionally, the method for determining that the system is short of available memory can include at least one of the following:

[0078] (1) Using big data burying, the correlation between the total amount of file pages in the LRU list of the system and the system lag is analyzed, and it is estimated that when the total amount of file pages in the LRU list is lower than a threshold X, the system is easy to lag. The total amount Y of file pages in the current LRU list of the system is calculated, and when Y is less than X, it is determined that the system is in a state of short of available memory.

[0079] (2) Using artificial intelligence algorithm, the total amount M of memory required to be applied by the user in a future period of time is estimated, and the total amount N of recyclable memory in the current LRU list is calculated. If M is much greater than N, it is considered that the system is short of available memory.

[0080] For example: starting the application program An requires about 1.5G memory, and if the total amount of recyclable memory in the current LRU list is 700M, it is considered that the system is short of available memory.

[0081] (3) Using big data burying, the correlation between the foreground process memory application speed and the system lag is analyzed, and it is estimated that when the foreground process memory application speed is lower than a threshold S, the system is easy to lag. The speed T of the current foreground process memory application is calculated, and when T is less than S, it is determined that the system is in a state of short of available memory.

[0082] Optionally, before the first pointer pointing to the first target file page in the LRU list is moved to the Vital list, the method further includes establishing the Vital list, and the Prime list can also be established.

[0083] Optionally, the determining the at least one first target file page according to the application access frequency of the at least one file page comprises:

[0084] In the first time period, the file page accessed by N application programs in the at least one file page is determined as the first target file page, and N is a positive integer.

[0085] Optionally, in the case of determining the at least one first target file page from the at least one file page, the file page accessed by N application programs in the first time period can be determined as the first target file page.

[0086] Optionally, the first target file page satisfying the first condition can be obtained by big data statistics on which file pages are frequently used during the running of an application, by artificial intelligence algorithm to identify which applications are frequently used by a user, and by prediction of which applications are likely to be used by the user in a future period of time.

[0087] For example, it can be determined that the file page is used by N or more than N application programs in the first time period, that the file page is frequently used, and that the file page is the first target file page.

[0088] In the embodiments of the present application, the application access frequency of the file page is determined based on the frequency of the file page being accessed by the application program, the application access frequency of the file page can be more conveniently obtained, the accuracy of the application access frequency of the file page can be ensured, and the recycling efficiency of the file page can be improved.

[0089] Optionally, the determining the at least one first target file page according to the application access frequency of the at least one file page comprises:

[0090] In the first time period, the bitmap corresponding to each file page in the at least one file page is determined.

[0091] It is determined that the file page corresponding to the bitmap with N bit values of 1 in the bitmap corresponding to each file page is the first target file page.

[0092] The bitmap is generated in the first time period, at least one bit in the bitmap corresponds to at least one application program, and the bit value of 1 in the bitmap indicates that the file page corresponding to the bitmap is accessed by the application program corresponding to the bit value of 1.

[0093] Optionally, in the case that the file pages accessed by the N applications in the first time period are determined, the bitmap corresponding to each file page can be determined first, and in the bitmap corresponding to each file page, if there are N or more bit values of 1, it can be determined that the file page corresponding to the bitmap is accessed by the N applications in the first time period.

[0094] Optionally, each file page has its own bitmap.

[0095] Optionally, each bit of the bitmap of each file page is 0 when the bitmap is initially generated.

[0096] Optionally, the applications installed in the electronic device can be assigned an identification (ID).

[0097] Optionally, different applications correspond to different IDs, such as ID = 6 representing application A1, ID = 33 representing application A2, ID = 99 representing application A3, ID = 100 representing application A4, …, ID = 112 representing application An.

[0098] Optionally, the ID of an application can be associated with a bit in a bitmap, such as the ID of an application being equal to the offset of a bit in a bitmap.

[0099] Optionally, the ID of an application can be associated with the same bit in the bitmaps of all file pages.

[0100] Figure 2 is a schematic diagram of the correspondence between the application and the bit in the bitmap provided by the embodiments of the present application, as shown in Figure 2 ID of application A1 = 6, and the offset of the bit associated with application A1 in the bitmap is equal to 6.

[0101] Optionally, the ID of an application can be associated with the same bit in all bitmaps of all file pages.

[0102] For example, application A1 can be associated with the bit with an offset of 6 in all bitmaps of all file pages.

[0103] Optionally, in the first time period, for a file page used by an application, the value of the bit corresponding to the application in the bitmap of the file page can be set to 1.

[0104] Optionally, by counting the number of 1s in a bitmap, it can be determined how many applications have accessed the file page corresponding to the bitmap, and the more 1s, the more frequently the file page corresponding to the bitmap is used.

[0105] Optionally, if it is determined that there are N or more bit values of 1 in the bitmap corresponding to the file page, it can be determined that the file page has been used by N or more application programs.

[0106] Figure 3 is a schematic diagram of a bitmap provided by an embodiment of the present application, as shown in Figure 3 The shaded part corresponds to a bit value of 1, and the number of 1s is 21, indicating that 21 application programs have used this file page in the first time period.

[0107] In an embodiment of the present application, a bitmap is introduced to represent the situation of file page access by application programs, and the situation of file page access by application programs is quantified, so that the application access frequency of the file page is more easily obtained, and the recycling efficiency of the file page is improved.

[0108] Optionally, after generating the Vital list, the updated LRU list can be traversed to recycle the file pages that are not frequently used (i.e., the file pages indicated by the pointers in the updated LRU list).

[0109] Optionally, determining at least one first target file page according to the application access frequency of at least one file page comprises:

[0110] determining the usage frequency score of each of the at least one file page in the second time period;

[0111] determining the file page with a usage frequency score greater than a target usage frequency as a first target file page;

[0112] The usage frequency score of the file page is the sum of the usage frequency scores of all application programs that have accessed the file page, and the usage frequency score of the application program represents at least one of the usage frequency, usage duration, and usage time of the application program.

[0113] Optionally, it can be determined that the usage frequency score of the file page is greater than or equal to a target usage frequency M in the second time period, and the file page is frequently used, and the file page is determined to be a first target file page.

[0114] The usage frequency score of any file page can be determined based on the respective usage frequency scores of all application programs that have used the file page in the second time period.

[0115] For example, the usage frequency score of the file page can be the sum of the respective usage frequency scores of all application programs that have used the file page in the second time period.

[0116] For example, the usage frequency score of the file page can be a weighted sum of the usage frequency scores of all application programs that use the file page in the second time period, wherein the weight of each application program is determined based on an empirical value or a big data statistical analysis.

[0117] The usage frequency score of each application program can be determined in advance by using an artificial intelligence algorithm to statistically analyze the usage time length of each application program of the user, analyze the usage habits of the user, identify and predict which application programs are frequently used by the user, and the like.

[0118] Optionally, it can also be determined that the file page is used by N or more application programs in the second time period, and the usage frequency score corresponding to the file page is greater than or equal to M, so it can be determined that the file page is frequently used, and it can be determined that the file page is the first target file page.

[0119] In the embodiments of the present application, the usage frequency score of the application program is used to represent the usage frequency, usage time length, and usage time of the application program, and the usage frequency score of the file page is determined based on the usage frequency of the application program, so as to quantify the situation in which the file page is accessed or can be accessed, and the usage frequency, usage time length, and usage time of the application program corresponding to each file page are considered, so that the situation in which each file page is accessed or can be accessed is more comprehensively evaluated, the application access frequency of the file page is more accurate, and is more in line with the actual usage habits of the user. Figure 4 is a flowchart of the memory recovery provided by the embodiments of the present application, as shown in Figure 4 The Vital linked list and the Prime linked list can be established in advance, and in the first time period, a bitmap corresponding to each file page is generated, the system memory recovery process is started, and the LRU linked list is traversed. For each file page pointed to by an initial pointer in the LRU linked list, it is determined whether the file page is frequently used. If yes, the file page is determined to be the first target file page, the first pointer of the first target file page is moved to the Vital linked list, and the first target file page is marked as A class. If no, the initial pointer of the file page is kept in the LRU linked list, and the file page is marked as C class. The memory of the C class file page is recovered until the traversal of the LRU linked list is completed.

[0120] Optionally, the Vital linked list can also be traversed, the second pointer of the second target file page that has not been used for a long time or has a low usage frequency is moved to the Prime linked list, the second target file page is compressed and stored, and the second target file page is marked as B class.

[0121] Optionally, the judging system can determine whether the available memory is very scarce, if yes, the second target file page pointed by the second pointer in the Prime linked list is recovered, if the Prime linked list is empty or the available memory is still scarce, the first target file page pointed by the first pointer in the Vital linked list is recovered.

[0122] In one embodiment, Figure 5 is a schematic diagram of a memory recovery test case provided by an embodiment of the present application, as Figure 5 shown, the file page management method of the embodiments of the present application can be 35 seconds faster than related art, and the file page usage efficiency is improved by 18%;

[0123] Test 1 Test 2 Test 3 First round 110 seconds 93 seconds 98 seconds Second round 92 seconds 75 seconds 68 seconds Total time for two rounds 202 seconds 168 seconds 165 seconds Number of cold starts 5 5.6 4.2

[0124] The embodiments of the present application can increase the system cache hit rate, reduce the frequency of reading data from the hard disk, thereby improving the application startup speed, reducing the probability of frame loss / stuttering during user use, and improving user experience; at the same time, reducing the frequency of reading data from the hard disk, it can also increase the probability of the memory entering the low-power state and reduce the overall power consumption; compressing a part of the file pages can save memory and improve memory space utilization.

[0125] In the embodiments of the present application, by determining the first target file page with an application access frequency greater than a preset access threshold, and then in the case that the available memory of the system is small, such as less than a first preset threshold, the second target file page in the first target file page that is not accessed within a preset time is compressed, on the basis of ensuring that the file pages with high usage frequency are not easily recovered, some file pages with low usage frequency can also be avoided to occupy the cache, the cache hit rate is improved, and the system is prevented from being stuck, frame loss, or the application startup speed is slowed down.

[0126] The file page management method provided by the embodiments of the present application can be executed by a file page management device. In the embodiments of the present application, the file page management device is taken as an example to illustrate the file page management device provided by the embodiments of the present application.

[0127] Figure 6 is a structural schematic diagram of a file page management device provided by an embodiment of the present application, as Figure 6 shown, the device 600 includes a first determination module 610 and a first compression module 620; wherein:

[0128] The first determination module 610 is configured to determine at least one first target file page according to an application access frequency of at least one file page, wherein the application access frequency of the at least one first target file page is greater than a preset access threshold;

[0129] The first compression module 620 is configured to compress at least one second target file page in a case where the system available memory is less than a first preset threshold, the at least one second target file page being a file page that is not accessed within a preset time in the at least one first target file page.

[0130] The file page management apparatus provided in the embodiments of the present application can implement the processes of each method embodiment and achieve the same technical effects. To avoid repetition, details are not described herein.

[0131] In the embodiments of the present application, by determining the first target file page with the application access frequency greater than a preset access threshold, and then compressing the second target file page that is not accessed within a preset time in the first target file page in a case where the system available memory is less than a first preset threshold, the file page with a high use frequency can be prevented from being easily recycled, and some file pages with a low use frequency can be prevented from occupying the cache, the cache hit rate is improved, and the situation of system lag, frame loss or slow application startup speed is avoided.

[0132] Optionally, before the at least one second target file page is compressed, the apparatus further includes:

[0133] The second determination module is configured to determine at least one third target file page according to the application access frequency of the at least one file page, the application access frequency of the at least one third target file page being less than a preset access threshold;

[0134] The third recycling module is configured to recycle the at least one third target file page.

[0135] Optionally, after the at least one second target file page is compressed, the apparatus further includes:

[0136] The first recycling module is configured to recycle at least one second target file page in a case where the system available memory is less than a second preset threshold.

[0137] Optionally, the at least one first target file page includes at least one fourth target file page, the at least one fourth file page being a file page that is accessed within a preset time in the at least one first target file page, and the apparatus further includes:

[0138] The second recycling module is configured to recycle the fourth target file page in a case where the system available memory is less than a third preset threshold after the at least one second target file page is recycled.

[0139] Optionally, the first determination module 610 is configured to:

[0140] In the first time period, the file pages accessed by N application programs in the at least one file page are determined as the first target file pages, N being a positive integer.

[0141] Optionally, the first determining module 610 is configured to:

[0142] In the first time period, a bitmap corresponding to each of the at least one file page is determined;

[0143] It is determined that the file page corresponding to the bitmap in which N bit values are 1 in the bitmap corresponding to each of the at least one file page is the first target file page;

[0144] The bitmap is generated in the first time period, at least one bit in the bitmap corresponds to at least one application program, and the bit value 1 in the bitmap indicates that the file page corresponding to the bitmap is accessed by the application program corresponding to the bit value 1.

[0145] Optionally, the first determining module 610 is configured to:

[0146] In the second time period, a usage frequency score of each of the at least one file page is determined;

[0147] The file page with a usage frequency score greater than a target usage frequency in the at least one file page is determined as the first target file page;

[0148] The usage frequency score of the file page is a sum of usage frequency scores of all application programs accessing the file page, and the usage frequency score of the application program is used to represent at least one of usage frequency, usage duration, and usage time of the application program.

[0149] In the embodiments of the present application, by determining the first target file page with an application access frequency greater than a preset access threshold, the second target file page in the first target file page which is not accessed in a preset time is compressed in the case that the system available memory is small, for example, less than a first preset threshold, on the basis of ensuring that the file page with high usage frequency is not easily recycled, some file pages with low usage frequency can also be avoided from occupying the cache, the cache hit rate is improved, and the situation of system lag, frame loss, or slow application startup speed is avoided.

[0150] The file page management apparatus in the embodiments of the present application can be an electronic device or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other device than a terminal. For example, the electronic device can be a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), and can also be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, and the like. The embodiments of the present application are not limited in this regard.

[0151] The file page management apparatus in the embodiments of the present application can be a device with an operating system. The operating system can be an Android operating system, an ios operating system, or other possible operating system, and the embodiments of the present application are not limited in this regard.

[0152] The file page management apparatus provided in the embodiments of the present application can implement the method embodiments Figures 1 to 5 The processes implemented by the method embodiments are not repeated here to avoid repetition.

[0153] Optionally, Figure 7 is a structural schematic diagram of an electronic device provided in the embodiments of the present application, as Figure 7 The embodiments of the present application also provide an electronic device 700, which includes a processor 701 and a memory 702. The memory 702 stores programs or instructions that can run on the processor 701. When the programs or instructions are executed by the processor 701, each step of the above file page management method embodiments is implemented, and the same technical effects are achieved. To avoid repetition, the details are not repeated here.

[0154] It should be noted that the electronic device in the embodiments of the present application includes the mobile electronic device and the non-mobile electronic device described above.

[0155] Figure 8 A hardware structural schematic diagram of an electronic device for implementing the embodiments of the present application.

[0156] The electronic device 800 includes, but is not limited to, a radio frequency unit 801, a network module 802, an audio output unit 803, an input unit 804, a sensor 805, a display unit 806, a user input unit 807, an interface unit 808, a memory 809, and a processor 810, etc.

[0157] Those skilled in the art can understand that the electronic device 800 can further include a power supply (such as a battery) for supplying power to each component, and the power supply can be logically connected to the processor 810 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. Figure 8 The electronic device structure shown in the figure is not a limitation on the electronic device, and the electronic device can include more or fewer components than the figure, or combine certain components, or different component arrangements, which are not described here.

[0158] The processor 810 is configured to:

[0159] Before memory recycling based on the LRU linked list, it is determined that there is a first pointer pointing to a first target file page in the LRU linked list, the first pointer is moved to the Vital linked list, and the first pointer is deleted from the LRU linked list, to obtain an updated LRU linked list;

[0160] The use frequency of the first target file page is higher than the use frequency of the file pages pointed to by the remaining pointers in the updated LRU linked list.

[0161] In the embodiments of the present application, by determining the first target file page with the application access frequency greater than the preset access threshold, and then compressing the second target file page in the first target file page which is not accessed within a preset time when the system available memory is small, such as less than a first preset threshold, on the basis of ensuring that the file page with higher use frequency will not be easily recycled, some file pages with lower use frequency can also be avoided to occupy the cache, the cache hit rate is improved, and the situation of system freezing, frame loss, or slow application startup speed is avoided.

[0162] Optionally, before compressing the at least one second target file page, the processor 810 is configured to:

[0163] According to the application access frequency of the at least one file page, at least one third target file page is determined, and the application access frequency of the at least one third target file page is less than a preset access threshold;

[0164] The processor 810 is further configured to:

[0165] Recycle the at least one third target file page.

[0166] Optionally, after compressing the at least one second target file page, the processor 810 is configured to:

[0167] recycle the at least one second target file page when the system available memory is less than a second preset threshold.

[0168] Optionally, the at least one first target file page comprises at least one fourth target file page, the at least one fourth target file page being a file page in the at least one first target file page that is accessed within a preset time, and the processor 810 is configured to:

[0169] recycle the fourth target file page when the system available memory is less than a third preset threshold after recycling the at least one second target file page.

[0170] Optionally, the processor 810 is configured to:

[0171] determine, within a first time period, a file page in the at least one file page that is accessed by N applications as a first target file page, N being a positive integer.

[0172] Optionally, the processor 810 is configured to:

[0173] determine, within a first time period, a bitmap corresponding to each file page in the at least one file page;

[0174] determine, in the bitmap corresponding to each file page, a file page corresponding to a bitmap in which N bits have a value of 1 as a first target file page;

[0175] wherein the bitmap is generated within the first time period, at least one bit in the bitmap corresponds to at least one application, and a bit value of 1 in the bitmap indicates that a file page corresponding to the bitmap is accessed by an application corresponding to the bit value of 1.

[0176] Optionally, the processor 810 is configured to:

[0177] determine, within a second time period, a usage frequency score of each file page in the at least one file page;

[0178] determine, in the at least one file page, a file page having a usage frequency score greater than a target usage frequency as a first target file page;

[0179] wherein the usage frequency score of the file page is a sum of usage frequency scores of all applications that access the file page, and the usage frequency score of the application is used to represent at least one of a usage frequency, a usage duration, and a usage time of the application.

[0180] In the embodiment of the present application, by determining the first target file page with the access frequency in the frequency domain greater than the preset access threshold, and then compressing the second target file page in the first target file page which is not accessed within the preset time when the system available memory is small, such as less than the first preset threshold, the file page with high use frequency can be ensured not to be easily recycled, and some file pages with low use frequency can also be avoided to occupy the cache, the cache hit rate is improved, and the system freezing, frame loss or slow application startup speed is avoided.

[0181] It should be understood that in the embodiments of the present application, the input unit 804 can include a graphics processor (GPU) 8041 and a microphone 8042. The graphics processor 8041 processes image data of a still picture or a video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 806 can include a display panel 8061, which can be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 807 includes at least one of a touch panel 8071 and other input devices 8072. The touch panel 8071 is also called a touch screen. The touch panel 8071 can include a touch detection device and a touch controller. The other input devices 8072 can include, but are not limited to, a physical keyboard, function keys (such as volume control keys, on-off keys, etc.), a trackball, a mouse, a joystick, and the like, which will not be described here.

[0182] The memory 809 can be used to store software programs and various data. The memory 809 can mainly include a first storage area storing programs or instructions and a second storage area storing data, wherein the first storage area can store an operating system, application programs or instructions required by at least one function (such as a sound playing function, an image playing function, etc.), and the like. In addition, the memory 809 can include a volatile memory or a non-volatile memory, or the memory 809 can include both a volatile memory and a non-volatile memory. The non-volatile memory can be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a Random Access Memory (RAM), a Static RAM (SRAM), a Dynamic RAM (DRAM), a Synchronous DRAM (SDRAM), a Double Data Rate SDRAM (DDR SDRAM), an Enhanced SDRAM (ESDRAM), a Synch link DRAM (SLDRAM), and a Direct Rambus RAM (DRRAM). The memory 809 in the embodiments of the present application includes but is not limited to these and any other suitable types of memory.

[0183] The processor 810 can include one or more processing units; optionally, the processor 810 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and an application program, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 810.

[0184] The embodiments of the present application also provide a readable storage medium, the readable storage medium stores programs or instructions, the programs or instructions are executed by a processor to realize various processes of the above-mentioned file page management method embodiments, and the same technical effects can be achieved. To avoid repetition, details are not described here.

[0185] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes a computer readable storage medium, such as a computer readable only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0186] The embodiment of the present application further provides a chip, which comprises a processor and a communication interface, the communication interface is coupled with the processor, the processor is used for running programs or instructions to realize the processes of the above file page management method embodiments and achieve the same technical effects. To avoid repetition, details are not described herein.

[0187] It should be understood that the chip mentioned in the embodiment of the present application can also be referred to as a system level chip, a system chip, a chip system or a system on chip, etc.

[0188] The embodiment of the present application provides a computer program product, which is stored in a storage medium, and is executed by at least one processor to realize the processes of the above file page management method embodiments and achieve the same technical effects. To avoid repetition, details are not described herein.

[0189] It should be noted that in this document, the term "comprising" or "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the method and device in the embodiment of the present application is not limited to the order of performing the functions as shown or discussed, but can also include performing the functions in a substantially simultaneous manner or in the opposite order, for example, the described method can be performed in an order different from that described, and various steps can also be added, omitted or combined. In addition, the features described with reference to certain examples can be combined in other examples.

[0190] Through the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned example methods can be realized by means of software and a necessary general hardware platform, and of course, can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a computer software product in essence or in the form of a part that contributes to the prior art, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) and includes a plurality of instructions for causing a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application.

[0191] The embodiments of the present application are described above in combination with the drawings, but the present application is not limited to the above-mentioned specific embodiments, and the above-mentioned specific embodiments are only illustrative and not restrictive. Those skilled in the art can make many forms under the inspiration of the present application without departing from the scope of the present application and the scope protected by the claims.

Claims

1. A method for managing file pages, characterized in that, include: Based on the application access frequency of at least one file page, at least one first target file page is determined, wherein the application access frequency of the at least one first target file page is greater than a preset access threshold; When the available memory of the system is less than a first preset threshold, at least one second target file page is compressed, wherein the at least one second target file page is a file page among the at least one first target file pages that has not been accessed within a preset time. The method further includes, after compressing at least one second target file page: If the available memory of the system is less than a second preset threshold, at least one of the second target file pages shall be reclaimed. Wherein, the at least one first target file page includes at least one fourth target file page, the at least one fourth file page being a file page accessed within a preset time period among the at least one first target file page, and after reclaiming at least one second target file page, the method further includes: If the available memory of the system is less than a third preset threshold, the fourth target file page is reclaimed.

2. The file page management method according to claim 1, characterized in that, Before compressing at least one second target file page, the method further includes: Based on the application access frequency of the at least one file page, at least one third target file page is determined, wherein the application access frequency of the at least one third target file page is less than a preset access threshold. Reclaim at least one third target file page.

3. The file page management method according to claim 1, characterized in that, The step of determining at least one first target file page based on the application access frequency of at least one file page includes: Within the first time period, the file page that has been accessed by N applications among the at least one file page is determined as the first target file page, where N is a positive integer.

4. The file page management method according to claim 3, characterized in that, The step of determining the file page that has been accessed by N applications from the at least one file page as the first target file page includes: Within a first time period, determine the bitmap corresponding to each file page in the at least one file page; The file page corresponding to the bitmap with N bits set to 1 in the bitmap corresponding to each file page is determined as the first target file page; The bitmap is generated within the first time period, and at least one bit in the bitmap corresponds to at least one application. A bit value of 1 in the bitmap is used to indicate that the file page corresponding to the bitmap has been accessed by the application corresponding to the bit with a value of 1.

5. The file page management method according to claim 1, characterized in that, The step of determining at least one first target file page based on the application access frequency of at least one file page includes: During the second time period, determine the usage frequency score of each file page in the at least one file page; The file page whose usage frequency score is greater than the target usage frequency is identified as the first target file page; The usage frequency score of the file page is the sum of the usage frequency scores of all applications that have accessed the file page. The usage frequency score of an application is used to characterize at least one of the application's usage frequency, usage duration, and usage time.

6. A document page management device, characterized in that, include: The first determining module is used to determine at least one first target file page based on the application access frequency of at least one file page, wherein the application access frequency of the at least one first target file page is greater than a preset access threshold. The first compression module is used to compress at least one second target file page when the available memory of the system is less than a first preset threshold. The at least one second target file page is a file page among the at least one first target file page that has not been accessed within a preset time. The device is also used for: If the available memory of the system is less than a second preset threshold, at least one of the second target file pages shall be reclaimed. Wherein, the at least one first target file page includes at least one fourth target file page, the at least one fourth file page being a file page accessed within a preset time period among the at least one first target file page, and after reclaiming at least one second target file page, the device is further configured to: If the available memory of the system is less than a third preset threshold, the fourth target file page is reclaimed.

7. An electronic device, characterized in that, It includes a processor and a memory, the memory storing programs or instructions that can run on the processor, the programs or instructions, when executed by the processor, implementing the file page management method as described in any one of claims 1-5.

8. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the file page management method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Memory management method and device

    CN110888821A

  • Memory recovery method and device, storage medium and electronic equipment

    CN111831441A

  • File page processing method and device, terminal equipment and storage medium

    CN112069433A