File page pre-reading method, device, terminal and storage medium

By obtaining page read and write order and system resource information in the terminal operating system, and pre-reading multiple pages into memory system resources, the problem of waiting to be read into memory after file page write operation is solved, and reading and writing efficiency is improved.

CN112199618BActive Publication Date: 2024-11-12GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011140071.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-22
Publication Date
2024-11-12
Estimated Expiration
2040-10-22

AI Technical Summary

Technical Problem

In the terminal operating system, after writing the file page, you need to wait for the next page to be read from disk into memory before writing, resulting in low read and write efficiency.

Method used

By obtaining the page read and write order and system resource information in the operating system, multiple pages are read out to the memory system resource when the resource threshold is met, reducing the waiting time.

Benefits of technology

Improve the reading and writing efficiency of the target file, reduce the page acquisition time, and improve the reading and writing speed of the file.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112199618B_ABST
    Figure CN112199618B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of terminal technology, and specifically, relates to a file page pre-reading method, device, terminal and storage medium. Among them, a file page pre-reading method includes: obtaining the page read and write order of a target file in an operating system, and the target file includes multiple pages; when the page read and write order is sequential read and write, obtaining the system resource information of the operating system; when the system resource information indicates that the system resources of the operating system meet the resource threshold, pre-reading the multiple pages into the memory system resources of the operating system, and obtaining the second page from the memory system resources when the first page completes the write operation; wherein, the first page and the second page are two adjacent pages among the multiple pages. Therefore, when the first page completes the write operation, the second page adjacent to the first page can be directly obtained from the memory system resources, which can improve the read and write efficiency of the target file.
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 pre-reading method, device, terminal and storage medium. Background Art

[0002] With the continuous development of terminal technology, the operating systems supported by terminals are also developing rapidly. When a user writes a file page, the operating system needs to wait for the next page to be read from the operating system's disk into the operating system's memory system resources after completing the write operation on one page of the file. The operating system can then write the next page until all pages of the file are written. Summary of the invention

[0003] The embodiment of the present application provides a file page pre-reading method, device, terminal and storage medium, which can improve the reading and writing efficiency of the target file. The technical solution includes:

[0004] In a first aspect, an embodiment of the present application provides a file page pre-reading method, the method comprising:

[0005] Obtaining a page read and write order of a target file in an operating system, wherein the target file includes a plurality of pages;

[0006] When the page read and write order is sequential read and write, obtaining system resource information of the operating system;

[0007] When the system resource information indicates that the system resources of the operating system meet the resource threshold, pre-reading the multiple pages into the memory system resources of the operating system, and acquiring the second page from the memory system resources when the write operation of the first page is completed;

[0008] The first page and the second page are two adjacent pages among the multiple pages.

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

[0010] A sequence acquisition unit, used for acquiring a page read and write sequence of a target file in an operating system, wherein the target file includes a plurality of pages;

[0011] An information acquisition unit, used for acquiring system resource information of the operating system when the page read and write order is sequential read and write;

[0012] a page pre-reading unit, configured to pre-read the plurality of pages into a memory system resource of the operating system when the system resource information indicates that the system resource of the operating system meets a resource threshold, and to obtain a second page from the memory system resource when a write operation on the first page is completed;

[0013] The first page and the second page are two adjacent pages among the multiple pages.

[0014] In a third aspect, an embodiment of the present application provides a terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the methods described in the first aspect when executing the computer program.

[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements any of the methods described above when executed by a processor.

[0016] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in the first aspect of the embodiment of the present application. The computer program product may be a software installation package.

[0017] In one or more embodiments of the present application, when the page read and write order of the target file in the operating system is sequential read and write, the system resource information of the operating system can be obtained, and when the system resource information indicates that the system resources of the operating system meet the resource threshold, multiple pages of the target file can be pre-read into the memory system resources of the operating system. Therefore, when the write operation of the first page is completed, the second page adjacent to the first page can be directly obtained from the memory system resources, and it is not necessary to wait for the operating system to read the second page into the memory system resources of the operating system when the write operation of the first page is completed. The waiting time for the second page to be read into the memory system resources can be reduced, the page acquisition time can be reduced, the page read and write speed of the target file can be improved, and the read and write efficiency of the target file can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 A schematic diagram showing an application scenario of a file page pre-reading method or a file page pre-reading device applied to an embodiment of the present application;

[0020] Figure 2 A schematic diagram showing a flow chart of a file page pre-reading method according to an embodiment of the present application;

[0021] Figure 3 An example schematic diagram showing a page read and write sequence according to an embodiment of the present application;

[0022] Figure 4 A schematic diagram showing a flow chart of a file page pre-reading method according to an embodiment of the present application;

[0023] Figure 5 A schematic diagram showing a flow chart of a file page pre-reading method according to an embodiment of the present application;

[0024] Figure 6 A schematic diagram showing a flow chart of a file page pre-reading method according to an embodiment of the present application;

[0025] Figure 7 A schematic diagram showing a flow chart of a file page pre-reading method according to an embodiment of the present application;

[0026] Figure 8 A schematic diagram showing a flow chart of a file page pre-reading method according to an embodiment of the present application;

[0027] Fig. 9 A schematic diagram showing the structure of a file page pre-reading device according to an embodiment of the present application;

[0028] Fig.10 A schematic diagram showing the structure of a terminal according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of them. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0030] In the description of the present application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In the description of the present application, it should be noted that, unless otherwise clearly specified and limited, "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood in specific circumstances. In addition, in the description of the present application, unless otherwise specified, "multiple" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B, which can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are an "or" relationship.

[0031] In the related art, Figure 1 A schematic diagram of an application scenario of a file page pre-reading method or a file page pre-reading device applied to an embodiment of the present application is shown. When the operating system 10 writes a file, the operating system 10 can read the file from the disk 100 into the memory system resource 200, modify the data in the memory system resource 200, and then write the data to the disk 100 to complete the write operation on a file. The file read into the memory system resource 200 can, for example, consist of multiple pages. When the operating system 10 triggers a write operation, it can only write to one page. Therefore, when the file includes multiple pages, the operating system 10 can read a page from the disk 100 into the memory system resource 200. When the write operation on the page is completed, the operating system 10 needs to read the second page from the disk 100 into the memory system resource 200 before the second page can be written. Therefore, when the file page read and write order is sequential read and write, the operating system 10 will wait until the next page is read from the disk 100 to the memory system resource 200 when the previous page completes the write operation before writing the next page, which will increase the page read time, reduce the file page read and write speed, and reduce the file read and write efficiency. The embodiment of the present application provides a file page pre-reading method, which can improve the read and write efficiency of the target file.

[0032] The following will be combined with the attached Figure 2 -Attached Figure 8 , the file page pre-reading method provided by the embodiment of the present application is introduced in detail. Figure 2 -Attached Figure 8 The execution subject of the illustrated embodiment may be, for example, a terminal.

[0033] See also Figure 2 , which is a flowchart of a method for pre-reading a file page according to an embodiment of the present application. Figure 2 As shown, the method in the embodiment of the present application may include the following steps S101 to S103.

[0034] S101, obtaining a page read and write order of a target file in an operating system, where the target file includes multiple pages.

[0035] According to some embodiments, the file page pre-reading method of the embodiment of the present application is applicable to the page write operation of the target file is completed through the file cache mechanism. The operating system (OS) refers to a system in the terminal that can be used to perform functions such as managing and configuring memory, determining the priority of system resource supply and demand, etc. The system includes but is not limited to the Linux operating system, Windows operating system, etc. The operating system of the embodiment of the present application can be, for example, a Linux operating system. The Linux operating system is a cloning system developed based on the UNIX operating system. The Linux operating system uses a file cache mechanism to perform file write operations.

[0036] It is easy to understand that the target file refers to a file written by the operating system, and does not specifically refer to a fixed file. For example, when the operating system in the terminal writes to file A, file A can be the target file. When the operating system in the terminal writes to file B, file B can be the target file. The target file includes multiple pages, that is, the target file includes at least two pages. Different target files may include different numbers of pages. For example, the target file may be file A, and file A may include, for example, page A1, page A2, page A3, page A4, page A5, page A6, and page A7. For example, the target file may be file B, and file A may include, for example, page B1, page B2, page B3, and page B4.

[0037] According to some embodiments, when the terminal performs a write operation on the target file, the terminal can obtain the page read and write order of the target file in the operating system. The page read and write order includes but is not limited to sequential read and write, and random read and write, wherein the sequential read and write includes but is not limited to the order of sequential read and write from the first page of the target file to the last page of the target file, and the order of reverse read and write from the last page of the target file to the first page of the target file.

[0038] It is easy to understand that when the files in the Linux operating system include A file, B file, C file and D file, the target file may be, for example, file A, and the A file may include, for example, page A1, page A2, page A3, page A4, page A5, page A6 and page A7. When the terminal performs a write operation on file A, the terminal may obtain the page read and write order of file A.

[0039] S102, when the page read and write order is sequential read and write, obtaining system resource information of the operating system.

[0040] According to some embodiments, sequential reading and writing includes but is not limited to sequential reading and writing from the first page of the target file to the last page of the target file, reverse reading and writing from the last page of the target file to the first page of the target file, etc. Figure 3 As shown, the target file may be, for example, file A, which may include page A1, page A2, page A3, page A4, page A5, page A6 and page A7. The page read and write order is sequential read and write, including but not limited to page read and write order 1 of reading from page A1, page A2, page A3, page A4, page A5, page A6 to page A7 and page read and write order 2 of reading from page A7, page A6, page A5, page A4, page A3, page A2 to page A1.

[0041] It is easy to understand that the system resource information includes but is not limited to the resource configuration information in the operating system and the resource information of the operating system operation. For example, the system resource information includes but is not limited to the remaining free memory of the operating system, the available memory of the operating system, the memory recycling pressure value of the operating system, and the IO pressure value of the operating system.

[0042] According to some embodiments, when the terminal performs a write operation on a target file, the terminal can obtain the page read and write order of the target file in the operating system. When the page read and write order obtained by the terminal is sequential read and write, the terminal can obtain the system resource information of the operating system. For example, when the terminal performs a write operation on file A, the terminal can obtain the page read and write order of file A. For example, when the terminal obtains that the first page of file A currently written by the Linux operating system is the last page of the target file, the terminal can determine that the page read and write order of file A is sequential read and write, and the terminal can obtain the system resource information of the Linux operating system.

[0043] S103, when the system resource information indicates that the system resources of the operating system meet the resource threshold, pre-read multiple pages into the memory system resources of the operating system, and obtain the second page from the memory system resources when the write operation of the first page is completed; wherein the first page and the second page are two adjacent pages among the multiple pages.

[0044] According to some embodiments, the first page refers to a page in the target file, and the first page can be any page in the target file. The first page does not specifically refer to a fixed page. For example, when the target file changes, the first page will also change accordingly. The second page can be a page in the target file, and the second page and the first page are two adjacent pages among multiple pages of the target file. For example, when the target file is an A file, the first page can be an A1 page, and the second page can be an A2 page. The first page can also be an A7 page, and the second page can be an A6 page. The first page can also be an A3 page, and the second page can be an A4 page.

[0045] It is easy to understand that when the terminal obtains the system resource information of the operating system, the terminal can determine whether the system resource information meets the resource threshold. When the system resource information indicates that the system resources of the operating system meet the resource threshold, the terminal can pre-read multiple pages into the memory resources of the operating system. When the terminal pre-reads multiple pages of the target file into the memory resources of the operating system, the terminal can directly obtain the second page from the memory system resources when the write operation of the first page is completed.

[0046] According to some embodiments, for example, when the terminal obtains that the first page of the A file currently written by the Linux operating system is the last page A7 of the target file, the terminal can determine that the page read and write order of the A file is sequential read and write, and the terminal can obtain the system resource information of the Linux operating system. The system resource information of the Linux operating system obtained by the terminal includes the remaining free memory and available memory of the Linux operating system. When the terminal detects that the remaining free memory is less than the first memory threshold, the terminal can obtain the available memory. When the terminal detects that the available memory is greater than or equal to the second memory threshold, that is, the available memory indicates that the system resources of the Linux operating system meet the resource threshold, the terminal can pre-read the A1 page, A2 page, A3 page, A4 page, A5 page, A6 page and A7 page of the A file into the memory resources of the Linux operating system. When the terminal completes the write operation on the A7 page of the A file, the terminal can directly obtain the A6 page from the memory resources of the Linux system.

[0047] According to some embodiments, when the terminal pre-reads multiple pages into the memory system resources of the operating system, the terminal may pre-read a preset number of pages into the memory system resources of the operating system, and may also pre-read all pages corresponding to the target file into the memory system resources of the operating system. For example, when file A includes A1 page, A2 page, A3 page, A4 page, A5 page, A6 page, and A7 page, the page currently being written by the terminal is A7 page. When the terminal pre-reads multiple pages into the memory system resources of the operating system, the terminal may pre-read a preset number of pages into the memory system resources of the operating system. For example, A6 page, A5 page, and A4 page may be pre-read into the memory system resources of the operating system. When it is detected that the page currently being written by the terminal is A4 page, A3 page, A2 page, and A1 page are pre-read into the memory system resources of the operating system.

[0048] In one or more embodiments of the present application, when the page read and write order of the target file in the operating system is sequential read and write, the terminal can obtain the system resource information of the operating system, and when the system resource information indicates that the system resources of the operating system meet the resource threshold, multiple pages of the target file can be pre-read into the memory system resources of the operating system. Therefore, when the write operation of the first page is completed, the second page adjacent to the first page can be directly obtained from the memory system resources, and there is no need to wait for the terminal's operating system to read the second page into the memory system resources of the operating system when the write operation of the first page is completed. The waiting time for the page to be read into the memory system resources can be reduced, the page reading time can be reduced, and the page reading and writing speed of the target file can be improved, thereby improving the read and write efficiency of the target file.

[0049] See also Figure 4 , which is a flowchart of a method for pre-reading a file page according to an embodiment of the present application. Figure 4 As shown, the method of the embodiment of the present application may include the following steps S201-S203.

[0050] S201, when the first page of the target file currently written by the operating system is the first page of the target file, determining that the page read and write order of the target file is sequential read and write, and the target file includes multiple pages.

[0051] According to some embodiments, when the operating system in the terminal performs a write operation on the target file, the operating system can obtain the first page of the target file currently written by the operating system. The target file may include multiple pages, for example. The first page refers to a page in the target file, and does not specifically refer to a fixed page. For example, when the target file is file A, and file A includes page A1, page A2, page A3, page A4, page A5, page A6, and page A7, the first page may be page A7, and the first page may also be page A1.

[0052] It is easy to understand that when the terminal obtains the first page of the target file currently written by the operating system, the terminal can determine whether the first page of the target file currently written by the operating system is the first page of the target file. When the terminal determines that the first page of the target file currently written is the first page of the target file, the terminal can determine that the page read and write order of the target file is a sequential read and write order. Among them, the terminal determines the page read and write order of the target file based on the first page of the target file currently written by the operating system is only one way for the terminal to determine the page read and write order of the target file. The file page pre-reading method of the embodiment of the present application also includes other achievable determination methods. For example, when the first page of the target file currently written by the operating system is the last page of the target file, the terminal can also determine that the page read and write order of the target file is a sequential read and write.

[0053] According to some embodiments, when the Linux operating system includes file A, file B, file C, and file D, the target file may be, for example, file A. The first page of the currently written file A obtained by the Linux operating system in the terminal may be, for example, page A1. When the terminal detects that page A1 is the first page of file A, the terminal may determine that the read and write order of file A is sequential read and write.

[0054] It is easy to understand that before the terminal performs a write operation on the target file, the terminal may sort multiple pages of the target file.

[0055] According to some embodiments, see Figure 5 , which is a flowchart of a method for pre-reading a file page according to an embodiment of the present application. Figure 5 As shown, the method of the embodiment of the present application can also include the following steps S301-S302 in obtaining the page read and write order of the target file in the operating system. S301, obtaining the first page of the target file currently written by the operating system, and obtaining the third page last written by the operating system based on the first page; S302, when the first page and the third page are adjacent pages in multiple pages of the target file, determining that the page read and write order of the target file is sequential read and write.

[0056] According to some embodiments, when the terminal performs a write operation on the target file, the terminal may obtain the first page of the target file currently written by the operating system. The target file may include multiple pages, for example. The first page refers to a page in the target file, and does not specifically refer to a fixed page. For example, when the target file is file A, and file A includes page A1, page A2, page A3, page A4, page A5, page A6, and page A7, the first page may be page A1, and the first page may also be page A7.

[0057] It is easy to understand that when the terminal obtains the first page of the target file currently written by the operating system, the terminal can obtain the third page written by the operating system last based on the first page. Among them, the third page is a page in the target file, which refers to the page written by the operating system last when writing the first page. For example, when the target file is file A, and file A includes page A1, page A2, page A3, page A4, page A5, page A6 and page A7, when the operating system finishes writing page A2 and the current page being written is page A3, the first page obtained by the operating system can be, for example, page A3, and the third page can be, for example, page A2.

[0058] According to some embodiments, when the terminal obtains the first page of the target file currently written by the operating system, and obtains the third page written by the operating system last based on the first page, the terminal can determine whether the first page and the third page are adjacent pages among the multiple pages of the target file. When the terminal detects that the first page and the third page are adjacent pages among the multiple pages of the target file, the terminal can determine that the page read and write order of the target file is sequential read and write. The terminal determines the page read and write order based on the first page and the third page, which can improve the accuracy of determining the page read and write order, improve the accuracy of pre-reading of file pages, and improve the read and write efficiency of file pages.

[0059] It is easy to understand that, when the target file is, for example, file A, and file A includes page A1, page A2, page A3, page A4, page A5, page A6, and page A7, and the page sequence of file A is page A1 to page A7, the first page acquired by the terminal may be, for example, page A6, and the third page acquired by the terminal based on the first page may be, for example, page A5. When the terminal detects that the first page A6 and the third page A5 are adjacent pages in the multiple pages of the target file, the terminal determines that the page read and write sequence of the target file is sequential read and write.

[0060] According to some embodiments, the target file is, for example, file A, which includes page A1, page A2, page A3, page A4, page A5, page A6, and page A7, and the page order of file A is page A1 to page A7, the first page acquired by the terminal may be, for example, page A6, and the third page acquired by the terminal based on the first page may be, for example, page A7. When the terminal detects that the first page A6 and the third page A7 are adjacent pages in the multiple pages of the target file, the terminal determines that the page read and write order of the target file is sequential read and write.

[0061] Optionally, when the first page acquired by the terminal may be, for example, page A2, and the third page acquired by the terminal based on the first page may be, for example, page A5. When the terminal detects that the first page A2 and the third page A5 are not adjacent pages in the multiple pages of the target file, it is determined that the page read and write order of the target file is not sequential read and write.

[0062] S202, when the page read and write order is sequential read and write, obtaining the remaining free memory and input / output IO pressure value of the operating system.

[0063] According to some embodiments, when the terminal determines that the page read and write order is sequential read and write, the terminal can obtain system resource information of the operating system. The system resource information can be, for example, the remaining free memory and input / output (IO) pressure value of the operating system. The remaining free memory refers to the memory in the operating system that is idle after the memory allocation is completed. The IO pressure value refers to the current input / output pressure value of the operating system, which can indicate the current task scheduling of the operating system.

[0064] It is easy to understand that when the terminal determines that the page read and write order is sequential read and write, the remaining free memory of the operating system obtained by the terminal may be, for example, 100M and the IO pressure value may be 30MB / s.

[0065] According to some embodiments, see Figure 6 , which is a flowchart of a method for pre-reading a file page according to an embodiment of the present application. Figure 6 As shown, the method of the embodiment of the present application may include the following steps S401-S403 when obtaining the IO pressure value of the operating system. S401, obtaining the total IO volume of the operating system within the second time period; S402, determining the IO load of the operating system based on the total IO volume and the second time period; S403, determining the IO pressure value of the operating system based on the IO load.

[0066] According to some embodiments, when the terminal obtains the IO pressure value of the operating system, the terminal can obtain the total IO amount of the operating system within the second time period. The second time period can be an operation time period preset by the terminal, or it can be a second time period determined by the terminal based on a received instruction for obtaining the time period. For example, when the terminal receives an instruction for obtaining the total IO amount of the operating system input by the user, the terminal can start recording the start time point. When the terminal receives an instruction for stopping obtaining the total IO amount of the operating system input by the user again, the terminal can record the stop time point. Based on the start time point and the stop time point, the terminal can obtain the second time period and the total IO amount within the second time period.

[0067] It is easy to understand that when the terminal obtains the second duration and the total IO amount within the second duration, the terminal can determine the IO load of the operating system based on the second duration and the total IO amount within the second duration. For example, the terminal can use formula (1) to calculate the IO load of the operating system.

[0068] IO load = total IO amount / second duration (1)

[0069] According to some embodiments, when the terminal determines the IO load of the operating system based on the total IO volume and the second duration, the terminal may determine the IO pressure value of the operating system based on the IO load, wherein the greater the IO load, the greater the IO pressure value of the operating system.

[0070] S203, when the remaining free memory is greater than or equal to the first memory threshold and the IO pressure value is less than the IO pressure threshold, pre-read multiple pages into the memory system resources of the operating system, and obtain the second page from the memory system resources when the write operation of the first page is completed; wherein the first page and the second page are two adjacent pages among the multiple pages.

[0071] According to some embodiments, when the terminal obtains the remaining free memory and IO pressure value of the operating system, the terminal can determine whether the remaining free memory of the operating system is greater than or equal to the first memory threshold and whether the IO pressure value is less than the IO pressure value. Among them, the first pressure threshold is the first pressure threshold corresponding to the remaining free memory, and does not specifically refer to a fixed threshold. The first pressure threshold can be changed based on the user's pressure threshold setting instruction. The threshold setting instruction includes but is not limited to a voice threshold setting instruction, a click threshold setting instruction, a text threshold setting instruction, etc.

[0072] It is easy to understand that when the terminal determines that the remaining free memory is greater than or equal to the first memory threshold and the IO pressure value is less than the IO pressure threshold, the terminal can pre-read multiple pages into the memory system resources of the operating system. When the terminal pre-reads multiple pages of the target file into the memory resources of the operating system, the terminal can directly obtain the second page adjacent to the first page from the memory system resources when the first page completes the write operation, without waiting for the operating system to read the second page into the memory system resources.

[0073] According to some embodiments, when the terminal determines whether the remaining free memory of the operating system is greater than or equal to a first memory threshold and whether the IO pressure value is less than the IO pressure threshold, the terminal may first determine whether the remaining free memory is greater than or equal to the first memory threshold, and then determine whether the IO pressure value is less than the pressure threshold when it is determined that the remaining free memory is greater than or equal to the first memory threshold. Therefore, when the remaining free memory is less than the first memory threshold, the IO pressure value may not be determined, which can reduce the operating system's determination steps for system resource information and reduce page pre-reading time.

[0074] It is easy to understand that when the terminal determines whether the remaining free memory of the operating system is greater than or equal to the first memory threshold and whether the IO pressure value is less than the IO pressure threshold, the terminal can first determine whether the IO pressure value is less than the IO pressure threshold, and then determine whether the remaining free memory is greater than or equal to the first memory threshold when it is determined that the IO pressure value is less than the IO pressure threshold. Therefore, when the IO pressure value is less than the IO pressure threshold, the remaining free memory does not need to be judged, which can reduce the operating system's judgment steps on system resource information and reduce page pre-reading time.

[0075] Optionally, when the terminal determines whether the remaining free memory of the operating system is greater than or equal to the first memory threshold and whether the IO pressure value is less than the pressure threshold, the terminal can directly determine whether the remaining free memory is greater than or equal to the first memory threshold and whether the IO pressure value is less than the pressure threshold, which can improve the convenience of the operating system to perform page pre-reading.

[0076] It is easy to understand that when the terminal determines whether the remaining free memory of the operating system is greater than or equal to the first memory threshold and whether the IO pressure value is less than the IO pressure value, the terminal can first determine whether the remaining free memory is greater than or equal to the first memory threshold, and then determine whether the IO pressure value is less than the IO pressure value. When the terminal determines that the remaining free memory is greater than or equal to the first memory threshold, the terminal can determine whether the IO pressure value is less than the IO pressure value. When the operating system determines that the IO pressure value is less than the IO pressure value, the terminal can pre-read multiple pages into the memory system resources of the operating system. When the terminal pre-reads multiple pages of the target file into the memory resources of the operating system, the terminal can directly obtain the second page from the memory system resources when the write operation on the first page is completed, without waiting for the operating system to read the second page into the memory system resources.

[0077] In one or more embodiments of the present application, the terminal can determine that the page read and write order of the target file is sequential read and write when the first page of the target file currently written by the operating system is the first page of the target file. The terminal directly determines the page read and write order based on the first page, which can reduce the steps of determining the page read and write order, reduce the steps of page pre-reading, and improve the pre-reading efficiency of file pages. Secondly, when the page read and write order is sequential read and write, the terminal can obtain the remaining free memory and input / output IO pressure value of the operating system, and when the remaining free memory is greater than or equal to the first memory threshold and the IO pressure value is less than the IO pressure threshold, multiple pages are pre-read into the memory system resources of the operating system, which can reduce the situation where the page pre-reading efficiency is low due to insufficient remaining free memory or excessive IO pressure value, and can increase the speed of page pre-reading, thereby improving the efficiency of file pages.

[0078] See also Figure 7 , which is a flowchart of a method for pre-reading a file page according to an embodiment of the present application. Figure 7 As shown, the method of the embodiment of the present application may include the following steps S501-S504.

[0079] S501, obtaining a page read and write order of a target file in an operating system, where the target file includes multiple pages.

[0080] The specific process is as described above and will not be repeated here.

[0081] S502, when the page read and write order is sequential read and write, obtain the available memory of the operating system, where the available memory includes the remaining free memory and the file cache memory.

[0082] According to some embodiments, when the terminal determines that the page read and write order of the target file is sequential read and write, the terminal can obtain the available memory of the operating system. The available memory includes the remaining free memory and the file cache memory. The remaining free memory refers to the memory in the operating system that is idle after the memory allocation is completed. The file cache memory refers to the memory occupied by the file cache, and when the memory is tight, the terminal can reclaim the memory.

[0083] It is easy to understand that when the terminal obtains that the first page of the target file currently written by the operating system is the first page of the target file, the terminal can determine that the page read and write order of the target file is sequential read and write. For example, when the terminal obtains that the first page T1 of the target file T currently written by the operating system is the first page of the target file, the terminal can determine that the page read and write order of the T file is sequential read and write. At this time, the terminal can obtain the available memory of the operating system.

[0084] According to some embodiments, when the terminal determines that the page read and write order of the target file is sequential read and write, the terminal may first obtain the remaining free memory of the operating system. When the terminal obtains the remaining free memory of the operating system, the terminal may determine whether the remaining free memory of the operating system is greater than or equal to the first memory threshold. When the terminal determines that the remaining free memory of the operating system is less than the first memory threshold, the terminal may obtain the available memory of the operating system.

[0085] It is easy to understand that when the terminal determines that the page read and write order of the target file T is sequential read and write, the terminal can first obtain the remaining free memory of the operating system, which can be 100M, for example. When the first memory threshold is 200M, the terminal can determine that the remaining free memory of the operating system 100M is less than the first memory threshold 200M, and the terminal can obtain the available memory of the operating system. The available memory includes the remaining free memory and the file cache memory.

[0086] S503: When the available memory is greater than or equal to the second memory threshold, memory recycling is performed on the available memory, and a memory recycling pressure value and an IO pressure value of the operating system are obtained.

[0087] According to some embodiments, when the terminal obtains available memory, the terminal can determine whether the available memory is greater than or equal to the second memory threshold. When the terminal determines that the available memory is greater than or equal to the second memory threshold, the terminal can reclaim the available memory and obtain the memory reclaim pressure value of the operating system and the IO pressure value of the operating system. The memory reclaim pressure value represents the pressure value when the operating system performs memory reclaim. Among them, the method for obtaining the IO pressure value of the operating system is as described above and will not be repeated here.

[0088] It is easy to understand that the second memory threshold is a memory threshold set by the terminal for available memory, and does not specifically refer to a fixed memory threshold. The terminal can set the second memory threshold based on the threshold setting instruction. The second memory threshold can also be set based on the number of pages of the target file, and different numbers of pages can correspond to the same second memory threshold, or different numbers of pages can correspond to different second memory thresholds. For example, when the number of pages of the target file is 50 pages, the second memory threshold can be 200M. When the number of pages of the target file is 100 pages, the second memory threshold can be 300M.

[0089] According to some embodiments, the second memory threshold may be, for example, 300M. When the terminal obtains that the available memory is 400M, and the terminal determines that the available memory 400M is greater than the second memory threshold 300M, the terminal may reclaim the available memory, and the terminal may obtain the memory pressure reclaim value of the operating system and the IO pressure value of the operating system.

[0090] S504, when the memory recycle pressure value is less than the recycle pressure threshold and the IO pressure value is less than the IO pressure threshold, pre-read multiple pages into the memory system resources of the operating system, and obtain the second page from the memory system resources when the write operation of the first page is completed; wherein the first page and the second page are two adjacent pages among the multiple pages.

[0091] According to some embodiments, when the terminal obtains the memory recovery pressure value and IO pressure value of the operating system, the terminal can determine whether the memory recovery pressure value is less than the recovery pressure threshold, and whether the IO pressure value is less than the IO pressure threshold. When the terminal determines that the memory recovery pressure value is less than the recovery pressure threshold, and the IO pressure value is less than the IO pressure threshold, the terminal can pre-read multiple pages into the memory system resources of the operating system, and obtain the second page from the memory system resources when the first page completes the write operation; wherein the first page and the second page are two adjacent pages among the multiple pages. Among them, the recovery pressure threshold and the IO pressure threshold can be set based on the user's threshold setting instruction, and can also be set by the operating system factory.

[0092] For easy understanding, the second memory threshold value may be, for example, 300M. When the terminal obtains that the available memory is 400M, and the terminal determines that the available memory 400M is greater than the second memory threshold value 300M, the terminal may recycle the available memory, and the terminal may obtain the memory pressure recovery value of the operating system and the IO pressure value of the operating system. When the terminal determines that the memory recovery pressure value is less than the recovery pressure threshold value, and the IO pressure value is less than the IO pressure threshold value, the terminal may pre-read multiple pages of the target file T file into the memory system resources of the operating system.

[0093] According to some embodiments, when the terminal determines whether the memory recovery pressure value is less than the recovery pressure threshold and whether the IO pressure value is less than the IO pressure threshold, the terminal may first determine whether the memory recovery pressure value is less than the recovery pressure threshold, and then determine whether the IO pressure value is less than the IO pressure threshold when the memory recovery pressure value is less than the recovery pressure threshold. Therefore, when the memory recovery pressure value is not less than the recovery pressure threshold, the IO pressure value may not be judged, which may reduce the steps of judging the system resource information and reduce the page pre-reading time.

[0094] It is easy to understand that when the terminal determines whether the memory recovery pressure value is less than the recovery pressure threshold and whether the IO pressure value is less than the IO pressure threshold, the terminal can first determine whether the IO pressure value is less than the IO pressure threshold, and then determine whether the memory recovery pressure value is less than the recovery pressure threshold when the IO pressure value is less than the IO pressure threshold. Therefore, when the IO pressure value is not less than the IO pressure threshold, the memory recovery pressure value does not need to be judged, which can reduce the judgment steps of system resource information and reduce page pre-reading time.

[0095] Optionally, when the terminal determines whether the memory recycle pressure value is less than the recycle pressure threshold and whether the IO pressure value is less than the IO pressure threshold, the terminal can directly determine whether the memory recycle pressure value is less than the recycle pressure threshold and whether the IO pressure value is less than the IO pressure threshold at the same time, which can improve the convenience of the operating system to perform page pre-reading.

[0096] According to some embodiments, see Figure 8 , which is a flowchart of a method for pre-reading a file page according to an embodiment of the present application. Figure 8 As shown, the method of the embodiment of the present application may also include the following steps S601-S603. S601, obtaining a first time point and a second time point when the operating system performs memory recycling, the first time point being the start time point of memory recycling, and the second time point being the time point obtained after a first time period after the start of memory recycling; S602, calculating the duration of memory recycling based on the first time point and the second time point; S603, determining the memory recycling pressure value of the operating system based on the duration of memory recycling.

[0097] According to some embodiments, when the terminal obtains the memory recycling pressure value, the terminal can obtain the first time point and the second time point when the operating system performs memory recycling when performing memory recycling. The first time point is the starting time point when the operating system in the terminal starts to recycle memory, and the second time point is the time point obtained after every first time period after the start of memory recycling. The first time period can be set by the terminal based on the user's time setting instruction, and can also be set when the terminal leaves the factory.

[0098] It is easy to understand that the first duration can be, for example, 3 seconds. When the operating system starts to recycle memory at 12:00:00, the first time point is 12:00:00. When the terminal is still reclaiming memory after one first duration, the second time point is 12:00:03. When the terminal is still reclaiming memory after two first durations, the second time point is 12:00:06.

[0099] According to some embodiments, when the terminal obtains the first time point and the second time point, the terminal can calculate the duration of memory recycling. The duration of memory recycling can be calculated once every first duration, or it can be calculated only once when the memory recycling ends. For example, when the second time point is 12:00:06 at the end of memory recycling, the terminal calculates that the duration of memory recycling is 6 seconds.

[0100] According to some embodiments, when the terminal calculates the duration of memory reclamation, the terminal may determine the memory reclamation pressure value of the operating system based on the duration of memory reclamation, wherein the longer the duration of memory reclamation, the greater the memory reclamation pressure value.

[0101] According to some embodiments, when the memory recycling of the operating system is completed, the terminal can reset the memory recycling duration to a preset value. The preset value can be, for example, 0. The resetting of the memory recycling duration by the operating system can be unaffected by the memory recycling duration calculated last time when the memory recycling duration is obtained, thereby reducing misjudgments in the pre-reading process and improving the pre-reading efficiency of the file page.

[0102] In one or more embodiments of the present application, when the page read and write order of the terminal is sequential read and write, the terminal can obtain the available memory of the operating system, and the available memory includes the remaining free memory and the file cache memory. When the available memory is greater than or equal to the second memory threshold, the available memory is reclaimed, which can provide sufficient memory system resources for file page pre-reading, and can improve the pre-reading efficiency of file pages. Secondly, when the memory recycle pressure value is less than the recycle pressure threshold, and the IO pressure value is less than the IO pressure threshold, the terminal can pre-read multiple pages into the memory system resources of the operating system, and can directly obtain the second page from the memory system resources when the first page completes the write operation, which can reduce the situation where the page pre-reading efficiency is low due to excessive memory recycle pressure value or excessive IO pressure value, and can increase the speed of page pre-reading, thereby improving the efficiency of file pages.

[0103] The following will be combined with the attached Fig. 9 , the file page pre-reading device provided in the embodiment of the present application is introduced in detail. It should be noted that the attached Fig. 9 The file page pre-reading device shown is used to execute the present application Figure 2-Figure 8 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 2-Figure 8 The embodiment shown.

[0104] See also Fig. 9 , which shows a schematic diagram of the structure of the file page pre-reading device of an embodiment of the present application. The file page pre-reading device 900 can be implemented as all or part of the user terminal through software, hardware or a combination of both. According to some embodiments, the file page pre-reading device 900 includes a sequence acquisition unit 901, an information acquisition unit 902 and a page pre-reading unit 903, which are specifically used to:

[0105] A sequence acquisition unit 901 is used to acquire a page read and write sequence of a target file in an operating system, where the target file includes multiple pages;

[0106] An information acquisition unit 902 is used to acquire system resource information of the operating system when the page read and write order is sequential read and write;

[0107] The page pre-reading unit 903 is used to pre-read multiple pages into the memory system resources of the operating system when the system resource information indicates that the system resources of the operating system meet the resource threshold, and obtain the second page from the memory system resources when the write operation of the first page is completed;

[0108] The first page and the second page are two adjacent pages among the multiple pages.

[0109] According to some embodiments, the information acquisition unit 902, when used to acquire the system resource information of the operating system, is specifically used to:

[0110] Get the remaining free memory and input / output IO pressure values ​​of the operating system;

[0111] When the system resource information indicates that the system resources of the operating system meet the resource threshold, multiple pages are pre-read into the memory system resources of the operating system, including:

[0112] When the remaining free memory is greater than or equal to the first memory threshold and the IO pressure value is less than the IO pressure threshold, the plurality of pages are pre-read into the memory system resources of the operating system.

[0113] According to some embodiments, the information acquisition unit 902, when used to acquire the system resource information of the operating system, is specifically used to:

[0114] Get the available memory of the operating system, which includes the remaining free memory and file cache memory;

[0115] When the available memory is greater than or equal to the second memory threshold, memory recycling is performed on the available memory, and a memory recycling pressure value and an IO pressure value of the operating system are obtained;

[0116] When the system resource information indicates that the system resources of the operating system meet the resource threshold, multiple pages are pre-read into the memory system resources of the operating system, including:

[0117] When the memory reclaim pressure value is less than the reclaim pressure threshold and the IO pressure value is less than the IO pressure threshold, a plurality of pages are pre-read into the memory system resource of the operating system.

[0118] According to some embodiments, the information acquisition unit 902 is used to obtain the memory recovery pressure value of the operating system, specifically to:

[0119] Obtain a first time point and a second time point when the operating system performs memory recycling, the first time point being the start time point of memory recycling, and the second time point being a time point obtained every first time period after the start of memory recycling;

[0120] Based on the first time point and the second time point, calculate the duration of memory recycling;

[0121] Based on the duration of memory reclamation, determine the memory reclamation pressure value of the operating system.

[0122] According to some embodiments, the file page pre-reading device 900 further includes a preset value resetting unit, which is used to reset the memory recycling duration to a preset value when the memory recycling of the operating system is completed.

[0123] According to some embodiments, the information acquisition unit 902, when used to acquire the IO pressure value of the operating system, is specifically used to:

[0124] Get the total IO amount of the operating system within the second time period;

[0125] Determine the IO load of the operating system based on the total IO volume and the second duration;

[0126] Based on the IO load, determine the IO pressure value of the operating system.

[0127] According to some embodiments, the sequence acquisition unit 901 is used to acquire the page read and write sequence of the target file in the operating system, specifically to:

[0128] When the first page of the target file currently being written by the operating system is the first page of the target file, determining that the page read and write order of the target file is sequential read and write; or

[0129] Obtain the first page of the target file currently written by the operating system, and obtain the third page last written by the operating system based on the first page;

[0130] When the first page and the third page are adjacent pages in the plurality of pages of the target file, it is determined that the page reading and writing order of the target file is sequential reading and writing.

[0131] In one or more embodiments of the present application, when the page read and write order of the target file in the operating system is sequential read and write, the file page pre-reading device can obtain the system resource information of the operating system, and when the system resource information indicates that the system resources of the operating system meet the resource threshold, multiple pages of the target file can be pre-read into the memory system resources of the operating system. Therefore, when the first page completes the write operation, the file page pre-reading device can directly obtain the second page adjacent to the first page from the memory system resources, and does not need to wait for the operating system of the file page pre-reading device to read the second page into the memory system resources of the operating system when the first page completes the write operation, which can reduce the waiting time for the page to be read into the memory system resources, reduce the page reading time, and improve the page reading and writing speed of the target file, thereby improving the reading and writing efficiency of the target file.

[0132] See also Fig.10 , is a schematic diagram of the structure of a terminal provided in an embodiment of the present application. Fig.10As shown, the terminal 1000 may include: at least one processor 1001 , at least one network interface 1004 , a user interface 1003 , a memory 1005 , and at least one communication bus 1002 .

[0133] The communication bus 1002 is used to realize the connection and communication between these components.

[0134] The user interface 1003 may include a display screen (Display) and a GPS. Optionally, the user interface 1003 may also include a standard wired interface and a wireless interface.

[0135] The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0136] Among them, the processor 1001 may include one or more processing cores. The processor 1001 uses various interfaces and lines to connect various parts in the entire terminal 1000, and executes various functions and processes data of the terminal 1000 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1005, and calling data stored in the memory 1005. Optionally, the processor 1001 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 1001 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 1001, and it can be implemented separately through a chip.

[0137] Among them, the memory 1005 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 1005 includes a non-transitory computer-readable storage medium. The memory 1005 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1005 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 1005 may also be optionally at least one storage device located away from the aforementioned processor 1001. As Fig.10 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application for pre-reading file pages.

[0138] exist Fig.10 In the terminal 1000 shown, the user interface 1003 is mainly used to provide an input interface for the user and obtain data input by the user; and the processor 1001 can be used to call the file page pre-reading application stored in the memory 1005, and specifically perform the following operations:

[0139] Get the page read and write order of the target file in the operating system, where the target file includes multiple pages;

[0140] When the page read and write order is sequential, obtain system resource information of the operating system;

[0141] When the system resource information indicates that the system resources of the operating system meet the resource threshold, pre-reading the plurality of pages into the memory system resources of the operating system, and acquiring the second page from the memory system resources when the write operation of the first page is completed;

[0142] The first page and the second page are two adjacent pages among the multiple pages.

[0143] According to some embodiments, when the processor 1001 is used to obtain the system resource information of the operating system, it is specifically used to perform the following steps:

[0144] Get the remaining free memory and input / output IO pressure values ​​of the operating system;

[0145] When the system resource information indicates that the system resources of the operating system meet the resource threshold, multiple pages are pre-read into the memory system resources of the operating system, including:

[0146] When the remaining free memory is greater than or equal to the first memory threshold and the IO pressure value is less than the IO pressure threshold, the plurality of pages are pre-read into the memory system resources of the operating system.

[0147] According to some embodiments, when the processor 1001 is used to obtain the system resource information of the operating system, it is specifically used to perform the following steps:

[0148] Get the available memory of the operating system, which includes the remaining free memory and file cache memory;

[0149] When the available memory is greater than or equal to the second memory threshold, memory recycling is performed on the available memory, and a memory recycling pressure value and an IO pressure value of the operating system are obtained;

[0150] When the system resource information indicates that the system resources of the operating system meet the resource threshold, multiple pages are pre-read into the memory system resources of the operating system, including:

[0151] When the memory reclaim pressure value is less than the reclaim pressure threshold and the IO pressure value is less than the IO pressure threshold, a plurality of pages are pre-read into the memory system resource of the operating system.

[0152] According to some embodiments, when the processor 1001 is used to obtain the memory reclamation pressure value of the operating system, it is specifically used to perform the following steps:

[0153] Obtain a first time point and a second time point when the operating system performs memory recycling, the first time point being the start time point of memory recycling, and the second time point being a time point obtained every first time period after the start of memory recycling;

[0154] Based on the first time point and the second time point, calculate the duration of memory recycling;

[0155] Based on the duration of memory reclamation, determine the memory reclamation pressure value of the operating system.

[0156] According to some embodiments, the processor 1001 is further specifically configured to perform the following steps:

[0157] When the operating system completes memory reclamation, the memory reclamation duration is reset to the preset value.

[0158] According to some embodiments, when the processor 1001 is used to obtain the IO pressure value of the operating system, it is specifically used to perform the following steps:

[0159] Get the total IO amount of the operating system within the second time period;

[0160] Determine the IO load of the operating system based on the total IO volume and the second duration;

[0161] Based on the IO load, determine the IO pressure value of the operating system.

[0162] According to some embodiments, when the processor 1001 is used to obtain the page read and write order of the target file in the operating system, it is specifically used to perform the following steps:

[0163] When the first page of the target file currently being written by the operating system is the first page of the target file, determining that the page read and write order of the target file is sequential read and write; or

[0164] Obtain the first page of the target file currently written by the operating system, and obtain the third page last written by the operating system based on the first page;

[0165] When the first page and the third page are adjacent pages in the plurality of pages of the target file, it is determined that the page reading and writing order of the target file is sequential reading and writing.

[0166] In one or more embodiments of the present application, when the page read and write order of the target file in the operating system is sequential read and write, the terminal can obtain the system resource information of the operating system, and when the system resource information indicates that the system resources of the operating system meet the resource threshold, multiple pages of the target file can be pre-read into the memory system resources of the operating system. Therefore, when the write operation of the first page is completed, the second page adjacent to the first page can be directly obtained from the memory system resources, and there is no need to wait for the terminal's operating system to read the second page into the memory system resources of the operating system when the write operation of the first page is completed. The waiting time for the page to be read into the memory system resources can be reduced, the page reading time can be reduced, and the page reading and writing speed of the target file can be improved, thereby improving the read and write efficiency of the target file.

[0167] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.

[0168] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps of any file page pre-reading method recorded in the above method embodiments.

[0169] Those skilled in the art can clearly understand that the technical solution of the present application can be implemented with the help of software and / or hardware. The "unit" and "module" in this specification refer to software and / or hardware that can independently complete or cooperate with other components to complete specific functions, where the hardware can be, for example, a field programmable gate array (FPGA), an integrated circuit (IC), etc.

[0170] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0171] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0172] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0173] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0174] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0175] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program codes.

[0176] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by entering a program to instruct related hardware, and the program may be stored in a computer-readable memory, which may include a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0177] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure here, those skilled in the art will easily think of other embodiments of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field not recorded in the present disclosure. The description and examples are only regarded as exemplary, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. A file page pre-reading method, characterized in that: The method comprises: Obtaining a page read and write order of a target file in an operating system, wherein the target file includes a plurality of pages; When the page read and write order is sequential read and write, obtaining system resource information of the operating system; When the system resource information indicates that the system resources of the operating system meet the resource threshold, pre-reading the multiple pages into the memory system resources of the operating system, and acquiring the second page from the memory system resources when the write operation of the first page is completed; Wherein, the first page and the second page are two adjacent pages among the multiple pages; Wherein, the obtaining of system resource information of the operating system includes: Obtaining the available memory of the operating system, wherein the available memory includes remaining free memory and file cache memory, wherein the remaining free memory refers to the memory in the operating system that is in an idle state after memory allocation is completed, and the file cache memory refers to the memory occupied by the file cache and can be reclaimed when the memory is tight; When the available memory is greater than or equal to a second memory threshold, memory recycling is performed on the available memory, and a memory recycling pressure value of the operating system and an IO pressure value of the operating system are obtained, wherein the second memory threshold is determined by the number of pages of the target file; When the system resource information indicates that the system resources of the operating system meet the resource threshold, pre-reading the multiple pages into the memory system resources of the operating system includes: When the memory reclaim pressure value is less than a reclaim pressure threshold, and the IO pressure value is less than an IO pressure threshold, the multiple pages are pre-read into the memory system resource of the operating system.

2. The method according to claim 1, characterized in that The obtaining of system resource information of the operating system includes: Obtaining the remaining free memory and input / output IO pressure value of the operating system; When the system resource information indicates that the system resources of the operating system meet the resource threshold, pre-reading the multiple pages into the memory system resources of the operating system includes: When the remaining free memory is greater than or equal to a first memory threshold and the IO pressure value is less than an IO pressure threshold, the multiple pages are pre-read into the memory system resource of the operating system.

3. The method according to claim 2, characterized in that The obtaining of the memory recovery pressure value of the operating system includes: Acquire a first time point and a second time point when the operating system performs memory recycling, wherein the first time point is a start time point of memory recycling, and the second time point is a time point acquired every first time period after the start of memory recycling; Calculate the duration of the memory recycling based on the first time point and the second time point; Based on the duration of the memory reclamation, the memory reclamation pressure value of the operating system is determined.

4. The method according to claim 3, characterized in that The method further comprises: When the memory recycling of the operating system is completed, the memory recycling duration is reset to a preset value.

5. The method according to claim 1 or 2, characterized in that: Obtaining the IO pressure value of the operating system, including: Obtaining the total IO amount of the operating system within the second time period; Determining the IO load of the operating system based on the total IO amount and the second duration; Based on the IO load, the IO pressure value of the operating system is determined.

6. The method according to claim 1, characterized in that The step of obtaining the page read and write order of the target file in the operating system includes: When the first page of the target file currently being written by the operating system is the first page of the target file, determining that the page read and write order of the target file is sequential read and write; or Acquire a first page of a target file currently written by the operating system, and acquire a third page last written by the operating system based on the first page; When the first page and the third page are adjacent pages among the multiple pages of the target file, it is determined that the page reading and writing order of the target file is sequential reading and writing.

7. A file page pre-reading device, characterized in that: The device comprises: A sequence acquisition unit, used for acquiring a page read and write sequence of a target file in an operating system, wherein the target file includes a plurality of pages; An information acquisition unit, used for acquiring system resource information of the operating system when the page read and write order is sequential read and write; a page pre-reading unit, configured to pre-read the plurality of pages into a memory system resource of the operating system when the system resource information indicates that the system resource of the operating system meets a resource threshold, and to obtain a second page from the memory system resource when a write operation on the first page is completed; Wherein, the first page and the second page are two adjacent pages among the multiple pages; The information acquisition unit is further used to acquire the available memory of the operating system, wherein the available memory includes remaining free memory and file cache memory, wherein the remaining free memory refers to the memory in the operating system that is in an idle state after the memory allocation is completed, and the file cache memory refers to the memory occupied by the file cache and the memory that can be reclaimed when the memory is tight; The information acquisition unit is further configured to perform memory reclamation on the available memory when the available memory is greater than or equal to a second memory threshold, and acquire a memory reclamation pressure value of the operating system and an IO pressure value of the operating system, wherein the second memory threshold is determined by the number of pages of the target file; The page pre-reading unit is further configured to pre-read the multiple pages into the memory system resources of the operating system when the memory reclaim pressure value is less than a reclaim pressure threshold and the IO pressure value is less than an IO pressure threshold.

8. A terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When a processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.