Page replacement method and device, equipment, storage medium and product

By dynamically adjusting the page step size and access flags in the cloud computing system, and a page replacement method based on access frequency and time, the problem of poor performance and stability of LRU and FIFO algorithms under high access volumes is solved, achieving more efficient memory management and system performance improvement.

CN120256334APending Publication Date: 2025-07-04CHINA MOBILE INFORMATION TECHNOLOGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510315560.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The existing LRU algorithms and FIFO algorithms lead to poor system performance and stability in high access environments. The LRU algorithm is expensive to maintain and is susceptible to cache pollution. The FIFO algorithm cannot adapt to the dynamic access mode, resulting in frequent page substitution.

Method used

By responding to page task requests, the memory space is divided into multiple pages. The page-based access parameters include access frequency and recent access time dynamically adjust the page step size, determine the page to be allocated, and perform page replacement according to the access status. Use preset ring pointers to traverse the page, dynamically adjust the page step size and access flags to avoid cache pollution and frequent replacement.

Benefits of technology

It improves the overall performance and stability of the cloud computing system in a high-visit environment. By intelligently predicting and retaining hot pages, it avoids unnecessary page substitution, and improves the memory resource utilization and overall system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256334A_ABST
    Figure CN120256334A_ABST
Patent Text Reader

Abstract

The invention discloses a page replacement method and device, equipment, a storage medium and a product, and relates to the technical field of cloud computing, the page replacement method comprises the following steps: in response to a page task request, dividing a memory space into a plurality of pages; determining a to-be-allocated page based on the access parameter of each page, the access parameter including a page step length, and the page step length being obtained by performing dynamic adjustment based on the access frequency and the latest access time of the page; and performing page replacement for the current task based on the access state of the to-be-allocated page. The technical problem that the overall performance and stability of the cloud computing system are poor in a high-access-volume environment is solved, and the overall performance and stability of the cloud computing system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing technology, and particularly to a page replacement method, apparatus, device, storage medium, and computer program product. Background Art

[0002] The LRU (Least Recently Used) algorithm and the FIFO (First In First Out) algorithm are currently commonly used memory page replacement algorithms. However, in scenarios with a large amount of access, both have obvious defects. Although the LRU algorithm can consider the page access history, in a high-concurrency environment, its maintenance cost is high and it is easily affected by cache pollution. The FIFO algorithm is too simple to adapt to dynamic access patterns and may lead to frequent page replacements. These problems are particularly prominent in a high-access environment and seriously affect the system performance.

[0003] The above content is only used to assist in understanding the technical solution of this application, and does not represent an admission that the above content is prior art. Summary of the Invention

[0004] The main purpose of this application is to provide an invention name, aiming to solve the technical problem that in the related art, page replacement by the LRU algorithm and the FIFO algorithm seriously affects the system performance.

[0005] To achieve the above object, this application proposes a page replacement method, which includes:

[0006] In response to a page task request, divide the memory space into multiple pages;

[0007] Based on the access parameters of each page, determine the page to be allocated, where the access parameters include a page step, and the page step is dynamically adjusted based on the access frequency and the most recent access time of the page;

[0008] Based on the access status of the page to be allocated, perform page replacement for the current task.

[0009] In one embodiment, the access parameters include an access flag, and the step of determining the page to be allocated based on the access parameters of each page includes:

[0010] Traverse each page through a preset circular pointer and detect the access flag of the current page;

[0011] If the access flag is empty, determine the current page as the page to be allocated;

[0012] If the access flag is not empty, dynamically adjust the page step based on the access frequency and the most recent access time;

[0013] Determine the page to be allocated based on the adjusted page step size and the preset circular pointer.

[0014] In one embodiment, the step of dynamically adjusting the page step size based on the access frequency and the most recent access time includes:

[0015] Move the preset circular pointer to the current page according to the page step size of each page;

[0016] Determine the similarity of access parameters between the current page and the previous page, where the similarity of access parameters includes the differences in access frequency and the most recent access time between the two pages;

[0017] If the similarity of access parameters is less than or equal to the first preset threshold, recalculate the page step size according to the access frequency and the most recent access time of the current page, and clear the access flag of the current page;

[0018] If the similarity of access parameters is greater than the first preset threshold, increase the page step size of the current page according to the preset rule, and clear the access flags of all pages between the current page and the previous page.

[0019] In one embodiment, the step of determining the page to be allocated based on the adjusted page step size and the preset circular pointer includes:

[0020] Gradually move the preset circular pointer based on the adjusted page step size so that the preset circular pointer traverses all pages;

[0021] When the preset circular pointer traverses to any page with an empty access flag, determine the current page as the page to be allocated until all pages required by the page task request are queried.

[0022] In one embodiment, the step of performing page replacement for the current task based on the access status of the page to be allocated includes:

[0023] If the access status of the page to be allocated is unaccessed, allocate the current page to be allocated to the current task;

[0024] If the access status of the page to be allocated is accessed, determine the aging degree of the page to be allocated based on the access frequency and the most recent access time of the page to be allocated;

[0025] Perform page replacement for the current task based on the aging degree of the page to be allocated.

[0026] In one embodiment, the step of performing page replacement for the current task based on the aging degree of the page to be allocated includes:

[0027] If the aging degree of the page to be allocated is greater than the second preset threshold, allocate the current page to be allocated to the current task, and update the access flag, access frequency, and recent access time of the current page to be allocated;

[0028] If the aging degree of the page to be allocated is less than or equal to the second preset threshold, stop the current allocation process, and use the remaining pages to be allocated as new page allocation tasks until the page requirements of the current task are met.

[0029] In addition, to achieve the above object, the present application also provides a page replacement device, which includes:

[0030] A response module, configured to divide the memory space into multiple pages in response to a page task request;

[0031] A determination module, configured to determine the page to be allocated based on the access parameters of each page, where the access parameters include a page step, and the page step is dynamically adjusted based on the access frequency and recent access time of the page;

[0032] A replacement module, configured to perform page replacement for the current task based on the access status of the page to be allocated.

[0033] In addition, to achieve the above object, the present application also provides a page replacement device, which includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, and the computer program is configured to implement the steps of the page replacement method as described above.

[0034] In addition, to achieve the above object, the present application also provides a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium, and when the computer program is executed by a processor, it implements the steps of the page replacement method as described above.

[0035] In addition, to achieve the above object, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the page replacement method as described above.

[0036] The present application provides a page replacement method, apparatus, device, storage medium, and computer program product. In response to a page task request, the present application determines a page to be allocated based on the access parameters of each page. The access parameters include an access flag and a page step length, and the page step length is dynamically adjusted based on the access frequency and the most recent access time of the page. It can be dynamically adjusted according to the degree of change in the page access frequency and the most recent access time to more intelligently predict and retain hot pages, avoid cache pollution and frequent page replacement. Furthermore, the current page is determined as the page to be allocated, and then it is determined to allocate this page to a new computing task. Then, according to the access status of the page to be allocated, page replacement is performed for the current task, thereby avoiding unnecessary page replacement and improving the overall performance and stability of the system even in a high-traffic environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.

[0038] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.

[0039] Figure 1 It is a schematic flowchart provided for Embodiment 1 of the page replacement method of the present application;

[0040] Figure 2 It is a schematic flowchart provided for Embodiment 2 of the page replacement method of the present application;

[0041] Figure 3 It is a schematic flowchart provided for Embodiment 3 of the page replacement method of the present application;

[0042] Figure 4 It is a schematic module structure diagram of the page replacement apparatus in the embodiments of the present application;

[0043] Figure 5 It is a schematic device structure diagram of the hardware operating environment involved in the page replacement method in the embodiments of the present application.

[0044] The implementation, functional features, and advantages of the objectives of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0045] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0046] To better understand the technical solution of this application, the following will be described in detail in conjunction with the accompanying drawings of the specification and specific embodiments.

[0047] The main solution of the embodiment of this application is as follows:

[0048] In response to a page task request, divide the memory space into multiple pages;

[0049] Based on the access parameters of each of the pages, determine the page to be allocated, where the access parameters include a page step length, and the page step length is dynamically adjusted based on the access frequency and the most recent access time of the page;

[0050] Based on the access status of the page to be allocated, perform page replacement for the current task.

[0051] In related technologies, since the task access volume of many projects is huge, there are obvious defects in the traditional LRU (Least Recently Used) algorithm and FIFO (First In First Out) algorithm. Although the LRU algorithm can consider the page access history, in a high-concurrency environment, its maintenance cost is high, and it is easily affected by cache pollution. The FIFO algorithm is too simple and cannot adapt to dynamic access patterns, which may lead to frequent page replacements. These problems are particularly prominent under the high access volume of the project, seriously affecting the system performance.

[0052] The LRU algorithm is a commonly used memory page replacement algorithm, and its core idea is to make decisions based on the historical information of page access. This algorithm will record the time since each page was last accessed. When a page replacement is required, it will select the page that has not been accessed for the longest time for replacement. This strategy believes that if a page has not been accessed in a recent period of time, then the probability of being accessed in the future period of time is relatively small. Therefore, the LRU algorithm can effectively utilize limited memory resources, improve the memory utilization rate and the overall performance of the system. In practical applications, the LRU algorithm is widely used in fields such as operating systems, databases, and cache systems, providing an efficient and stable memory management mechanism for these systems.

[0053] The FIFO algorithm is a simple memory page replacement algorithm, and its working principle is similar to a queue. In the FIFO algorithm, the page that enters the memory first will be replaced first. When a page needs to be replaced, the algorithm checks the entry order of all pages in the memory and selects the page that entered first for replacement. This strategy assumes that if a page has been in memory for a long time, it may no longer be needed, so it can be replaced. The FIFO algorithm is simple to implement, but in some cases, it may cause the "thrashing" phenomenon, that is, frequent page replacement, thus reducing the system performance. Therefore, in practical applications, the FIFO algorithm is usually used in scenarios where the memory management requirements are not particularly high.

[0054] This application proposes a page replacement method, device, equipment, storage medium and computer program product. In this application, in response to a page task request, based on the access parameters of each page, the page to be allocated is determined. The access parameters include an access flag and a page step size, and the page step size is dynamically adjusted based on the access frequency and the most recent access time of the page. It can dynamically adjust the page step size according to the change degree of the page access frequency and the most recent access time, so as to more intelligently predict and retain hot pages, avoid cache pollution and frequent page replacement. Furthermore, the current page is determined as the page to be allocated, and then it is determined to allocate this page to a new computing task. Then, according to the access status of the page to be allocated, page replacement is performed for the current task, thereby avoiding unnecessary page replacement and improving the overall performance and stability of the system in a high-traffic environment.

[0055] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device, a page replacement device, a cloud computing platform, etc. that can implement the above functions. Hereinafter, taking the cloud computing platform as an example, this embodiment and the following embodiments will be described.

[0056] Based on this, an embodiment of this application provides a page replacement method, referring to Figure 1 , Figure 1 is a schematic flowchart of the first embodiment of the page replacement method of this application.

[0057] In this embodiment, the page replacement method includes steps S10 to S30:

[0058] Step S10, in response to a page task request, divide the memory space into multiple pages;

[0059] It should be noted that the page task request can be a request to allocate a page to different computing tasks. On a cloud computing platform, memory management is a core task, which is responsible for efficiently allocating limited memory resources to numerous computing tasks. To achieve this goal, the cloud computing platform adopts a page memory management method. Specifically, the platform divides the entire memory space into several fixed-size pages, and each page can be independently allocated to different computing tasks.

[0060] It should be noted that when a computing task starts, it will apply to the platform for a certain number of memory pages according to its own needs. The platform will dynamically allocate one or more memory pages to the task based on the current memory usage. This allocation method not only improves the memory utilization rate but also ensures that each task can obtain sufficient memory resources to execute its computing tasks.

[0061] It should be understood that the cloud computing platform also adopts advanced memory management algorithms to optimize memory allocation and recycling. These algorithms can intelligently predict and retain hot pages based on the memory access patterns of tasks, thereby avoiding frequent page replacements and improving the overall performance of the system.

[0062] By dividing the memory into pages and combining advanced memory management algorithms, the cloud computing platform can efficiently allocate memory resources to numerous computing tasks, meet their different memory requirements, and ensure the stable operation and high performance of the entire system. This flexible memory management method is also one of the key technologies for the cloud computing platform to support large-scale concurrent computing tasks.

[0063] It should be understood that the multiple pages obtained by dividing the memory space are memory pages, and each memory page is assigned a unique identifier for subsequent management and access, and is used to be allocated to the corresponding computing task to ensure the smooth execution of the computing task.

[0064] Step S20: Determine the page to be allocated based on the access parameters of each of the pages, where the access parameters include a page step length, and the page step length is dynamically adjusted based on the access frequency and the most recent access time of the page;

[0065] It should be noted that the access parameters include an access flag and a page step length. The access flag is used to indicate whether the current page has been accessed. When the access flag is empty, it means that the page has not been accessed. When the access flag is not empty, it means that the page has been accessed. The page step length is the initial step length calculated based on the access frequency and the most recent access time of the page. The page step length reflects the priority of the page. When the initial step length of the page is larger, the priority is higher. According to different memory access patterns, the initial step length can be dynamically adjusted to improve the utilization rate of memory resources and the overall performance of the system.

[0066] It should be noted that the access frequency is the number of times a page is accessed, initialized to 0, and the most recent access time is the time corresponding to when the page was accessed within the most recent time period, initialized to a time long ago, indicating that the page has not been accessed yet.

[0067] Step S30, based on the access status of the page to be allocated, perform page replacement for the current task.

[0068] It should be noted that the access status can be unaccessed and accessed. The current task is a computing task that requires page allocation. According to the access status of each page to be allocated, perform page replacement for the current task.

[0069] It should be noted that when performing page replacement for the current task, first allocate each page to the current task, and then perform page replacement. When only one page needs to be replaced for the current task, only need to determine whether the current page is in the unaccessed state. When it is determined that the current page is unaccessed, directly allocate the page to the current task. When it is determined that the current page is accessed, perform subsequent page determination and adjust the access flag of the page until the pages required by the task are traversed, and then end the page replacement process of the current task.

[0070] The present application proposes a page replacement method, device, equipment, storage medium, and computer program product. The present application determines the page to be allocated based on the access parameters of each page in response to a page task request. The access parameters include an access flag and a page step length. The page step length is dynamically adjusted based on the access frequency and the most recent access time of the page, and can be dynamically adjusted according to the change degree of the page access frequency and the most recent access time, so as to more intelligently predict and retain hot pages, avoid cache pollution and frequent page replacement. Furthermore, determine the current page as the page to be allocated, and thus determine to allocate the page to a new computing task. Then, according to the access status of the page to be allocated, perform page replacement for the current task, thereby avoiding unnecessary page replacement and improving the overall performance and stability of the system in a high-traffic environment.

[0071] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar content as that in the above-mentioned first embodiment can be referred to the above introduction and will not be repeated hereinafter. On this basis, please refer to Figure 2 , the access parameters include an access flag, and the step S20 of determining the page to be allocated based on the access parameters of each page includes:

[0072] Step S21, traverse each page through a preset circular pointer and detect the access flag of the current page;

[0073] It should be noted that the preset circular pointer is a pointer used to point to each memory page. The preset circular pointer is initialized to point to the starting position of the memory page. By pointing the preset circular pointer to different pages, each page can be traversed. Among them, the page pointed to by the preset circular pointer at the current moment is the current page.

[0074] It should be noted that when the preset circular pointer points to different pages, an access flag check will be performed on the page pointed to by the pointer to determine whether the current page is in an accessed state.

[0075] Step S22, if the access flag is empty, determine that the current page is a page to be allocated.

[0076] It should be noted that when the access flag is empty, it means that the current page is in an unaccessed state. This page can be directly used, and the access flag is set to non-empty.

[0077] Step S23, if the access flag is not empty, dynamically adjust the page step size based on the access frequency and the most recent access time.

[0078] It should be noted that if the access flag is not empty, it means that the page has been accessed. Then, clear the access flag of the current page, and set the initial step size according to the access frequency and the most recent access time. The higher the access frequency, the longer the step size; the more recent the most recent access time, the longer the step size.

[0079] It should be noted that when the circular pointer points to a page with a non-empty access flag, it means that the page has been accessed and may still be in use currently. Therefore, instead of immediately occupying this page, its access flag is cleared to prepare for the next access. The purpose of doing this is to allow the algorithm to re-evaluate the status of this page in the next loop and decide whether to allocate this page to a new computing task based on the current memory requirements and access patterns.

[0080] In this way, memory resources can be managed more flexibly, unnecessary page replacements and cache pollution can be avoided, thereby improving the overall performance and stability of the system.

[0081] Step S24, determine the page to be allocated based on the adjusted page step size and the preset circular pointer.

[0082] It should be noted that by pointing the preset circular pointer to different pages, then adjusting the page step size of the page pointed to by the preset circular pointer, and determining the access flag of the page that needs to be cleared according to the adjusted page step size, which provides a basis for finding an available page later. After adjusting the page step size, continue to move the pointer and repeat the above steps S21 - S24 until an available page is found.

[0083] In a feasible implementation, step S23 of dynamically adjusting the page step based on the access frequency and the most recent access time includes:

[0084] Move a preset circular pointer to the current page according to the page step of each page;

[0085] It should be noted that the preset circular pointer is moved between pages according to the page step of each page in the order of priority, and the page pointed to after the movement of the preset circular pointer is the current page.

[0086] Determine the similarity of access parameters between the current page and the previous page, where the similarity of access parameters includes the differences in access frequency and the most recent access time between the two pages;

[0087] It should be noted that the previous page is the page before the movement of the preset circular pointer. By determining the similarity of access parameters between the current page and the previous page, it is determined whether the two pages belong to the same task.

[0088] It should be noted that the similarity of access parameters includes the differences in access frequency and the most recent access time between the two pages. When the difference is large, it indicates that the two pages do not belong to the same task; otherwise, they may belong to the same task.

[0089] It should be noted that the calculation method of the similarity of access parameters is as follows:

[0090] Let the frequencies of two accesses be f1 and f2 respectively, and the access times be t1 and t2 (here, t1 and t2 can be specific timestamps or offsets relative to a certain fixed time point).

[0091] We can use the following formula to calculate the similarity S:

[0092]

[0093] Among them, α is a weight factor used to balance the importance of access frequency and access time in the calculation of similarity. The value range of α is usually [0, 1].

[0094] The first part of this formula is the similarity of access frequency, which is calculated using the ratio of the minimum value to the sum. When f1 and f2 are equal, the similarity of this part is 1; when they differ greatly, the similarity is close to 0.

[0095] The second part is the similarity of access time, which is calculated using the absolute value of the time difference. When t1 and t2 are equal (i.e., the access times are the same), the similarity of this part is 1; when they differ greatly, the similarity is close to 0.

[0096] By adjusting the value of α, we can balance the weights of access frequency and access time in similarity calculation according to actual needs. If access frequency is considered more important, α can be set larger; if access time is considered more important, α can be set smaller.

[0097] If the access parameter similarity is less than or equal to the first preset threshold, recalculate the page step size according to the access frequency and the most recent access time of the current page, and clear the access flag of the current page.

[0098] It should be noted that the first preset threshold can be 0.5, 0.8, etc., and there is no specific limitation.

[0099] It should be noted that when the access parameter similarity is less than or equal to the first preset threshold, it indicates that the similarity between the previous page and the current page is low and they do not belong to the same task. Then, recalculate the page step size according to the preset formula and promptly clear the access flag of the current page, so as to facilitate re-evaluation when traversing each page subsequently, optimize the memory usage efficiency, and improve the system performance. This is an optimization strategy to adapt to task continuity.

[0100] It should be noted that the method of recalculating the page step size according to the access frequency and the most recent access time of the current page can be the following formula:

[0101] s = k * (f + 1) * (1 / (log(t + 1 + ε) + C));

[0102] Among them, k is a constant used to adjust the overall size of the step size. By adjusting the value of k, we can control the increase and decrease speed of the step size to adapt to different memory access patterns and system requirements.

[0103] f represents the access frequency of the page. The higher the access frequency, the more times the page has been accessed, so it is more likely to be part of the current task. In the formula, the access frequency is directly proportional to the step size, that is, the higher the access frequency, the larger the step size.

[0104] t represents the time difference between the current time and the most recent access time of the page. The smaller the time difference, the more recently the page has been accessed, so it is more likely to be part of the current task. In the formula, the time difference is inversely proportional to the step size, that is, the smaller the time difference, the larger the step size.

[0105] ε is a small positive constant used to avoid taking the logarithm of log(0) or a number very close to 0. This can ensure the validity of the formula and prevent errors caused by dividing by 0 or taking the logarithm with a base of 0.

[0106] C is also a small positive constant used to ensure that the denominator is not 0. In practical applications, we can adjust the value of C according to the specific requirements and performance of the system.

[0107] If the similarity of the access parameters is greater than the first preset threshold, then according to the preset rule, increase the page step length of the current page and clear the access flags of all pages between the current page and the previous page.

[0108] It should be noted that when the similarity of the access parameters is greater than the first preset threshold, it indicates that the similarity between the previous page and the current page is relatively low, and they may belong to the same task.

[0109] It should be noted that the preset rule is to double or equally increase the page step length. After increasing the page step length of the current page according to this rule, clear the access flags of all pages between the current page and the previous page. In memory management, if two pages are accessed similarly, they are considered to belong to the same task. At this time, increasing the step length can quickly traverse relevant pages, maintain data locality, and reduce replacements. At the same time, clear the access flags of the intermediate pages for re-evaluation, avoid frequent evaluation of the same task pages, optimize the memory usage efficiency, and improve the system performance. This is an optimization strategy to adapt to task continuity.

[0110] In a feasible implementation manner, the step S24 of determining the page to be allocated based on the adjusted page step length and the preset circular pointer includes:

[0111] Based on the adjusted page step length, gradually move the preset circular pointer so that the preset circular pointer traverses all pages;

[0112] It should be noted that after the page step length of the page is adjusted, gradually move the preset circular pointer to point to different memory pages, so as to ensure that the preset circular pointer traverses all pages.

[0113] When the preset circular pointer traverses to any page with an empty access flag, determine the current page as the page to be allocated until all the pages required by the page task request are queried.

[0114] It should be noted that when the preset circular pointer traverses to any page with an empty access flag, determine the current page as the page to be allocated, or decide to use a certain accessed page according to the policy, and gradually repeat the above steps until all the pages required by the current task are traversed.

[0115] In this embodiment, the dynamic step length adjustment is performed based on the page access frequency and the recent access time, so that the memory management algorithm can intelligently adjust the step length according to the actual access pattern, thereby more accurately predicting and retaining hot pages, effectively avoiding frequent page replacements and cache pollution, and significantly improving the overall performance of the system.

[0116] Based on the first embodiment and / or the second embodiment of the present application, in the third embodiment of the present application, the content that is the same as or similar to the above-mentioned first embodiment and second embodiment can be referred to the above introduction and will not be elaborated hereinafter. On this basis, please refer to Figure 3 , the step S30 of performing page replacement for the current task based on the access status of the page to be allocated includes:

[0117] Step S31, if the access status of the page to be allocated is unaccessed, allocate the current page to be allocated to the current task;

[0118] It should be noted that when finding a page and preparing to allocate it to the current task, it is first necessary to determine whether the task requires one page or multiple pages. When the current task only requires one page, directly allocate the page to the current task, update the access flag of the page to accessed, and record its access frequency and the most recent access time.

[0119] It should be noted that if the task requires multiple pages, traverse the subsequent page list required by the task. For each page, check its access status: whether it has been accessed. If the subsequent page has not been accessed, allocate it to the current task, update the access flag of the page to accessed, and record its access frequency and the most recent access time, and continue to check the next page until the task requirements are met or all pages have been checked.

[0120] Step S32, if the access status of the page to be allocated is accessed, determine the aging degree of the page to be allocated based on the access frequency and the most recent access time of the page to be allocated;

[0121] It should be noted that if the subsequent page to be allocated has been accessed, the aging degree of the page is determined according to its access frequency and the most recent access time. Among them, the aging degree is divided into page aging (low access frequency and early most recent access time) and page non-aging.

[0122] Step S33, perform page replacement for the current task based on the aging degree of the page to be allocated.

[0123] It should be noted that according to the different aging degrees of the page to be allocated, different allocation processes are executed to complete the page replacement process of the current task.

[0124] It should be noted that the calculation method of the aging degree of the page can be:

[0125] Page aging = (current time - most recent access time) / access frequency > aging threshold or the second preset threshold;

[0126] Among them: "current time" is the current time point of the system.

[0127] "Last access time" is the time point when the page was last accessed.

[0128] "Access frequency" is the frequency at which the page is accessed, which can be measured by the number of times the page is accessed within a unit of time.

[0129] "Aging threshold" is a preset threshold used to determine whether a page is aging. This threshold can be set according to the requirements of memory management and the access pattern of the page.

[0130] The purpose of calculating the aging degree of a page is as follows: First, calculate the length of time since the page was last accessed, and then divide it by the access frequency of the page to obtain a relative aging degree. If this aging degree exceeds the preset aging threshold, then the page is considered to be aging.

[0131] In this way, we can consider both the access frequency and the last access time of the page, more accurately determine whether the page is aging, and allocate and manage memory pages according to the actual situation.

[0132] In a feasible implementation manner, the step S33 of performing page replacement for the current task based on the aging degree of the page to be allocated includes:

[0133] If the aging degree of the page to be allocated is greater than the second preset threshold, then allocate the current page to be allocated to the current task, and update the access flag, access frequency, and last access time of the current page to be allocated;

[0134] It should be noted that the second preset threshold can be set according to the requirements of memory management and the access pattern of the page, and is mainly used to determine the aging degree of the page, and no specific limitation is made.

[0135] It should be noted that if the aging degree of the page to be allocated is greater than the second preset threshold, it means that the current page is an aging page. If the page is aging (low access frequency and early last access time), then allocate it to the current task, and update the access flag, access frequency, and last access time of the page.

[0136] If the aging degree of the page to be allocated is less than or equal to the second preset threshold, then stop the current allocation process, and use the remaining pages to be allocated as a new page allocation task until the page requirements of the current task are met.

[0137] It should be noted that if the aging degree of the page to be allocated is less than or equal to the second preset threshold, it means that the page is not aging, then directly interrupt the current allocation process, and use the remaining pages to be allocated as a new task. For the new page task (i.e., the remaining pages to be allocated), continue to re - execute the page search and allocation process until all page requirements are met.

[0138] For example, a task requires a total of 5 pages. When allocating the first page, if the page has not been accessed, it is directly allocated; when allocating the second page, the page has already been allocated but is aged, so this page is allocated; when allocating the third page, the page has been allocated and is not aged, so the allocation process is interrupted. The remaining 3 tasks to be allocated are reset as a new task, which is to allocate 3 pages.

[0139] The following is a specific allocation example:

[0140] Task requirement: A computing task requires 10 memory pages to be allocated.

[0141] Start allocation:

[0142] Page 1: The circular pointer points to page 1, the access flag is empty, and it is directly allocated and the page parameters are updated.

[0143] Page 2: The circular pointer moves, and the access flag of page 2 is also empty, so it is allocated and updated.

[0144] Pages 3 - 6: Similarly, pages 3 to 6 are allocated in sequence and the page parameters are updated.

[0145] Encounter an accessed page:

[0146] Page 7: The circular pointer moves, and it is found that page 7 has been accessed (assuming it was accessed by other tasks before), but according to the page aging judgment formula, the page is not aged.

[0147] At this time, page 7 is not allocated to the current task, and the current allocation process is interrupted.

[0148] The remaining pages to be allocated (pages 8 - 10) are regarded as a new task.

[0149] Process the new task:

[0150] Restart allocation: The circular pointer may restart from the starting position or the position where the previous interruption occurred (depending on implementation details).

[0151] Page search: According to the allocation logic of the new task, continue to search for available pages.

[0152] Page 8: Found and allocated (assuming page 8 has not been accessed or meets the allocation conditions).

[0153] Page 9: Similarly allocate page 9.

[0154] Page 10: Allocate page 10 to complete the allocation of all pages of the new task.

[0155] In this embodiment, for single-page allocation or continuous allocation of multiple pages, intelligent decisions are made based on the access status and aging degree of the pages. This flexibility not only improves the efficiency of memory management but also enhances the system's adaptability to high-concurrency and dynamically changing access patterns.

[0156] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the page replacement method of this application. Based on this technical concept, more forms of simple transformations are within the protection scope of this application.

[0157] This application also provides a page replacement device. Please refer to Figure 4 , the page replacement device includes:

[0158] A response module 10, configured to divide the memory space into multiple pages in response to a page task request;

[0159] A determination module 20, configured to determine the page to be allocated based on the access parameters of each page, where the access parameters include a page step size, and the page step size is dynamically adjusted based on the access frequency and the most recent access time of the page;

[0160] A replacement module 30, configured to perform page replacement for the current task based on the access status of the page to be allocated.

[0161] Optionally, the determination module includes:

[0162] A detection unit, configured to traverse each page through a preset circular pointer and detect the access flag of the current page;

[0163] A first determination unit, configured to determine the current page as the page to be allocated if the access flag is empty;

[0164] An adjustment unit, configured to dynamically adjust the page step size based on the access frequency and the most recent access time if the access flag is not empty;

[0165] A second determination unit, configured to determine the page to be allocated based on the adjusted page step size and the preset circular pointer.

[0166] Optionally, the adjustment unit includes:

[0167] A first moving subunit, configured to move the preset circular pointer to the current page according to the page step size of each page;

[0168] A first determination subunit, configured to determine the similarity of the access parameters between the current page and the previous page, where the similarity of the access parameters includes the differences in access frequency and the most recent access time between the two pages;

[0169] A calculation subunit, configured to recalculate a page step based on the access frequency and the most recent access time of the current page and clear the access flag of the current page if the access parameter similarity is less than or equal to a first preset threshold;

[0170] A clearing subunit, configured to increase the page step of the current page according to a preset rule and clear the access flags of all pages between the current page and the previous page if the access parameter similarity is greater than the first preset threshold.

[0171] Optionally, the second determination unit includes:

[0172] A second moving subunit, configured to gradually move a preset circular pointer based on the adjusted page step so that the preset circular pointer traverses all pages;

[0173] A second determination subunit, configured to determine the current page as a page to be allocated when the preset circular pointer traverses to any page with an empty access flag until all page queries required by the page task request are completed.

[0174] Optionally, the replacement module includes:

[0175] An allocation unit, configured to allocate the current page to be allocated to the current task if the access status of the page to be allocated is unaccessed;

[0176] A third determination unit, configured to determine the aging degree of the page to be allocated based on the access frequency and the most recent access time of the page to be allocated if the access status of the page to be allocated is accessed;

[0177] A replacement unit, configured to perform page replacement for the current task based on the aging degree of the page to be allocated.

[0178] Optionally, the replacement unit includes:

[0179] An update subunit, configured to allocate the current page to be allocated to the current task and update the access flag, access frequency, and most recent access time of the current page to be allocated if the aging degree of the page to be allocated is greater than a second preset threshold;

[0180] An allocation subunit, configured to stop the current allocation process and use the remaining pages to be allocated as a new page allocation task until the page requirements of the current task are met if the aging degree of the page to be allocated is less than or equal to the second preset threshold.

[0181] The page replacement device provided by this application adopts the page replacement method in the above embodiment, and can solve the technical problem of page replacement. Compared with the prior art, the beneficial effects of the page replacement device provided by this application are the same as those of the page replacement method provided by the above embodiment, and other technical features in the page replacement device are the same as those disclosed in the above embodiment method, which will not be elaborated here.

[0182] This application provides a page replacement device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the page replacement method in the first embodiment above.

[0183] Refer to the following Figure 5 , which shows a schematic structural diagram of a page replacement device suitable for implementing the embodiments of this application. The page replacement device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions: tablet computers), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The page replacement device shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of this application.

[0184] As shown in Figure 5As shown, the page replacement device may include a processing device 1001 (such as a central processing unit, a graphics processing unit, etc.), which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM: Random Access Memory) 1004. In the RAM 1004, various programs and data required for the operation of the page replacement device are also stored. The processing device 1001, the ROM 1002, and the RAM 1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems may be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the page replacement device to communicate with other devices wirelessly or wiredly to exchange data. Although the figure shows a page replacement device with various systems, it should be understood that it is not required to implement or have all the systems shown. Instead, more or fewer systems may be implemented or had.

[0185] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network through the communication device, or installed from the storage device 1003, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above functions defined in the methods of the embodiments disclosed in the present application are executed.

[0186] The page replacement device provided by the present application adopts the page replacement method in the above embodiments and can solve the technical problems of page replacement. Compared with the prior art, the beneficial effects of the page replacement device provided by the present application are the same as those of the page replacement method provided by the above embodiments, and other technical features in the page replacement device are the same as those disclosed in the method of the previous embodiment, and will not be elaborated here.

[0187] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in a suitable manner in any one or more embodiments or examples.

[0188] As described above, the above are only specific embodiments of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in this application, and all should be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

[0189] This application provides a computer-readable storage medium with computer-readable program instructions (i.e., computer programs) stored thereon, and the computer-readable program instructions are used to execute the page replacement method in the above embodiments.

[0190] The computer-readable storage medium provided by this application can be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or flash memory, optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this embodiment, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or combined with an instruction execution system, device, or device. The program code contained on the computer-readable storage medium can be transmitted by any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0191] The above computer-readable storage medium can be included in the page replacement device; it can also exist separately without being assembled into the page replacement device.

[0192] The above computer-readable storage medium carries one or more programs. When the above one or more programs are executed by the page replacement device, the page replacement device is caused to:

[0193] In response to a page task request, divide the memory space into multiple pages;

[0194] Based on the access parameters of each of the pages, determine the page to be allocated, where the access parameters include a page step size, and the page step size is dynamically adjusted based on the access frequency and the most recent access time of the page;

[0195] Based on the access status of the page to be allocated, perform page replacement for the current task.

[0196] Computer program code for performing the operations of the present application may be written in one or more programming languages or combinations thereof. The above-mentioned programming languages include object-oriented programming languages - such as Java, Smalltalk, C++, and also include conventional procedural programming languages - such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network - including a local area network (LAN: Local Area Network) or a wide area network (WAN: Wide Area Network) - or may be connected to an external computer (e.g., by connecting through an Internet service provider using the Internet).

[0197] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, may be implemented by a dedicated hardware-based system for performing the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.

[0198] The modules described in the embodiments of the present application may be implemented in software or in hardware. Among them, the name of the module does not constitute a limitation to the unit itself in some cases.

[0199] The readable storage medium provided by this application is a computer-readable storage medium. The computer-readable storage medium stores computer-readable program instructions (i.e., computer programs) for executing the above page replacement method, and can solve the technical problem of page replacement. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by this application are the same as those of the page replacement method provided by the above embodiments, and will not be elaborated here.

[0200] This application also provides a computer program product, including a computer program, and the steps of the above page replacement method are implemented when the computer program is executed by a processor.

[0201] The computer program product provided by this application can solve the technical problem of page replacement. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as those of the page replacement method provided by the above embodiments, and will not be elaborated here.

[0202] The above are only partial embodiments of this application, and do not limit the patent scope of this application accordingly. Any equivalent structural transformation made by using the content of the specification and drawings of this application under the technical concept of this application, or direct / indirect application in other related technical fields, is included in the patent protection scope of this application.

Claims

1. A page replacement method, characterized in that, The method includes: In response to a page task request, dividing the memory space into multiple pages; Based on the access parameters of each of the pages, determining the page to be allocated, where the access parameters include a page step length, and the page step length is dynamically adjusted based on the access frequency and the most recent access time of the page; Based on the access status of the page to be allocated, performing page replacement for the current task.

2. The method according to claim 1, characterized in that, The access parameters include an access flag, and the step of determining the page to be allocated based on the access parameters of each of the pages includes: Traversing each of the pages through a preset circular pointer and detecting the access flag of the current page; If the access flag is empty, determining the current page as the page to be allocated; If the access flag is not empty, dynamically adjusting the page step length based on the access frequency and the most recent access time; Based on the adjusted page step length and the preset circular pointer, determining the page to be allocated.

3. The method according to claim 2, wherein The step of dynamically adjusting the page step length based on the access frequency and the most recent access time includes: Moving the preset circular pointer to the current page according to the page step length of each of the pages; Determining the similarity of the access parameters between the current page and the previous page, where the similarity of the access parameters includes the difference in access frequency and the most recent access time between the two pages; If the similarity of the access parameters is less than or equal to a first preset threshold, recalculating the page step length according to the access frequency and the most recent access time of the current page, and clearing the access flag of the current page; If the similarity of the access parameters is greater than the first preset threshold, increasing the page step length of the current page according to a preset rule, and clearing the access flags of all the pages between the current page and the previous page.

4. The method according to any one of claims 2 to 3, characterized in that, The step of determining the page to be allocated based on the adjusted page step length and the preset circular pointer includes: Based on the adjusted page step length, gradually moving the preset circular pointer so that the preset circular pointer traverses all the pages; When the preset circular pointer traverses to any page with an empty access flag, determining the current page as the page to be allocated until all the pages required by the page task request are queried.

5. The method according to claim 1, wherein The step of performing page replacement for the current task based on the access status of the page to be allocated includes: If the access status of the page to be allocated is unaccessed, allocating the current page to be allocated to the current task; If the access status of the page to be allocated is accessed, determining the aging degree of the page to be allocated based on the access frequency and the most recent access time of the page to be allocated; Based on the aging degree of the page to be allocated, performing page replacement for the current task.

6. The method according to claim 5, characterized in that, The step of performing page replacement for the current task based on the aging degree of the page to be allocated includes: If the aging degree of the page to be allocated is greater than a second preset threshold, allocating the current page to be allocated to the current task, and updating the access flag, access frequency, and most recent access time of the current page to be allocated; If the aging degree of the page to be allocated is less than or equal to the second preset threshold, stopping the current allocation process, and using the remaining pages to be allocated as a new page allocation task until the page requirements of the current task are met.

7. A page replacement device, characterized in that, The device includes: A response module, configured to divide a memory space into multiple pages in response to a page task request; A determination module, configured to determine a page to be allocated based on access parameters of each of the pages, where the access parameters include a page step length, and the page step length is dynamically adjusted based on the access frequency and the most recent access time of the page; A replacement module, configured to perform page replacement for a current task based on the access status of the page to be allocated.

8. A page replacement device, characterized in that, The device includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, where the computer program is configured to implement the steps of the page replacement method according to any one of claims 1 to 6.

9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the page replacement method according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that, The computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the page replacement method according to any one of claims 1 to 6 are implemented.