File page management method and device, electronic equipment and medium

By monitoring IO abnormalities of file pages in electronic devices and compressing and storing file pages in idle state, the system performance degradation caused by file page recycling is solved, and efficient memory management and performance improvement is achieved.

CN119201461APending Publication Date: 2024-12-27VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411337767.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-23
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The existing file page recycling method causes overall system performance to decline, especially when memory is tight, which may affect the device's operating efficiency and file reading speed.

Method used

By monitoring the IO abnormality of the file page, when the device is idle, identify and compress the target file page that may affect performance, convert it into a compressed package, store the compressed package in memory, and delete the original target file page. This frees up memory space and avoids consuming system resources during high loads.

Benefits of technology

It effectively avoids the use of system resources by compression operations during high load, reduces memory usage, ensures the overall performance of electronic devices, and improves file reading speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201461A_ABST
    Figure CN119201461A_ABST
Patent Text Reader

Abstract

The invention discloses a file page management method and device, electronic equipment and a medium, and belongs to the technical field of terminals. The method comprises the following steps: determining a target file page in a memory according to an IO abnormal condition of the file page; compressing the target file page in an idle state to obtain a compressed package of the target file page; and deleting the target file page, and storing the compressed package in the memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of terminal technology, and specifically relates to a file page management method, device, electronic equipment and medium. Background Art

[0002] Nowadays, as users' lives become more and more dependent on electronic devices such as mobile phones and computers, users' demand for electronic device memory is increasing. When the memory is insufficient, the device may become slow, stuck, or even unable to run certain applications.

[0003] Therefore, when the memory of an electronic device is tight, the electronic device will try to recycle the file pages in the memory to relieve the memory pressure. However, the method of reclaiming file pages in the related art has the problem of causing the overall performance of the system to deteriorate. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a file page management method, device, electronic device and medium to solve the technical problem that the existing file page recycling method causes the overall system performance to deteriorate.

[0005] In a first aspect, an embodiment of the present application provides a method for managing a file page, the method comprising:

[0006] According to the IO abnormality of the file page, determine the target file page in the memory;

[0007] Compressing the target file page in an idle state to obtain a compressed package of the target file page;

[0008] The target file page is deleted, and the compressed package is stored in the memory.

[0009] In a second aspect, an embodiment of the present application provides a file page management device, the device comprising:

[0010] A determination module, used to determine a target file page in memory according to an IO abnormality of the file page;

[0011] A compression module, used for compressing the target file page in an idle state to obtain a compressed package of the target file page;

[0012] A storage module is used to delete the target file page and store the compressed package in the memory.

[0013] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the method provided in the first aspect are implemented.

[0014] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method provided in the first aspect are implemented.

[0015] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method provided in the first aspect.

[0016] In a sixth aspect, an 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 implement the method provided in the first aspect.

[0017] In the file page management method, device, electronic device and medium of the present application, the IO anomalies of the file page can be monitored, and the target file page that may affect the performance can be accurately identified. When the device is in an idle state, these target file pages are compressed and converted into compressed packages. The original target file pages are deleted, and only the compressed packages are stored in the memory. In this way, only the target file pages that may affect the performance of the device can be compressed in the idle state to release memory, avoiding the compression operation from occupying system resources under high load, thereby avoiding reducing the reading speed of the file, while reducing memory usage and ensuring the overall performance of the electronic device. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 It is a flowchart of a method for managing file pages provided by an embodiment of the present application;

[0019] Figure 2 is a structural schematic diagram of a file page management device provided by another embodiment of the present application;

[0020] Figure 3 is a structural schematic diagram of an electronic device provided by another embodiment of the present application;

[0021] Figure 4 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0022] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0023] The terms "first", "second", etc. 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 terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0024] In order to solve the above technical problems, the present application provides a method for managing file pages. The following is a detailed description of the method for managing file pages provided by the present application embodiment through specific embodiments and application scenarios in conjunction with the accompanying drawings.

[0025] like Figure 1 As shown, Figure 1 : is a flowchart of a method for managing a file page provided by an embodiment of the present application. The present application embodiment provides a method for managing a file page, which may include:

[0026] S101, determining a target file page in the memory according to an IO abnormality of the file page;

[0027] In this embodiment, the file page is to divide the file into file blocks of fixed size, and then the divided file pages can be loaded into the memory. The file pages in the memory occupy a certain memory space, but if an application needs to read the file, the file pages divided by the file can be directly read from the memory without accessing the disk to read the file, thus improving the efficiency of file reading.

[0028] If memory is tight, the system can select target file pages from the file pages in memory and compress them to free up memory.

[0029] IO anomalies of file pages refer to the system detecting and identifying anomalies that occur during the input / output (IO) operation of file pages, such as delays, errors, or performance issues. By identifying these anomalies, the system can determine which file pages have problems when reading or writing, so that these file pages can be identified as target file pages and corresponding measures can be taken, such as optimizing read and write operations, compressing or marking file pages, to improve the overall system performance.

[0030] As an optional embodiment, determining the target file page in the memory according to the IO abnormality of the file page includes:

[0031] Determine a first threshold value according to the IO abnormality of the file page, and determine a file page in the memory whose size is smaller than the first threshold value as a target file page; and or

[0032] According to the IO abnormality of the file page, a first mark is added to the file page, and a file page in the memory that does not have the first mark is determined as a target file page, where the first mark is used to indicate that the file page has an IO abnormality.

[0033] In this embodiment, the system can filter out target file pages that are smaller than a preset first threshold based on the file page size through the IO exception of the file page, and / or filter out target file pages that are not marked as abnormal based on whether an IO exception occurs.

[0034] Specifically, under the conditions of simulation or actual operation, the system can be made to perform read / write (Input / Read, Output / Write, IO) operations on various file pages in the memory, and record the read / write data generated by the read / write operations, the read / write data including the time consumption and data transmission amount of each read / write operation. Then, a speed threshold can be determined according to the read / write data, and a first threshold representing the file page size can be determined based on the speed threshold. Among them, the read / write operation refers to the operation of reading and writing data from an external device to the memory.

[0035] If the size of a file page is less than the first threshold, the file page can be considered as a file block of a small file. If the size of a file page is greater than or equal to the first threshold, the file page can be considered as a file block of a large file or a medium-sized file. Since compressed large files or medium-sized files usually include more file pages, if the contents of these file pages are continuously stored in the memory, the system can process the file through a one-time read and write request, which is more efficient. If a file page among these file pages is compressed, then these file pages are no longer continuous in the memory. In order to process the large file or the medium-sized file, the system needs to issue multiple smaller, scattered read and write requests, which increases the response time of the memory. Therefore, if the size of a file page is less than the first threshold, the file page can be considered to be determined as the target file page to be compressed.

[0036] In addition, whether the file page is a target file page can also be determined based on whether there is a first identifier on the file page. The first identifier is used to indicate that the file page it identifies is in an IO abnormal state. If the file page has a corresponding first identifier, it means that the file page is in an IO abnormal state, and the file page may be frequently accessed or modified in the future, so the file page is not determined as a target file page to be compressed; only if the file page does not have a corresponding first identifier, it means that the file page is not in an IO abnormal state, that is, the file page can be determined as a target file page to be compressed.

[0037] In some embodiments, determining the target file page in the memory according to the IO abnormality of the file page includes:

[0038] When delayed reading and writing of P first file pages in the memory is detected for the first time, a third identifier is added to the P first file pages, where the delayed reading and writing is that the average speed of the reading and writing operations is less than the speed threshold, and P is a positive integer greater than or equal to 1;

[0039] When it is detected that the P first file pages undergo Q delayed reading and writing after adding the third identifier, the third identifiers corresponding to the P first file pages are updated to the first identifier, and the P first file pages are determined as target file pages, where Q is a positive integer.

[0040] In this embodiment, if a read / write operation is performed on P first file pages through a read / write request, and the average speed of the read / write operations of the P first file pages is greater than or equal to a speed threshold, it can be considered that the time consumed by the read / write operations of the P first file pages is relatively normal; if the average speed of the read / write operations of the P first file pages is less than the speed threshold, it can be considered that the read / write operations of the P first file pages may be abnormal.

[0041] Therefore, when it is first detected that the average speed of the read and write operations of P first file pages in the memory is greater than the speed threshold, the P first file pages can be marked with a third marker, and the third marker is used to characterize that the file pages identified by it are in a suspected abnormal state; if after the third marker is marked, it is detected that the average speed of the read and write operations of the P first file pages during Q read and write operations is greater than the speed threshold, then it can be determined that the P first file pages are in an abnormal state, and the third marker on the P first file pages can be updated to the first marker, and then the P first file pages marked with the first marker are all determined as target file pages.

[0042] In this way, based on the speed of file page read and write operations, it is possible to gradually identify and update whether the file page is in an abnormal state and mark it accordingly, so that the performance anomalies of the file page can be effectively monitored and managed.

[0043] In addition, a first time length can be set. If the file page has not been accessed within the first time length before the current moment, it can be considered that the file page is inactive, and the inactive file pages can be compressed first; if the file page is accessed within the first time length before the current moment, it can be considered that the file page is active and may be frequently accessed and modified, so the file page is not compressed.

[0044] S102, compressing the target file page in an idle state to obtain a compressed package of the target file page;

[0045] In this embodiment, the idle state refers to a state in which the device is not currently performing any important foreground tasks or user operations, and the resource loads of the processor (Central Processing Unit, CPU) and memory are relatively low. The idle state may include a state in which the device is in standby mode, or tasks are running in the background. At this time, performing compression operations can avoid affecting the user experience or the execution of key tasks.

[0046] Therefore, the thread of asynchronously compressing file pages can be awakened when the electronic device is in an idle state. That is, only when the electronic device is in an idle state, the target file page is selected from the memory for compression. For example, the idle state can be that the display interface of the electronic device remains as the desktop for more than 10 seconds. The compression of the file page can be performed in an asynchronous manner.

[0047] In addition, as an optional embodiment, by performing IO anomaly identification on the file page in the memory and determining the target file page in the memory, it is possible to further determine whether there is a corresponding second identifier for the target file page, and the second identifier is used to indicate that the compression package corresponding to the identified file page is greater than a second threshold.

[0048] If the target file page has a second identifier, that is, its corresponding compressed package is greater than the second threshold, then it can be considered that the compressed package of the target file page after compression is still large, and even if the target file page is compressed, it cannot release too much memory space. Instead, the compression process will consume more computing resources. Therefore, the target file page with the corresponding second identifier will not be compressed; if the target file page does not have a second identifier, that is, its corresponding compressed package is less than or equal to the second threshold, then it can be considered that the compressed package of the target file page after compression is small, and compressing the target file page can release more memory space. Therefore, the target file page whose compressed package is less than or equal to the second threshold can be compressed to obtain the compressed package of the target file page.

[0049] S103, deleting the target file page, and storing the compressed package in the memory.

[0050] In the embodiment of the present application, after compressing the target file page to obtain a compressed package, the target file page can be deleted, and then the compressed package can be stored in the memory. Since the size of the compressed package is smaller than the target file page, the memory space can be released. And if an external device wants to read the target file page, it does not need to read it from the disk, and can read the compressed package in the memory.

[0051] In some embodiments, storing the compressed package in the memory includes:

[0052] When the size of the compressed package is less than or equal to a second threshold, the compressed package is stored in the memory.

[0053] In this embodiment, after compressing the target file page to obtain a compressed package of the target file page, the size of the compressed package can be further compared with a second threshold. Only when it is determined that the size of the compressed package is less than or equal to the second threshold, the compressed package is stored in the memory.

[0054] Through the above method, it can be ensured that the compressed packages stored in the memory will not occupy too much memory, thereby saving memory space.

[0055] In this application, the IO anomalies of the file pages can be monitored, and the target file pages that may affect the performance can be accurately identified. When the device is in an idle state, these target file pages are compressed and converted into compressed packages. The original target file pages are deleted, and only the compressed packages are stored in the memory. In this way, only the target file pages that may affect the performance of the device can be compressed in the idle state to release memory, avoiding the compression operation from occupying system resources under high load, thereby avoiding reducing the reading speed of the file, while reducing memory usage and ensuring the overall performance of the electronic device.

[0056] In some embodiments, after compressing the target file page in the idle state to obtain a compressed package of the target file page, the method further includes:

[0057] When the size of the compressed package is greater than a second threshold value and there is no compressed package corresponding to the first file page in the memory, applying for a bit table corresponding to the target file, and adding a second identifier at a position corresponding to the target file page in the bit table, the target file page and the first file page are file pages included in the target file;

[0058] When the size of the compressed package is greater than the second threshold and a compressed package corresponding to the first file page exists in the memory, the bit table corresponding to the target file is obtained, and the second identifier is added to the position corresponding to the target file page in the bit table.

[0059] In this embodiment, after compressing the target file page to obtain a compressed package of the target file page, the size of the compressed package can be further compared with a second threshold. If the size of the compressed package is greater than the second threshold, it means that the compressed package still occupies a large memory space, so it is necessary to add a second identifier to the target file page corresponding to the compressed package. The second identifier means that the compressed package still occupies a large memory space.

[0060] Specifically, it can be further checked whether there is a compressed package of the first file page of the target file in the memory, which belongs to the same file as the target file page. If it does not exist, it means that this is the first time that the target file is compressed and managed, and a new bit table needs to be applied for the target file so that the system can track and manage the compression status of this file. Therefore, a bit table can be created according to the number of all file pages in the target file. This bit table is used to represent the status of each file page in the target file. Then, since the compressed package of the target file page is large, a second identifier is added to the position corresponding to the target file page in the bit table, and the compressed package is deleted to release memory space. Afterwards, if an external device wants to read the target file page, it can read it from the disk of the electronic device. Among them, the bit table is a data structure that uses binary bits to represent certain states or attributes. Each bit represents the state of a file page. Specifically, adding a second identifier to the target file page can set the corresponding position of the target file page in the bit table to 1.

[0061] In addition, when checking whether there is a compression package of the first file page belonging to the same target file as the target file page in the memory, it is to determine whether the file has been partially compressed and stored in the memory. If the compression package of the first file page already exists in the memory, it means that the system has already performed partial compression management on the file, so there is no need to apply for a new bitmap for the file. The second identifier can be directly added to the position corresponding to the target file page in the bitmap.

[0062] In this embodiment, the file page with a larger compression package can be managed by adding the second identifier to ensure that the target file page with the second identifier will not be compressed subsequently.

[0063] In some embodiments, the method is applied to an electronic device, and after deleting the target file page and storing the compressed package in the memory, the method further includes:

[0064] In the case where a target application is in a running state in the electronic device, determining a memory occupancy level of the target application, wherein the target application is an application that occupies a memory greater than a memory threshold;

[0065] The memory capacity corresponding to the memory occupancy level is released by deleting M memory objects in the memory, wherein the M memory objects include the compressed package, and M is a positive integer;

[0066] In the case that a corresponding first identifier or a third identifier exists on a file page corresponding to the compressed package, the first identifier or the third identifier is deleted, and the third identifier is used to indicate that the identified file page is in a suspected abnormal state.

[0067] In this embodiment, the memory usage of frequently used applications in the electronic device can be obtained in advance, and then the occupied memory of each application in the electronic device is compared with a pre-set memory threshold. If the occupied memory of the application is greater than the memory threshold, it can be considered that the memory space required for the application to run is large, and the application can be determined as a target application.

[0068] Furthermore, the memory occupation level of the target application may be determined based on the memory occupied by the target application. A higher memory occupation level means that the application needs to occupy more memory when running.

[0069] Then, whenever a target application is detected to be running in the electronic device, it is possible to determine how much memory capacity needs to be released based on the memory occupancy level of the target application, and release the corresponding memory capacity by deleting memory objects in the memory, thereby alleviating the memory pressure in the electronic device.

[0070] For example, the electronic device includes a first application and a second application, wherein the first application occupies 500MB of memory when running, the second application occupies 1.5GB of memory when running, and the memory threshold is 400MB. Then, both the first application and the second application can be set as target applications, and the memory occupancy level of the first application is level 1, and the memory occupancy level of the second application is level 2. When the memory occupancy level is level 1, the memory capacity to be released is 100MB, so 100MB of memory objects in the memory can be deleted; when the memory occupancy level is level 2, the memory capacity to be released is 300MB, so 300MB of memory objects in the memory can be deleted.

[0071] In addition, if the file page corresponding to the compressed package to be deleted has been marked as "abnormal state" or "suspected abnormal state" (i.e., has the first mark or the third mark), when deleting the compressed package, it is necessary to remove the first mark or the third mark first, so as to ensure that when the system processes these file pages later, it will not mistakenly believe that they are still in an abnormal state due to the existence of the mark.

[0072] In the above manner, target applications with high memory usage can be identified, and when these target applications are running, memory objects such as compressed packages in the memory can be deleted to release memory resources and relieve memory pressure.

[0073] In some embodiments, the method is applied to an electronic device, and after deleting the target file page and storing the compressed package in the memory, the method further includes:

[0074] When the available memory in the electronic device is less than a third threshold, deleting N memory objects in the memory to release memory capacity, wherein the N memory objects include the compressed package, and N is a positive integer;

[0075] In the case that a corresponding first identifier or a third identifier exists on a file page corresponding to the compressed package, the first identifier or the third identifier is deleted, and the third identifier is used to indicate that the identified file page is in a suspected abnormal state.

[0076] In this embodiment, if it is detected that the memory of the electronic device is tight, the memory capacity can also be released by deleting memory objects such as compressed packages in the memory. Specifically, the available memory in the electronic device can be compared with a preset third threshold. If the available memory is less than the third threshold, it is considered that the memory of the electronic device is tight, and N memory objects in the memory need to be deleted to release the memory capacity.

[0077] For example, it is also possible to determine whether the electronic device is memory-constrained based on certain events. For example, if there is a memory overflow (Out of Memory, OOM), it can be considered that when the system memory resources are insufficient and cannot meet the needs of the running application, the memory capacity can be released by deleting the N memory objects in the memory. For another example, if a process is killed in the electronic device, that is, the system memory is very tight, in order to maintain the overall stability, the operating system may actively terminate certain processes. In this case, the memory capacity can also be released by deleting the N memory objects in the memory.

[0078] In addition, similarly, if the file page corresponding to the compressed package to be deleted has been marked as "abnormal state" or "suspected abnormal state" (i.e., has the first mark or the third mark), when deleting the compressed package, it is necessary to remove the first mark or the third mark first, so as to ensure that when the system processes these file pages later, it will not mistakenly believe that they are still in an abnormal state due to the existence of the mark.

[0079] In the above method, when the system memory is tight, memory resources can be released by deleting memory objects such as compressed packages in the memory to relieve memory pressure.

[0080] In some embodiments, the method further comprises:

[0081] If the target file page meets the target condition and the target file page has a corresponding second identifier, deleting the second identifier;

[0082] The target condition includes at least one of the following:

[0083] The content of the target file page changes;

[0084] The size of the file to which the target file page belongs changes;

[0085] There is no compression package corresponding to the first file page in the memory, and the first file page is a file page included in the file to which the target file page belongs.

[0086] In this embodiment, since the second identifier means that the compression package corresponding to the target file page identified by it is larger, whenever it is detected that compression of the target file page is skipped due to the existence of the corresponding second identifier in the target file page, it can be determined whether to delete the second identifier.

[0087] Specifically, if the content of the target file page in the memory has been modified after the second identifier is added, it is impossible to determine whether the compressed package corresponding to the target file page is still large, and the second identifier on the target file page needs to be deleted; if the size of the file to which the target file page belongs has changed after the second identifier is added, it is also impossible to determine whether the compressed package corresponding to the target file page is still large, and the second identifier on the target file page also needs to be deleted; and if there is no compressed package of the first file page belonging to the same file as the target file page in the memory, the second identifier on the target file page can also be deleted.

[0088] In the above manner, the second identifier of the file page is managed and updated according to the status change of the file to ensure that the actual compression effect of the file page meets expectations.

[0089] Figure 2 FIG. 1 is a schematic diagram of a file page management device provided in another embodiment of the present application. Figure 2 As shown, the management device of the file page may include:

[0090] A determination module 201 is used to determine a target file page in the memory according to an IO abnormality of the file page;

[0091] A compression module 202, used for compressing the target file page in an idle state to obtain a compressed package of the target file page;

[0092] The storage module 203 is used to delete the target file page and store the compressed package in the memory.

[0093] In this application, the IO anomalies of the file pages can be monitored, and the target file pages that may affect the performance can be accurately identified. When the device is in an idle state, these target file pages are compressed and converted into compressed packages. The original target file pages are deleted, and only the compressed packages are stored in the memory. In this way, only the target file pages that may affect the performance of the device can be compressed in the idle state to release memory, avoiding the compression operation from occupying system resources under high load, thereby avoiding reducing the reading speed of the file, while reducing memory usage and ensuring the overall performance of the electronic device.

[0094] In another optional example, the determining module 201 includes:

[0095] A first determining unit is used to determine a first threshold value according to an IO abnormality of the file page, and determine a file page in the memory whose size is smaller than the first threshold value as a target file page; and or

[0096] The second determination unit is used to mark the file page with a first identifier according to the IO abnormality of the file page, and determine the file page in the memory that does not have the first identifier as the target file page, wherein the first identifier is used to indicate that the file page has an IO abnormality.

[0097] In another optional example, the file page management device includes:

[0098] A first adding module is used for applying for a bit table corresponding to the number of file pages in a target file and adding a second identifier at a position corresponding to the target file page in the bit table when the size of the compressed package is greater than the second threshold value and there is no compressed package corresponding to any first file page in the memory, wherein the target file is the file to which the target file page belongs and the first file page is the file page included in the target file;

[0099] The second adding module is used to obtain the bit table corresponding to the target file and add the second identifier at the position corresponding to the target file page in the bit table when the size of the compressed package is greater than the second threshold and there is a compressed package corresponding to the first file page in the memory.

[0100] In another optional example, the determining module 201 includes:

[0101] an adding unit, configured to add a third identifier to the P first file pages when delayed reading and writing of the P first file pages is detected for the first time, wherein the delayed reading and writing refers to an average speed of the reading and writing operations being less than a speed threshold, and P is a positive integer greater than or equal to 1;

[0102] An updating unit is used to update the third identifiers corresponding to the P first file pages to the first identifier and determine the P first file pages as target file pages when it is detected that the P first file pages undergo Q delayed reading and writing after the third identifier is added, where Q is a positive integer.

[0103] In another optional example, the file page management device further includes:

[0104] A clearing module, configured to delete the second identifier when the target file page meets the target condition and the target file page has a corresponding second identifier, wherein the second identifier is used to indicate that the compressed package corresponding to the identified file page is greater than a second threshold;

[0105] The target condition includes at least one of the following:

[0106] The content of the target file page changes;

[0107] The size of the file to which the target file page belongs changes;

[0108] There is no compression package corresponding to the first file page in the memory, and the first file page is a file page included in the file to which the target file page belongs.

[0109] The file page management device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a car-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and the embodiment of the present application is not specifically limited.

[0110] The file page management device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0111] The file page management device provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0112] Alternatively, if Figure 3 As shown, an embodiment of the present application also provides an electronic device 100, including a processor 110, a memory 119, and a program or instruction stored in the memory 119 and executable on the processor 110. When the program or instruction is executed by the processor 110, each process of the above-mentioned file page management method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0113] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.

[0114] Please refer to Figure 4 , Figure 4 The hardware structure diagram of an electronic device for implementing an embodiment of the present application is shown in FIG. The electronic device 100 includes, but is not limited to, a radio frequency unit 121, a network module 122, an audio output unit 123, an input unit 124, a sensor 125, a display unit 126, a user input unit 127, an interface unit 128, a memory 129, and a processor 120.

[0115] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 120 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 4 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0116] The processor 120 is used to determine the target file page in the memory according to the IO abnormality of the file page;

[0117] The processor 120 is used to compress the target file page in an idle state to obtain a compressed package of the target file page;

[0118] The memory 129 is used to delete the target file page and store the compressed package in the memory.

[0119] In this application, the IO anomalies of the file pages can be monitored, and the target file pages that may affect the performance can be accurately identified. When the device is in an idle state, these target file pages are compressed and converted into compressed packages. The original target file pages are deleted, and only the compressed packages are stored in the memory. In this way, only the target file pages that may affect the performance of the device can be compressed in the idle state to release memory, avoiding the compression operation from occupying system resources under high load, thereby avoiding reducing the reading speed of the file, while reducing memory usage and ensuring the overall performance of the electronic device.

[0120] In another optional example, the processor 120 is further configured to:

[0121] Determine a first threshold value according to the IO abnormality of the file page, and determine a file page in the memory whose size is smaller than the first threshold value as a target file page; and or

[0122] According to the IO abnormality of the file page, a first mark is added to the file page, and a file page in the memory that does not have the first mark is determined as a target file page, where the first mark is used to indicate that the file page has an IO abnormality.

[0123] In another optional example, the processor 120 is further configured to:

[0124] When the size of the compressed package is greater than a second threshold value and there is no compressed package corresponding to the first file page in the memory, applying for a bit table corresponding to the target file, and adding a second identifier at a position corresponding to the target file page in the bit table, the target file page and the first file page are file pages included in the target file;

[0125] When the size of the compressed package is greater than the second threshold and a compressed package corresponding to the first file page exists in the memory, the bit table corresponding to the target file is obtained, and the second identifier is added to the position corresponding to the target file page in the bit table.

[0126] In another optional example, the processor 120 is further configured to:

[0127] When delayed reading and writing of P first file pages is detected for the first time, a third identifier is added to the P first file pages, where the delayed reading and writing is that the average speed of the reading and writing operations is less than the speed threshold, and P is a positive integer greater than or equal to 1;

[0128] When it is detected that the P first file pages undergo Q delayed reading and writing after adding the third identifier, the third identifiers corresponding to the P first file pages are updated to the first identifier, and the P first file pages are determined as target file pages, where Q is a positive integer.

[0129] In another optional example, the processor 120 is further configured to:

[0130] If the target file page meets the target condition and the target file page has a corresponding second identifier, deleting the second identifier, where the second identifier is used to indicate that the compression package corresponding to the identified file page is greater than a second threshold;

[0131] The target condition includes at least one of the following:

[0132] The content of the target file page changes;

[0133] The size of the file to which the target file page belongs changes;

[0134] There does not exist any compression package corresponding to any first file page in the memory, and the first file page is a file page included in the file to which the target file page belongs.

[0135] It should be understood that in the embodiment of the present application, the input unit 124 may include a graphics processor (Graphics Processing Unit, GPU) 1241 and a microphone 1242, and the graphics processor 1241 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 126 may include a display panel 1261, and the display panel 1261 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 127 includes a touch panel 1271 and at least one of other input devices 1272. The touch panel 1271 is also called a touch screen. The touch panel 1271 may include two parts: a touch detection device and a touch controller. Other input devices 1272 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0136] The memory 129 can be used to store software programs and various data. The memory 129 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 129 may include a volatile memory or a non-volatile memory, or the memory 129 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 129 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0137] The processor 120 may include one or more processing units; optionally, the processor 120 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 120.

[0138] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned file page management method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0139] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0140] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned file page management method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0141] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0142] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned file page management method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0143] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

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

[0145] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A method for managing a file page, characterized in that: include: According to the IO abnormality of the file page, determine the target file page in the memory; Compressing the target file page in an idle state to obtain a compressed package of the target file page; The target file page is deleted, and the compressed package is stored in the memory.

2. The method according to claim 1, characterized in that: The step of determining the target file page in the memory according to the IO abnormality of the file page includes: Determine a first threshold value according to the IO abnormality of the file page, and determine a file page in the memory whose size is smaller than the first threshold value as a target file page; and or According to the IO abnormality of the file page, a first mark is added to the file page, and a file page in the memory that does not have the first mark is determined as a target file page, where the first mark is used to indicate that the file page has an IO abnormality.

3. The method according to claim 1, characterized in that After compressing the target file page in the idle state to obtain a compressed package of the target file page, the method further includes: When the size of the compressed package is greater than a second threshold value and there is no compressed package corresponding to the first file page in the memory, applying for a bit table corresponding to the target file, and adding a second identifier at a position corresponding to the target file page in the bit table, the target file page and the first file page are file pages included in the target file; When the size of the compressed package is greater than the second threshold and a compressed package corresponding to the first file page exists in the memory, the bit table corresponding to the target file is obtained, and the second identifier is added to the position corresponding to the target file page in the bit table.

4. The method according to claim 1, characterized in that: Determining the target file page in the memory according to the IO abnormality of the file page includes: When delayed reading and writing of P first file pages is detected for the first time, a third identifier is added to the P first file pages, where the delayed reading and writing is that the average speed of the reading and writing operations is less than the speed threshold, and P is a positive integer greater than or equal to 1; When it is detected that the P first file pages undergo Q delayed reading and writing after adding the third identifier, the third identifiers corresponding to the P first file pages are updated to the first identifier, and the P first file pages are determined as target file pages, where Q is a positive integer.

5. The method according to claim 1, characterized in that The method further comprises: If the target file page meets the target condition and the target file page has a corresponding second identifier, deleting the second identifier, where the second identifier is used to indicate that the compression package corresponding to the identified file page is greater than a second threshold; The target condition includes at least one of the following: The content of the target file page changes; The size of the file to which the target file page belongs changes; There is no compression package corresponding to the first file page in the memory, and the first file page is a file page included in the file to which the target file page belongs.

6. A file page management device, characterized in that: include: A determination module, used to determine a target file page in memory according to an IO abnormality of the file page; A compression module, used for compressing the target file page in an idle state to obtain a compressed package of the target file page; A storage module is used to delete the target file page and store the compressed package in the memory.

7. The device according to claim 6, characterized in that The determination module comprises: A first determining unit is used to determine a first threshold value according to an IO abnormality of the file page, and determine a file page in the memory whose size is smaller than the first threshold value as a target file page; and or The second determination unit is used to mark the file page with a first identifier according to the IO abnormality of the file page, and determine the file page in the memory that does not have the first identifier as the target file page, wherein the first identifier is used to indicate that the file page has an IO abnormality.

8. The device according to claim 6, characterized in that The file page management device also includes: A first adding module is used for applying for a bit table corresponding to the number of file pages in a target file and adding a second identifier at a position corresponding to the target file page in the bit table when the size of the compressed package is greater than a second threshold value and there is no compressed package corresponding to any first file page in the memory, wherein the target file is the file to which the target file page belongs and the first file page is the file page included in the target file; The second adding module is used to obtain the bit table corresponding to the target file and add the second identifier at the position corresponding to the target file page in the bit table when the size of the compressed package is greater than the second threshold and there is a compressed package corresponding to the first file page in the memory.

9. The device according to claim 6, characterized in that The determination module comprises: an adding unit, configured to add a third identifier to the P first file pages when delayed reading and writing of the P first file pages is detected for the first time, wherein the delayed reading and writing refers to an average speed of the reading and writing operations being less than a speed threshold, and P is a positive integer greater than or equal to 1; An updating unit is used to update the third identifiers corresponding to the P first file pages to the first identifier and determine the P first file pages as target file pages when it is detected that the P first file pages undergo Q delayed reading and writing after the third identifier is added, where Q is a positive integer.

10. The device according to claim 6, characterized in that The file page management device also includes: A clearing module, configured to delete the second identifier when the target file page meets the target condition and the target file page has a corresponding second identifier, wherein the second identifier is used to indicate that the compressed package corresponding to the identified file page is greater than a second threshold; The target condition includes at least one of the following: The content of the target file page changes; The size of the file to which the target file page belongs changes; There is no compression package corresponding to the first file page in the memory, and the first file page is a file page included in the file to which the target file page belongs.

11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the file page management method according to any one of claims 1 to 5 are implemented.

12. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the file page management method according to any one of claims 1 to 5 are implemented.