File page processing method and device and electronic equipment
By determining whether the file page belongs to a preset application and determining whether to retain or recycle based on its mapping times, the IO lag caused by the LRU algorithm when recycling hot file pages is solved, and the smoothness of the application is improved.
Patent Information
- Application Number
- CN202411926659.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-15
AI Technical Summary
The LRU algorithm used in mobile terminals can easily cause disk IO lag when recycling hot file pages, affecting the smoothness of the application.
By obtaining the application identification of the file page and the identification of the preset application, it is determined whether the file page belongs to the preset application, and whether to retain or recycle the file page based on its mapping times. Specifically, the mapping is retained in memory when the number of mappings is greater than the threshold, and the moving or recycling process is performed based on the most recent minimum usage strategy when it is less than or equal to the threshold.
Reduces the recycling of hot file pages, reduces the probability of IO lag, and improves the smoothness of the application.
Smart Images

Figure CN119829529A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a file page processing method and device, and electronic equipment. Background Art
[0002] The mobile terminal uses the Least Recently Used (LRU) algorithm to recycle file pages to alleviate the problem of system memory shortage. Specifically, the LRU algorithm is implemented based on the active list and the inactive list. The system adds the page that is accessed for the first time from the head of the active list, moves the page in the two lists according to the activity of the page, and adjusts the position of the page in the list so that the most recently used page is placed in the active list, and the less recently used page is placed in the inactive list, and the least recently used pages are placed one by one at the end of the inactive list. The process of LRU recycling is to select the list from the end of the inactive list for recycling, and select pages from the end of the active list to move to the inactive list.
[0003] When the LRU algorithm reclaims memory, when hot file pages are accessed again after being recycled, it is easy to cause disk input and output IO jams, affecting the smoothness of the application. Summary of the invention
[0004] The embodiments of the present application are intended to provide a file page processing method and device, and electronic device, which can reduce the recycling of hot file pages, reduce the probability of IO jams, and improve the fluency of application programs.
[0005] The technical solution of this application is implemented as follows:
[0006] In a first aspect, a file page processing method is provided, comprising:
[0007] Obtaining an application identifier of an application to which the first file page to be processed belongs and an application identifier of a preset application;
[0008] The application identifier of the first file page is consistent with the application identifier of the preset application, and it is determined that the first file page belongs to the preset application;
[0009] Get the mapping count of the first file page being mapped by the process;
[0010] When the mapping times of the first file page is greater than the mapping times threshold, retaining the first file page in the memory;
[0011] When the mapping times of the first file page is less than or equal to the mapping times threshold, the first file page is moved or recycled based on the least recently used policy.
[0012] In a second aspect, a file page processing device is provided, comprising:
[0013] An acquisition unit, used to acquire an application identifier of an application to which the first file page to be processed belongs, and an application identifier of a preset application;
[0014] a determination unit, for determining that the application identifier of the first file page is consistent with the application identifier of the preset application, and the first file page belongs to the preset application;
[0015] The acquisition unit is further used to acquire the mapping number of the first file page mapped by the process;
[0016] a processing unit, configured to retain the first file page in the memory if the mapping number of the first file page is greater than a mapping number threshold;
[0017] The processing unit is further configured to move or recycle the first file page based on a least recently used strategy when the mapping times of the first file page is less than or equal to a mapping times threshold.
[0018] According to a third aspect, an electronic device is provided, comprising: a processor and a memory configured to store a computer program that can be run on the processor,
[0019] Wherein, when the processor is configured to run a computer program, the steps of the aforementioned method are executed.
[0020] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program implements the steps of the aforementioned method when executed by a processor.
[0021] In a fifth aspect, a computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the aforementioned method are implemented.
[0022] In an embodiment of the present application, a file page processing method and device, and an electronic device are provided, the method comprising: obtaining an application identifier of an application to which a first file page to be processed belongs, and an application identifier of a preset application; the application identifier of the first file page is consistent with the application identifier of the preset application, and determining that the first file page belongs to the preset application; obtaining the number of times the first file page is mapped by a process; when the number of times the first file page is mapped is greater than a mapping number threshold, retaining the first file page in memory; when the number of times the first file page is mapped is less than or equal to a mapping number threshold, moving or recycling the first file page based on a least recently used strategy. In this way, the recycling of hot file pages is reduced, the probability of IO jams is reduced, and the fluency of the application is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1This is a schematic diagram of a first process flow of a file page processing method in an embodiment of the present application;
[0024] Figure 2 This is a second flow chart of the file page processing method in the embodiment of the present application;
[0025] Figure 3 This is a second flow chart of the file page processing method in the embodiment of the present application;
[0026] Figure 4 This is a schematic diagram of the structure of the document page processing device in the embodiment of the present application;
[0027] Figure 5 It is a schematic diagram of the composition structure of the electronic device in the embodiment of the present application. DETAILED DESCRIPTION
[0028] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.
[0029] Figure 1 Schematic diagram of the first process of the file page processing method in the embodiment of the present application. Figure 1 As shown, the method may specifically include:
[0030] Step 101: Obtaining an application identifier of an application to which a first file page to be processed belongs and an application identifier of a preset application;
[0031] The application identifier is used to uniquely identify an application or user. For example, the application identifier includes but is not limited to: a user identifier (UID). The UID is a unique identifier assigned by the application or platform to each user, and it is usually composed of a string of letters, numbers or symbols.
[0032] In some embodiments, obtaining an application identifier of an application to which a first file page to be processed belongs includes: based on the identifier of the first file page, obtaining an identifier of a memory control group (memory control group, memcg) to which the first file page belongs, each memory control group including an application identifier and a file page of an application; based on the identifier of the memory control group to which the first file page belongs, obtaining an application identifier recorded in the memory control group to which the first file page belongs as the application identifier of the application to which the first file page belongs.
[0033] In the embodiment of the present application, memcg is created for each application in advance. By grouping processes and assigning memory usage limits to them, the system administrator can effectively control and manage the memory consumption of different process groups, preventing a process or process group from over-consuming system memory resources, thereby affecting the stability and performance of the system. In other words, memcg is mainly used to limit, isolate and monitor the memory usage of different process groups.
[0034] Exemplarily, the identifier of the first file page can be a pointer to the first file page, the identifier of memcg can be a pointer to memcg, and the pointer to the memcg to which the first file page belongs can be returned based on the pointer to the first file page, and the UID of the memcg record can be further returned based on the pointer to the memcg.
[0035] In some embodiments, the preset application includes a foreground application, and accordingly, the method further includes: monitoring the foreground application and obtaining an application identifier of the foreground application.
[0036] In some embodiments, the preset applications include associated applications of the foreground application and / or the most frequently used applications. Accordingly, the method further includes: updating the associated applications of the foreground application and obtaining application identifiers of the associated applications; and / or updating the most frequently used applications and obtaining application identifiers of the most frequently used applications.
[0037] Step 102: the application identifier of the first file page is consistent with the application identifier of the preset application, and it is determined that the first file page belongs to the preset application;
[0038] In some embodiments, when the preset application includes multiple applications, if the application identifier of the first file page is consistent with any application identifier in the preset application, it is determined that the first file page belongs to the preset application. When the preset application includes one application, if the application identifier of the first file page is consistent with the application identifier of the preset application, it is determined that the first file page belongs to the preset application.
[0039] Step 103: Obtain the number of times the first file page is mapped by the process;
[0040] The number of times the first file page is mapped by the process (mapcount), which reflects how frequently the file page is mapped by the process. If the mapcount of a file page reaches or exceeds the preset threshold, this usually means that the file page is being mapped frequently, so more caution is required when recycling it; if the mapcount of a file page is 0, it means that the file page is not mapped by any process, so it can be safely recycled. If the mapcount of the file page is not taken into account in the relevant LRU recycling strategy, it is easy to cause the file page with a high mapcount to be read from the disk again after being recycled, causing IO jams.
[0041] In the embodiment of the present application, a file page whose mapping times is greater than a mapping times threshold is called a hot file page.
[0042] When the mapping times of the first file page is greater than the mapping times threshold, the first file is retained in the memory, and the first file page is not moved or recycled.
[0043] In some embodiments, the mapping times threshold is a preset value. In some embodiments, the mapping times threshold is adaptively set based on system operation information, and the system operation information includes but is not limited to at least one of the following: available memory size, size of the mapped file page of the preset application, and number of mapped file pages of the preset application.
[0044] In some embodiments, the method further includes: determining the available memory size; and determining a mapping times threshold based on the available memory size, wherein the mapping times threshold is negatively correlated with the available memory size.
[0045] The available memory size is used to characterize the memory demand. The larger the available memory, the lower the memory demand. The mapping times threshold can be set to a smaller value, so that more files are not recycled. The smaller the available memory, the higher the memory demand. The mapping times threshold can be set to a larger value, so that one or more of the hottest file pages are not recycled.
[0046] In some embodiments, the mapping times threshold is determined based on the available memory size and the first mapping relationship. For example, the first mapping relationship may be a functional relationship, the available memory size is used as an input variable of the functional relationship, and the mapping times threshold is used as an output variable of the functional relationship. For another example, the first mapping relationship may be a fixed mapping relationship, the fixed mapping relationship includes a mapping relationship between a memory range and a mapping times threshold, and the mapping times threshold is determined according to the memory range of the available memory size.
[0047] In some embodiments, the method further includes: determining the size of the mapped file page of the preset application; determining a mapping times threshold based on the size of the mapped file page of the preset application, wherein the mapping times threshold is positively correlated with the size of the mapped file page.
[0048] The mapped file page is the file page mapped by the process. The size of the mapped file page can be understood as the size of all file pages mapped by the process for the preset application. The larger the mapped file page, the more file pages are mapped by the process for the preset mapping. The mapping count threshold can be set to a larger value, so that one or several of the hottest file pages are not recycled, reducing memory pressure and avoiding retaining many file pages in memory. The smaller the mapped file page, the fewer file pages are mapped by the process for the preset mapping. The mapping count threshold can be set to a larger value, so that more file pages are not recycled.
[0049] In some embodiments, the mapping times threshold is determined based on the size of the mapped file page of the preset application and the second mapping relationship. For example, the second mapping relationship may be a functional relationship, the size of the mapped file page of the preset application is used as the input variable of the functional relationship, and the mapping times threshold is used as the output variable of the functional relationship. For another example, the second mapping relationship may be a fixed mapping relationship, the fixed mapping relationship includes a mapping relationship between the size range of the mapped file page and the mapping times threshold, and the mapping times threshold is determined according to the size range of the mapped file page of the preset application.
[0050] In some embodiments, when the available memory size is greater than or equal to a first threshold, the steps of the file page processing method provided in the embodiments of the present application are executed; when the available memory size is less than the first threshold, the first file page is moved or recycled based on the least recently used strategy.
[0051] The available memory size being greater than or equal to the first threshold value indicates that the available memory is sufficient, that is, the memory demand is low. The steps of the file page processing method provided in the embodiment of the present application are executed to reduce the recycling of hot file pages of preset applications, ensure the fluency of preset applications, and improve user experience.
[0052] In some embodiments, when the available memory size is less than a first threshold, the steps of the file page processing method provided in the embodiments of the present application are executed; at this time, a larger mapping number threshold can be set according to the available memory to prioritize ensuring that one or more file pages of the hottest spots of a preset application are not recycled, thereby reducing memory usage and optimizing system performance.
[0053] In some embodiments, the preset application includes at least one of the following: a foreground application, an associated application of the foreground application, and a most frequently used application.
[0054] The foreground application is the application that the user is currently interacting with. It is located in the foreground interface and occupies system resources to provide real-time response. The technical solution provided in the embodiment of the present application is adopted to reduce the recycling of the hot file pages of the foreground application, reduce the IO jam probability of the foreground application, that is, reduce the number of frame drops, improve the fluency of the foreground application, and thus improve the user experience.
[0055] The associated applications of the foreground application include the foreground and backstage associations, associated office software, third-party service integration and other associated applications. These associated applications together constitute an important part of the foreground application ecosystem, providing a wealth of work tools and functional support for front-end employees. By adopting the technical solution provided in the embodiment of the present application, by reducing the recycling of the hot file pages of the associated applications of the foreground application, the IO jam probability of such applications is reduced, and the response speed of such applications is increased, thereby improving the user experience.
[0056] The most frequently used applications determine one or more applications that are most frequently used by a user based on the application usage duration and / or usage frequency. The technical solution provided in the embodiment of the present application is adopted to reduce the recycling of the most frequently used application hotspot file pages, reduce the IO jam probability of such applications, and improve the response speed of such applications, thereby improving the user experience.
[0057] Step 104: When the mapping times of the first file page is greater than the mapping times threshold, retain the first file page in the memory;
[0058] Step 105: When the mapping times of the first file page is less than or equal to the mapping times threshold, the first file page is moved or recycled based on the least recently used policy.
[0059] In some embodiments, the method also includes: determining the first file page to be processed from the inactive linked list; moving the first file page from the inactive linked list to the active linked list when the mapping number of the first file page is greater than the mapping number threshold; and reclaiming the first file page based on the least recently used strategy when the mapping number of the first file page is less than or equal to the mapping number threshold.
[0060] In some embodiments, when the traversal of the inactive linked list is completed, the first file page to be processed is determined from the active linked list; the method also includes: when the mapping number of the first file page is less than or equal to the mapping number threshold, the first file page is moved based on the least recently used strategy.
[0061] That is to say, the file page processing method provided by the embodiment of the present application is to first determine whether the file page in the inactive linked list belongs to the hot file page of the preset application, and then perform recovery judgment and processing on the file page that does not belong based on the least recently used policy, and retain the file page that belongs in the memory or move it to the active linked list; then determine whether the file page in the active linked list belongs to the hot file page of the preset application, and then perform movement judgment and processing on the file page that does not belong based on the least recently used policy, and retain the file page that belongs in the memory.
[0062] In some embodiments, the method further includes: if the mapping times of the first file page is greater than the first mapping times threshold and less than the second mapping times threshold, retaining the first file page in the inactive linked list; if the mapping times of the first file page is greater than or equal to the second mapping times threshold, moving the first file page from the inactive linked list to the active linked list; the first mapping times threshold is less than the second mapping times threshold. By setting different mapping times thresholds to control the movement of file pages from the inactive linked list to the active linked list, different memory requirements can be better met and memory allocation efficiency can be improved.
[0063] In some embodiments, the method further includes: if the mapping times of the first file page is greater than or equal to the third mapping times threshold, retaining the first file page in the active linked list; if the mapping times of the first file page is less than the third mapping times threshold and greater than the fourth mapping times threshold, moving the first file page from the active linked list to the inactive linked list; the third mapping times threshold is greater than the fourth mapping times threshold. By setting different mapping times thresholds to control the movement of file pages from the active linked list to the inactive linked list, different memory requirements can be better met and memory allocation efficiency can be improved.
[0064] In some embodiments, the least recently used strategy includes: when the first file page is located in the inactive linked list, based on the access frequency and memory requirements of the first file page, the first file page is recycled, or the first file page is moved to the active linked list; when the first file page is located in the active linked list, if the first file page has not been accessed in the recent period of time, the first file page is moved to the inactive linked list; if the first file page has been accessed in the recent period of time, the first file page is retained in the active linked list.
[0065] In some embodiments, the method further includes: when the first file page is a movable file page, executing the steps of the file page processing method provided in the embodiment of the present application; when the first file page is a movable file page, skipping the steps of the file page processing method provided in the embodiment of the present application.
[0066] The above technical solution is adopted to reduce the recycling of hot file pages, reduce the probability of IO jams, and improve the fluency of applications.
[0067] In order to better reflect the purpose of the present application, based on the above embodiments of the present application, a method for processing file pages of an inactive linked list is further illustrated by way of example. Figure 2 As shown, the method specifically includes:
[0068] Step 201: Reclaim file pages starting from the inactive linked list;
[0069] Step 202: Obtain the file page to be processed from the inactive linked list and construct a temporary linked list;
[0070] Step 203: Is the temporary linked list traversed? If not, execute step 204;
[0071] Step 204: whether the first file page to be processed is not movable; if not, execute step 205; if yes, execute step 210;
[0072] Step 205: Is the available memory less than the first threshold? If not, execute step 206; if yes, execute step 210;
[0073] Step 206: Is it a file page of the foreground application? If yes, execute step 207; if not, execute step 210;
[0074] Step 207: Determine a mapping count threshold according to the size of the mapped file page of the memcg to which the first file page belongs;
[0075] Step 208: Whether the mapping times of the first file page is greater than the mapping times threshold; if yes, execute step 209; if no, execute step 210;
[0076] Step 209: Move the first file page to the active linked list;
[0077] Step 210: Execute the LRU strategy.
[0078] The file page processing method of the active linked list is further illustrated by examples, such as Figure 3 As shown, the method specifically includes:
[0079] Step 301: Move the file page from the active list to the inactive list;
[0080] Step 302: Obtain the file page to be processed from the active linked list and construct a temporary linked list;
[0081] Step 303: Is the temporary linked list traversed? If not, execute step 304;
[0082] Step 304: Whether the first file page to be processed is not movable; if not, execute step 305; if yes, execute step 310;
[0083] Step 305: Is the available memory less than the first threshold? If not, execute step 306; if yes, execute step 310;
[0084] Step 306: Is it a file page of the foreground application? If yes, execute step 307; if not, execute step 310;
[0085] Step 307: Determine a mapping count threshold according to the size of the mapped file page of the memcg to which the first file page belongs;
[0086] Step 308: Whether the mapping times of the first file page is greater than the mapping times threshold; if yes, execute step 309; if no, execute step 310;
[0087] Step 309: Keep the first file page in the active linked list;
[0088] Step 310: Execute the LRU strategy.
[0089] By adopting the above technical solution, the recycling strategy is optimized by judging whether the recovered or moved file page belongs to the one mapped by the foreground application and whether it is a hot file page, so that the hot file page of the application the day before yesterday is retained in the memory, preventing the file page from being read from the disk again after being recycled, causing IO jamming.
[0090] To implement the method of the embodiment of the present application, based on the same inventive concept, the embodiment of the present application also provides a file page processing device, such as Figure 4 As shown, the file page processing device 40 includes:
[0091] The acquisition unit 401 is used to acquire the application identifier of the application to which the first file page to be processed belongs and the application identifier of the preset application;
[0092] A determination unit 402, for determining that the application identifier of the first file page is consistent with the application identifier of the preset application, and the first file page belongs to the preset application;
[0093] The acquisition unit 401 is further used to acquire the number of times the first file page is mapped by the process;
[0094] A processing unit 403 is configured to retain the first file page in the memory when the mapping number of the first file page is greater than the mapping number threshold;
[0095] The processing unit 403 is further configured to move or recycle the first file page based on a least recently used policy when the mapping times of the first file page is less than or equal to a mapping times threshold.
[0096] In some embodiments, the determination unit 402 is further configured to determine the available memory size; based on the available memory size, determine a mapping times threshold, and the mapping times threshold is negatively correlated with the available memory size.
[0097] In some embodiments, the determination unit 402 is further used to determine the size of the mapped file page of the preset application; based on the size of the mapped file page of the preset application, determine the mapping times threshold, and the mapping times threshold is positively correlated with the size of the mapped file page.
[0098] In some embodiments, the preset application includes at least one of the following: a foreground application, an associated application of the foreground application, and a most frequently used application.
[0099] In some embodiments, the acquisition unit 401 is used to determine the first file page to be processed from the inactive linked list;
[0100] Processing unit 403 is used to move the first file page from the inactive linked list to the active linked list when the mapping number of the first file page is greater than the mapping number threshold; and to recycle the first file page based on the least recently used strategy when the mapping number of the first file page is less than or equal to the mapping number threshold.
[0101] In some embodiments, the acquisition unit 401 is used to determine the first file page to be processed from the active linked list when the traversal of the inactive linked list is completed;
[0102] The processing unit 403 is configured to move the first file page based on a least recently used strategy when the mapping times of the first file page is less than or equal to a mapping times threshold.
[0103] In some embodiments, the least recently used strategy includes: when the first file page is located in the inactive linked list, based on the access frequency and memory requirements of the first file page, the first file page is recycled, or the first file page is moved to the active linked list; when the first file page is located in the active linked list, if the first file page has not been accessed in the recent period of time, the first file page is moved to the inactive linked list; if the first file page has been accessed in the recent period of time, the first file page is retained in the active linked list.
[0104] In some embodiments, the acquisition unit 401 is used to obtain the identifier of the memory control group to which the first file page belongs based on the identifier of the first file page, each memory control group includes an application identifier and a file page of an application; based on the identifier of the memory control group to which the first file page belongs, obtain the application identifier of the memory control group record as the application identifier of the application to which the first file page belongs.
[0105] In practical applications, the above device can be an electronic device or a chip applied to an electronic device. In the present application, the device can realize the functions of multiple units by software, hardware, or a combination of software and hardware, so that the device can execute the file page processing method provided in any of the above embodiments. The technical effects of each technical solution of the device can refer to the technical effects of the corresponding technical solution in the file page processing method, and the present application will not elaborate on this one by one.
[0106] Based on the hardware implementation of each unit in the above-mentioned file page processing device, the embodiment of the present application also provides an electronic device, such as Figure 5 As shown, the electronic device 50 includes: a processor 501 and a memory 502 configured to store a computer program that can be run on the processor;
[0107] The processor 501 is configured to execute the method steps in the aforementioned embodiment when running a computer program.
[0108] Of course, in practical applications, Figure 5 As shown, the various components in the electronic device 50 are coupled together through a bus system 503. It can be understood that the bus system 503 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 503 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are marked as bus system 503 in the figure.
[0109] In practical applications, the processor may be at least one of an application-specific integrated circuit (ASIC), a digital signal processing device (DSPD), a programmable logic device (PLD), a field-programmable gate array (FPGA), a controller, a microcontroller, and a microprocessor. It is understandable that for different devices, the electronic device used to implement the functions of the processor may also be other, and the embodiments of the present application do not specifically limit this.
[0110] The above-mentioned memory can be a volatile memory (volatile memory), such as a random access memory (RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (ROM), a flash memory, a hard disk (HDD) or a solid-state drive (SSD); or a combination of the above-mentioned types of memory, and provide instructions and data to the processor.
[0111] The electronic devices described in this application may include, for example, mobile phones, tablet computers, laptop computers, PDAs, portable media players (PMPs), navigation devices, wearable devices, headphones, cameras, etc.
[0112] In an exemplary embodiment, the embodiment of the present application further provides a chip, including a processor, and the processor can call and run a computer program from a memory to implement the method in the embodiment of the present application.
[0113] Optionally, the chip may further include a memory. The processor may call and run a computer program from the memory to implement the method in the embodiment of the present application. The memory may be a separate device independent of the processor or may be integrated in the processor.
[0114] Optionally, the chip may further include an input interface, wherein the processor may control the input interface to communicate with other devices or chips, and specifically, may obtain information or data sent by other devices or chips.
[0115] Optionally, the chip may further include an output interface, wherein the processor may control the output interface to communicate with other devices or chips, and specifically, may output information or data to other devices or chips.
[0116] Optionally, the chip can be applied to the electronic device in the embodiments of the present application, and the chip can implement the corresponding processes implemented by the electronic device in each method of the embodiments of the present application, which will not be described in detail here for the sake of brevity.
[0117] In an exemplary embodiment, the present application also provides a computer-readable storage medium, such as a memory including a computer program, and the computer program can be executed by a processor to complete the steps of the aforementioned method.
[0118] The embodiments of the present application also provide a computer program product, including a computer program, which, when executed by a processor, implements the steps of any one of the methods in the embodiments of the present application.
[0119] Optionally, the computer program product can be applied to the electronic device in the embodiments of the present application, and the computer program instructions enable the computer to execute the corresponding processes implemented by the electronic device in the various methods of the embodiments of the present application. For the sake of brevity, they are not repeated here.
[0120] The embodiment of the present application also provides a computer program.
[0121] Optionally, the computer program can be applied to the electronic device in the embodiments of the present application. When the computer program runs on a computer, the computer executes the corresponding processes implemented by the electronic device in the various methods of the embodiments of the present application. For the sake of brevity, they are not described here.
[0122] It should be understood that in the embodiments of the present application, related data such as user information is involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0123] It should be understood that the terms used in this application are only for the purpose of describing specific embodiments, and are not intended to limit the application. The singular forms of "a", "" and "the" used in this application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more associated listed items. The expressions "have", "may have", "include" and "include", or "may include" and "may include" in this application can be used to indicate the presence of corresponding features (e.g., elements such as numerical values, functions, operations or components), but the presence of additional features is not excluded.
[0124] It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other and are not necessarily used to describe a specific order or sequence. For example, without departing from the scope of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information.
[0125] The technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.
[0126] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and equipment can be implemented in other ways. The embodiments described above are only schematic. For example, the division of units 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 can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0127] The units described above as separate components may or may not be physically separated, and the components displayed 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 present embodiment.
[0128] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0129] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A file page processing method, characterized in that: The method comprises: Obtaining an application identifier of an application to which the first file page to be processed belongs and an application identifier of a preset application; The application identifier of the first file page is consistent with the application identifier of the preset application, and it is determined that the first file page belongs to the preset application; Obtaining the number of times the first file page is mapped by the process; When the mapping times of the first file page is greater than the mapping times threshold, retaining the first file page in the memory; When the mapping times of the first file page is less than or equal to the mapping times threshold, the first file page is moved or recycled based on a least recently used policy.
2. The method according to claim 1, characterized in that The method further comprises: Determine the amount of available memory; The mapping times threshold is determined based on the available memory size, and the mapping times threshold is negatively correlated with the available memory size.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: Determine the size of the mapped file page of the preset application; The mapping times threshold is determined based on the size of the mapped file page of the preset application, and the mapping times threshold is positively correlated with the size of the mapped file page.
4. The method according to claim 1, characterized in that: The preset application includes at least one of the following: a foreground application, an associated application of the foreground application, and a most frequently used application.
5. The method according to claim 1, characterized in that The method further comprises: Determine the first file page to be processed from the inactive linked list; When the mapping times of the first file page is greater than the mapping times threshold, moving the first file page from the inactive linked list to the active linked list; When the mapping times of the first file page is less than or equal to the mapping times threshold, the first file page is recycled based on a least recently used policy.
6. The method according to claim 5, characterized in that The method further comprises: When the traversal of the inactive linked list is completed, determining the first file page to be processed from the active linked list; The method further comprises: When the mapping times of the first file page is less than or equal to the mapping times threshold, the first file page is moved based on a least recently used strategy.
7. The method according to claim 1, 4 or 5, characterized in that: The least recently used strategy includes: When the first file page is located in the inactive linked list, based on the access frequency and memory requirement of the first file page, the first file page is recycled, or the first file page is moved to the active linked list; When the first file page is in the active linked list, if the first file page has not been accessed in the recent period of time, the first file page is moved to the inactive linked list; if the first file page has been accessed in the recent period of time, the first file page is retained in the active linked list.
8. The method according to claim 1, characterized in that The step of obtaining the application identifier of the application to which the first file page to be processed belongs includes: Based on the identifier of the first file page, obtaining the identifier of the memory control group to which the first file page belongs, each memory control group including an application identifier and a file page of an application; Based on the identifier of the memory control group to which the first file page belongs, an application identifier recorded in the memory control group is obtained as the application identifier of the application to which the first file page belongs.
9. A document page processing device, characterized in that: The device comprises: An acquisition unit, used to acquire an application identifier of an application to which the first file page to be processed belongs, and an application identifier of a preset application; a determination unit, configured to determine that the application identifier of the first file page is consistent with the application identifier of the preset application, and that the first file page belongs to the preset application; The acquisition unit is further used to acquire the number of times the first file page is mapped by the process; a processing unit, configured to retain the first file page in a memory when the mapping number of the first file page is greater than a mapping number threshold; The processing unit is further configured to move or recycle the first file page based on a least recently used strategy when the mapping times of the first file page is less than or equal to the mapping times threshold.
10. An electronic device, characterized in that: The electronic device comprises: a processor and a memory configured to store a computer program capable of running on the processor, Wherein, the processor is configured to execute the steps of the method according to any one of claims 1 to 7 when running the computer program.