CN111858393A - Memory page management method, memory page management device, medium and electronic device - Google Patents

Memory page management method, memory page management device, medium and electronic device Download PDF

Info

Publication number
CN111858393A
CN111858393A CN202010670002.7A CN202010670002A CN111858393A CN 111858393 A CN111858393 A CN 111858393A CN 202010670002 A CN202010670002 A CN 202010670002A CN 111858393 A CN111858393 A CN 111858393A
Authority
CN
China
Prior art keywords
page
inactive
linked list
memory
pages
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010670002.7A
Other languages
Chinese (zh)
Other versions
CN111858393B (en
Inventor
李培锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Oppo Chongqing Intelligent Technology Co Ltd
Original Assignee
Oppo Chongqing Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo Chongqing Intelligent Technology Co Ltd filed Critical Oppo Chongqing Intelligent Technology Co Ltd
Priority to CN202010670002.7A priority Critical patent/CN111858393B/en
Publication of CN111858393A publication Critical patent/CN111858393A/en
Application granted granted Critical
Publication of CN111858393B publication Critical patent/CN111858393B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a memory page management method, a memory page management device, a computer readable storage medium and an electronic device, and relates to the technical field of computers. The memory page management method comprises the following steps: determining at least one page to be inserted from occupied memory pages; inserting the page to be inserted into an inactive page linked list according to the page frame number of the page to be inserted; and determining the release sequence of the inactive pages in the inactive page linked list based on the inactive page linked list. The method and the device can effectively manage the memory pages so as to improve the problem of fragmentation of the computer memory.

Description

Memory page management method, memory page management device, medium and electronic device
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a memory page management method, a memory page management apparatus, a computer-readable storage medium, and an electronic device.
Background
With the development of computer technology, the performance requirements of people on devices are gradually increased, and in order to ensure that a system has enough memory to be used, the system of an electronic device usually recycles some memory pages under certain conditions to reuse resources. In the prior art, when the memory pages are recycled, the memory pages with lower recent use frequency are eliminated based on the use frequency of the memory pages. However, since the sizes of the memory pages are different and an effective management method is lacked, when the pages are recycled, more memory fragments are generated, which causes waste of memory resources of the computer.
Therefore, how to adopt an effective memory page management method is an urgent problem to be solved in the prior art.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure provides a memory page management method, a memory page management apparatus, a computer-readable storage medium and an electronic device, so as to at least improve the problem of memory page fragmentation in the prior art, which causes waste of computer memory resources.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to a first aspect of the present disclosure, a memory page management method is provided, including: determining at least one page to be inserted from occupied memory pages; inserting the page to be inserted into an inactive page linked list according to the page frame number of the page to be inserted; and determining the release sequence of the inactive pages in the inactive page linked list based on the inactive page linked list.
According to a second aspect of the present disclosure, there is provided a memory page management apparatus, including: the page determining module is used for determining at least one page to be inserted from the occupied memory pages; the page inserting module is used for inserting the page to be inserted into the inactive page linked list according to the page frame number of the page to be inserted; and the order determining module is used for determining the release order of the inactive pages in the inactive page linked list based on the inactive page linked list.
According to a third aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the above memory page management method.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the memory page management method by executing the executable instructions.
The technical scheme of the disclosure has the following beneficial effects:
determining at least one page to be inserted from occupied memory pages according to the memory page management method, the memory page management device, the computer-readable storage medium and the electronic equipment; inserting the page to be inserted into the inactive page linked list according to the page frame number of the page to be inserted; and determining the release sequence of the inactive pages in the inactive page linked list based on the inactive page linked list. On one hand, the exemplary embodiment provides a memory page management method, which inserts a page to be inserted into an inactive page linked list according to a page frame number, so that the inserted memory page has a uniform rule, and management of the memory page is facilitated; on the other hand, because the memory pages in the inactive page linked list are inserted according to the page frame number, the system can integrate the idle memory pages based on the page frame number, thereby effectively reducing the fragmentation probability of the system memory and improving the problem of high delay times of the system due to fragmentation; on the other hand, further, the release sequence of the inactive pages in the inactive page linked list is determined based on the inactive page linked list, and due to the fact that the problem of fragmentation of a system memory is solved, the system can load a large file after the memory pages are recycled, and therefore the use efficiency of the memory is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.
Fig. 1 illustrates a memory page management method in the related art;
fig. 2 shows a schematic diagram of an electronic device of the present exemplary embodiment;
fig. 3 is a flowchart illustrating a memory page management method according to the present exemplary embodiment;
FIG. 4 is a sub-flowchart of a method for memory page management according to the exemplary embodiment;
fig. 5 is a flowchart illustrating another memory page management method according to the present exemplary embodiment;
fig. 6 is a block diagram illustrating a structure of a memory page management apparatus according to the exemplary embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and the like. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
In a related art memory page management method, a memory page is recycled based on an LRU (Least Recently Used) algorithm, for example, when a Linux kernel native LRU algorithm manages a memory page, the method may include two linked lists: an active page linked list; a linked list of inactive pages. When a user accesses a memory page, the memory page is placed at the head of an active page linked list to indicate that the memory page is in an active state, the memory page which is not accessed for a long time is pushed to the tail of the active page linked list along with the increase of the active page, and if the memory is in shortage, part of the memory page at the tail of the active page linked list is replaced into an inactive page linked list; memory pages in the inactive page linked list are also the same rule, the memory pages which are not accessed for a long time can be pushed to the tail of the linked list, and finally, eliminated memory pages are determined from the tail of the inactive page linked list; when the memory page in the inactive page linked list is accessed, the memory page is hung in the active page linked list to indicate that the page is active.
Fig. 1 shows a flowchart of a memory page management method in the related art, which may specifically include the following steps: step S110, obtaining a memory page which is not accessed for a long time, namely a memory page to be eliminated from an active page linked list; step S120, directly inserting the acquired memory page into the head of the inactive page linked list, so as to complete the process of inserting the inactive page linked list into the memory page. With the lapse of time, the memory page at the head of the inactive page linked list is gradually pushed to the tail of the inactive page linked list, and finally the memory page which is finally eliminated can be determined from the tail. However, the method of directly inserting the memory pages into the inactive page linked list has a direct process, does not consider the problem of fragmentation of the system memory, and the memory pages in the inactive page linked list can be moved out of the inactive page linked list again when being accessed, so that the memory pages in the inactive page linked list are stored in a messy manner, and the waste of the memory resources of the computer is caused.
Based on the foregoing problems, the present exemplary embodiment provides a new memory page management method, which can effectively manage memory pages to improve the memory recovery efficiency. The memory page management method provided by the embodiment of the disclosure can be executed by a terminal device or a server. The present disclosure is not limited thereto.
The exemplary embodiment of the present disclosure provides an electronic device for implementing a memory page management method. The electronic device comprises at least a processor and a memory for storing executable instructions of the processor, the processor being configured to perform the information security based database construction method via execution of the executable instructions.
An electronic device 200 according to such an exemplary embodiment of the present disclosure is described below with reference to fig. 2. The electronic device 200 shown in fig. 2 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in FIG. 2, electronic device 200 is embodied in the form of a general purpose computing device. The components of the electronic device 200 may include, but are not limited to: the at least one processing unit 210, the at least one memory unit 220, a bus 230 connecting different system components (including the memory unit 220 and the processing unit 210), and a display unit 240.
Where the storage unit stores program code, the program code may be executed by the processing unit 210 to cause the processing unit 210 to perform the steps according to various exemplary embodiments of the present disclosure described in the above section "exemplary methods" of this specification. For example, processing unit 210 may perform the steps shown in fig. 3, 4, or 5, and so on.
The storage unit 220 may include readable media in the form of volatile memory units, such as a random access memory unit (RAM)221 and/or a cache memory unit 222, and may further include a read only memory unit (ROM) 223.
The storage unit 220 may also include a program/utility 224 having a set (at least one) of program modules 225, such program modules 225 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 230 may be one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 200 may also communicate with one or more external devices 270 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 200, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 200 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/O) interface 250. Also, the electronic device 200 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via the network adapter 260. As shown, the network adapter 260 communicates with the other modules of the electronic device 200 over the bus 230. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the exemplary embodiments of the present disclosure.
Exemplary embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the above-mentioned "exemplary methods" section of this specification, when the program product is run on the terminal device.
The following describes a memory page management method and a memory page management apparatus according to exemplary embodiments of the present disclosure in detail.
Fig. 3 shows a flow of a memory page management method in the exemplary embodiment, which includes the following steps S310 to S330:
in step S310, at least one page to be inserted is determined from the occupied memory pages.
Generally, a system may manage a memory in units of a page form, where a memory page refers to a block of storage space, which may be expressed in a file form, for storing data information. In order to ensure that the system has enough memory to use, the system usually recycles the memory pages periodically or under some trigger conditions, and releases the memory space to reuse the memory pages and write new data information. In this exemplary embodiment, the page to be inserted is a page to which data information has been written, which may be eliminated or subjected to memory release, and the page is often a page that has not been accessed by the user within a preset time, for example, a memory page that has not been accessed within a week; or in a recent period of time, the user accesses a memory page that is not included in the preset number of pages, for example, the user accesses a certain page, and then none of the 100 memory pages accessed later includes the page, it may be considered that the user has no temporary demand for the data information of the memory page, and it may be considered that memory release is performed on the memory page, so as to make up a new memory space. In the exemplary embodiment, the page to be inserted may be obtained in various ways, for example, a memory page accessed by a user may be first added to an active page linked list, and the page to be inserted may be obtained from the active page linked list; in addition, the page to be inserted may also be directly obtained from all memory pages accessed by the user, and the like, which is not specifically limited in this disclosure.
In an exemplary embodiment, the step S310 may include:
and acquiring at least one page to be inserted from the tail part of the active page linked list.
The active page linked list refers to a storage structure for storing memory pages, and the memory pages stored in the linked list are pages recently accessed by a user or pages which are accessed regularly, that is, active pages. In this exemplary embodiment, the active page linked list may store the memory pages according to a certain policy, for example, the obtained new memory page is first placed at the head of the linked list, and after the added memory pages are added, the memory pages that are not accessed by the user again may be pushed to the tail of the linked list, so that the active degree of the active page at the tail of the linked list is low, and then at least one page to be inserted may be obtained from the tail of the active page linked list.
The active page linked list can be managed in various ways, for example, the active page linked list can be sorted in a FIFO (First in First out) manner, new acquired memory pages are sequentially arranged according to acquired timestamps, the timestamps are placed in the active page linked list close to the tail part and far from the current time, the timestamps are placed in the active page linked list close to the head part and near to the current time, and then the pages to be inserted are acquired from the tail part of the active page linked list, that is, the memory pages with the timestamps far from the current time are acquired. In addition, the active pages in the active page linked list can be managed in an LRU manner and sorted, which is not specifically limited by the present disclosure.
Further, in an exemplary embodiment, the obtaining at least one page to be inserted from the tail of the active page linked list may include:
and when the number of active pages in the active page linked list reaches a first threshold value and a new active page is inserted into the active page linked list, acquiring at least one page to be inserted from the tail part of the active page linked list.
When the number of the active pages stored in the active page linked list is large and a new active page is inserted into the active page linked list, the situation that the storage space of the current active page linked list is possibly tense is shown. Therefore, the exemplary embodiment may set a trigger mechanism for acquiring the page to be inserted from the active page linked list, and in the above case, acquire at least one page to be inserted from the tail of the active page linked list, and clean the active page in the active page linked list, so as to better store the effective active page and reduce the storage pressure of the active page linked list. The first threshold may be set by self-definition as needed, which is not specifically limited in this disclosure.
The present exemplary embodiment may be applied to an application scenario for managing multiple memory pages, for example, may be applied to managing pages in a hard disk space, and in an exemplary embodiment, the memory pages may be cache pages. In the actual use process of the application program, the system often loads some data files, and the data files are read into a memory page, namely a file cache.
Step S320, inserting the page to be inserted into the inactive page linked list according to the page frame number of the page to be inserted.
A page refers to a concept for a virtual address, which is a division of a linear address into a fixed-length unit set (e.g., 4KB in size). Consecutive linear addresses within a page may be mapped into consecutive physical addresses. A page frame refers to a concept for a physical address. The physical memory may be divided into fixed-length memory regions, the region page frame also being called a physical page. Each page frame can uniquely correspond to a page frame number, a continuous page frame number and a continuous physical page. The inactive page linked list refers to a storage structure for storing memory pages, and the memory pages stored in the linked list are all pages which are not accessed by a user for a long time and can be eliminated or recycled, namely inactive pages. The exemplary embodiment may insert the page to be inserted into the inactive page linked list according to the page frame number of the page to be inserted. E.g., sorted by page frame number size, inserted into the inactive page linked list in order of small arrival. In practical applications, when memory management is performed, the system integrates free pages, for example, two pages with consecutive frame numbers are free, and the system integrates the two pages together to form a large page. Accordingly, when a page is released, a large block of pages may be released. The page to be inserted is inserted into the inactive page linked list through the page frame number in the exemplary embodiment, and the memory fragments can be effectively integrated, so that when the page is released, the fragmentation of the memory page is avoided, a larger file is conveniently loaded in the memory in the follow-up process, and the use efficiency of the memory is improved.
It should be noted that the inactive page and the active page are relative concepts, and when a user accesses a certain memory page, the memory page is added to the active page linked list, and at this time, the memory page is an active page.
Step S330, determining the release sequence of the inactive pages in the inactive page linked list based on the inactive page linked list.
The release sequence of the inactive pages refers to a memory recovery sequence of the inactive pages, and the system can release the memories of the inactive pages according to the sequence. In the inactive page linked list, the inactive pages may be sorted according to the page frame number, for example, sorted from small to large according to the page frame number, and stored in the inactive page linked list, that is, the small page frame number is close to the head of the linked list, and the large page frame number is close to the tail of the linked list; or sorting the page frame numbers from large to small and storing the page frame numbers in the inactive page linked list, namely, the page frame number is large and close to the head of the linked list, and the page frame number is small and close to the tail of the linked list. When the inactive page is released, the memory page can be released from the head or the tail of the inactive page linked list.
In an exemplary embodiment, the memory page management method may further include the following steps:
and when the preset condition of releasing the memory is met, releasing the inactive page from the head or the tail of the inactive page linked list.
The preset condition is a judgment condition for determining whether to trigger releasing of the memory page currently, and the preset condition may include multiple conditions, for example, the preset condition is set to be a time period, and when the time period is reached, the inactive page at the head or the tail of the inactive page linked list is triggered to be released.
In addition, the preset condition may further include any one of:
the number of inactive pages in the inactive page linked list reaches a second threshold value;
the memory occupancy in the system reaches a third threshold.
In order to enable the inactive page linked list to reasonably and effectively store the inactive pages, the exemplary embodiment may set a second threshold, and when the number of the inactive pages reaches the second threshold, release the inactive pages at the head or the tail of the inactive page linked list, where the second threshold may be set by user as needed, for example, the number of the inactive pages that can be stored in the inactive page linked list is determined, and eighty percent of the total number is used as the second threshold.
The memory occupancy rate refers to the memory overhead occupied by the current process of the system, and it is considered that when the memory occupancy rate is high, the overall performance of the system may be affected. Therefore, whether the inactive page is released or not can be determined by judging the memory occupancy rate, and when the memory occupancy rate in the system reaches a third threshold value, the inactive page in the inactive page linked list can also be released. The third threshold may also be set by a user according to the needs of the user, which is not specifically limited in this disclosure.
In an exemplary embodiment, as shown in fig. 4, the step S330 may include the following steps:
step S410, a group of adjacent inactive pages is searched in the inactive page linked list, so that the number of one page frame is larger than that of the page to be inserted, and the number of the other page frame is smaller than that of the page to be inserted;
in step S420, the page to be inserted is inserted between the searched adjacent inactive pages in the inactive page linked list.
Considering that when the page frame numbers of two free memory pages are continuous, the system can integrate the two pages into a large page, thereby reducing memory fragmentation and facilitating the subsequent writing into a larger file. Therefore, when the page to be inserted is inserted into the inactive page linked list, the page to be inserted may be inserted in the order of the page frame numbers, for example, the page with the page frame number of 10 is inserted between the inactive page with the page frame number of 9 and the inactive page with the page frame number of 11 in the inactive page linked list. However, in practical applications, the inactive pages in the inactive page linked list are not necessarily closely connected. Therefore, in order to make the page frame numbers as continuous as possible, when inserting the page to be inserted, the present exemplary embodiment may look up a group of adjacent inactive pages in the inactive page linked list, so that the page frame number of the page to be inserted is greater than the page frame number of one of the inactive pages and less than the page frame number of another one of the inactive pages. Then, the page to be inserted is inserted between the adjacent inactive pages. For example, if the page frame number of the current page to be inserted is 9, searching is performed in the inactive page linked list, a group of adjacent inactive pages is determined, and the page frame numbers are 7 and 12 respectively, the page to be inserted with the page frame number of 9 is inserted between the inactive page with the page frame number of 7 and the inactive page with the page frame number of 12.
In this exemplary embodiment, the manner of searching for the inactive page may include multiple manners, for example, searching sequentially from the head of the inactive page linked list; or the search is carried out in the reverse order from the tail part of the inactive page linked list; or by bisection, starting the first search from the middle of the inactive page linked list, and so on, which is not specifically limited by the present disclosure.
Fig. 5 is a flowchart illustrating another memory page management method, which may specifically include the following steps:
step S510, obtaining at least one page to be inserted from the tail part of the active page linked list;
step S520, determining the page frame number of the page to be inserted;
step S530, inserting the page to be inserted into the inactive page linked list according to the sequence of the page frame numbers of the page to be inserted;
in step S540, when the preset condition for releasing the memory is satisfied, the inactive page is released from the head or the tail of the inactive page linked list.
To sum up, in the present exemplary embodiment, at least one page to be inserted is determined from occupied memory pages; inserting the page to be inserted into the inactive page linked list according to the page frame number of the page to be inserted; and determining the release sequence of the inactive pages in the inactive page linked list based on the inactive page linked list. On one hand, the exemplary embodiment provides a memory page management method, which inserts a page to be inserted into an inactive page linked list according to a page frame number, so that the inserted memory page has a uniform rule, and management of the memory page is facilitated; on the other hand, because the memory pages in the inactive page linked list are inserted according to the page frame number, the system can integrate the idle memory pages based on the page frame number, thereby effectively reducing the fragmentation probability of the system memory and improving the problem of high delay times of the system due to fragmentation; on the other hand, further, the release sequence of the inactive pages in the inactive page linked list is determined based on the inactive page linked list, and due to the fact that the problem of fragmentation of a system memory is solved, the system can load a large file after the memory pages are recycled, and therefore the use efficiency of the memory is improved.
The exemplary embodiment of the present disclosure also provides a memory page management device. As shown in fig. 6, the memory page management apparatus 600 may include: a page determining module 610, configured to determine at least one page to be inserted from occupied memory pages; the page inserting module 620 is configured to insert the page to be inserted into the inactive page linked list according to the page frame number of the page to be inserted; an order determining module 630, configured to determine a release order of the inactive pages in the inactive page linked list based on the inactive page linked list.
In an exemplary embodiment, the page determination module includes: and the page to be inserted acquiring unit is used for acquiring at least one page to be inserted from the tail part of the active page linked list.
In an exemplary embodiment, the to-be-inserted page obtaining unit is configured to obtain at least one to-be-inserted page from a tail of the active page linked list when the number of active pages in the active page linked list reaches a first threshold and a new active page is inserted into the active page linked list.
In an exemplary embodiment, a memory page management apparatus includes: and the judging module is used for releasing the inactive page from the head or the tail of the inactive page linked list when the preset condition of releasing the memory is met.
In an exemplary embodiment, the preset condition includes any one of: the number of inactive pages in the inactive page linked list reaches a second threshold value; the memory occupancy in the system reaches a third threshold.
In an exemplary embodiment, the page insertion module includes: the page searching unit is used for searching a group of adjacent inactive pages in the inactive page linked list, so that the number of one page frame is larger than that of the page to be inserted, and the number of the other page frame is smaller than that of the page to be inserted; and the page inserting unit is used for inserting the page to be inserted into the searched adjacent inactive pages in the inactive page linked list.
In an exemplary embodiment, the memory pages are cache pages.
The specific details of each module in the above apparatus have been described in detail in the method section, and details that are not disclosed may refer to the method section, and thus are not described again.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
Exemplary embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product including program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the "exemplary methods" section above of this specification, when the program product is run on the terminal device, for example, any one or more of the steps in fig. 3, fig. 4 or fig. 5 may be performed.
Exemplary embodiments of the present disclosure also provide a program product for implementing the above method, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is to be limited only by the following claims.

Claims (10)

1. A memory page management method is characterized by comprising the following steps:
determining at least one page to be inserted from occupied memory pages;
inserting the page to be inserted into an inactive page linked list according to the page frame number of the page to be inserted;
and determining the release sequence of the inactive pages in the inactive page linked list based on the inactive page linked list.
2. The method of claim 1, wherein determining at least one page to be inserted from the occupied memory pages comprises:
and acquiring at least one page to be inserted from the tail part of the active page linked list.
3. The method of claim 2, wherein the obtaining at least one page to be inserted from the tail of the active page link list comprises:
and when the number of active pages in the active page linked list reaches a first threshold value and a new active page is inserted into the active page linked list, acquiring the at least one page to be inserted from the tail part of the active page linked list.
4. The method of claim 1, further comprising:
and when the preset condition of releasing the memory is met, releasing the inactive page from the head or the tail of the inactive page linked list.
5. The method according to claim 4, wherein the preset condition comprises any one of:
the number of inactive pages in the inactive page linked list reaches a second threshold value;
the memory occupancy in the system reaches a third threshold.
6. The method according to claim 1, wherein the inserting the page to be inserted into the inactive page linked list according to the page frame number of the page to be inserted comprises:
Searching a group of adjacent inactive pages in the inactive page linked list, and enabling the page frame number of one of the adjacent inactive pages to be larger than the page frame number of the page to be inserted, and enabling the page frame number of the other adjacent inactive page to be smaller than the page frame number of the page to be inserted;
and inserting the page to be inserted into the searched adjacent inactive pages in the inactive page linked list.
7. The method of claim 1, wherein the memory page is a cache page.
8. A memory page management apparatus, comprising:
the page determining module is used for determining at least one page to be inserted from the occupied memory pages;
the page inserting module is used for inserting the page to be inserted into the inactive page linked list according to the page frame number of the page to be inserted;
and the order determining module is used for determining the release order of the inactive pages in the inactive page linked list based on the inactive page linked list.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1 to 7.
10. An electronic device, comprising:
A processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1 to 7 via execution of the executable instructions.
CN202010670002.7A 2020-07-13 2020-07-13 Memory page management method, memory page management device, medium and electronic equipment Active CN111858393B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010670002.7A CN111858393B (en) 2020-07-13 2020-07-13 Memory page management method, memory page management device, medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010670002.7A CN111858393B (en) 2020-07-13 2020-07-13 Memory page management method, memory page management device, medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN111858393A true CN111858393A (en) 2020-10-30
CN111858393B CN111858393B (en) 2023-06-02

Family

ID=72984779

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010670002.7A Active CN111858393B (en) 2020-07-13 2020-07-13 Memory page management method, memory page management device, medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111858393B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256997A (en) * 2020-11-11 2021-01-22 Oppo广东移动通信有限公司 Page management method, page management device, storage medium and electronic equipment
CN116049024A (en) * 2023-01-06 2023-05-02 广州匠芯创科技有限公司 Memory page recycling optimization method and system, electronic equipment and storage medium thereof

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2192493A1 (en) * 2008-11-28 2010-06-02 ST Wireless SA Method of paging on demand for virtual memory management in a processing system, and corresponding processing system
CN106168926A (en) * 2016-05-20 2016-11-30 朱宗卫 Memory allocation method based on linux buddy system
WO2016187974A1 (en) * 2015-05-25 2016-12-01 中兴通讯股份有限公司 Storage space management method and apparatus
CN107885666A (en) * 2016-09-28 2018-04-06 华为技术有限公司 A kind of EMS memory management process and device
CN108205475A (en) * 2017-08-25 2018-06-26 珠海市魅族科技有限公司 EMS memory management process, terminal device, computer installation and readable storage medium storing program for executing
CN109508301A (en) * 2017-09-14 2019-03-22 中国移动通信集团重庆有限公司 Terminal, using the processing method of data, data processing equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2192493A1 (en) * 2008-11-28 2010-06-02 ST Wireless SA Method of paging on demand for virtual memory management in a processing system, and corresponding processing system
WO2016187974A1 (en) * 2015-05-25 2016-12-01 中兴通讯股份有限公司 Storage space management method and apparatus
CN106294190A (en) * 2015-05-25 2017-01-04 中兴通讯股份有限公司 A kind of memory space management and device
CN106168926A (en) * 2016-05-20 2016-11-30 朱宗卫 Memory allocation method based on linux buddy system
CN107885666A (en) * 2016-09-28 2018-04-06 华为技术有限公司 A kind of EMS memory management process and device
CN108205475A (en) * 2017-08-25 2018-06-26 珠海市魅族科技有限公司 EMS memory management process, terminal device, computer installation and readable storage medium storing program for executing
CN109508301A (en) * 2017-09-14 2019-03-22 中国移动通信集团重庆有限公司 Terminal, using the processing method of data, data processing equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
肖竟华等: "Linux内存管理实现的分析与研究", 《计算机技术与发展》 *
陈俊熹等: "混合内存页面管理策略的性能和能耗研究", 《现代计算机(专业版)》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256997A (en) * 2020-11-11 2021-01-22 Oppo广东移动通信有限公司 Page management method, page management device, storage medium and electronic equipment
CN116049024A (en) * 2023-01-06 2023-05-02 广州匠芯创科技有限公司 Memory page recycling optimization method and system, electronic equipment and storage medium thereof

Also Published As

Publication number Publication date
CN111858393B (en) 2023-06-02

Similar Documents

Publication Publication Date Title
CN109254733B (en) Method, device and system for storing data
US8972690B2 (en) Methods and apparatuses for usage based allocation block size tuning
US9177028B2 (en) Deduplicating storage with enhanced frequent-block detection
CN109857556B (en) Memory recovery method and device, storage medium and electronic equipment
CN110109915B (en) Method, apparatus and computer program product for managing hash tables
US11586388B2 (en) Method, device, and computer program product for managing storage system
CN112632069B (en) Hash table data storage management method, device, medium and electronic equipment
US11113195B2 (en) Method, device and computer program product for cache-based index mapping and data access
CN111124270B (en) Method, apparatus and computer program product for cache management
CN110543435B (en) Mixed mapping operation method, device and equipment of storage unit and storage medium
CN110837480A (en) Processing method and device of cache data, computer storage medium and electronic equipment
CN111858393B (en) Memory page management method, memory page management device, medium and electronic equipment
CN111143113A (en) Method, electronic device and computer program product for copying metadata
CN113609090B (en) Data storage method and device, computer readable storage medium and electronic equipment
CN111488316B (en) File cache recovery method and device
CN113553216A (en) Data recovery method and device, electronic equipment and storage medium
CN111930684A (en) Small file processing method, device and equipment based on HDFS (Hadoop distributed File System) and storage medium
CN111694806A (en) Transaction log caching method, device, equipment and storage medium
US20200349186A1 (en) Method, apparatus and computer program product for managing metadata of storage object
CN114781322B (en) Memory state recovery method for MMU-free environment in CPU chip simulation acceleration
CN112256997A (en) Page management method, page management device, storage medium and electronic equipment
CN115712388A (en) Data storage method, device and equipment of solid-state disk and storage medium
CN112395141B (en) Data page management method and device, electronic equipment and storage medium
CN109815194B (en) Indexing method, indexing device, computer readable storage medium, and electronic apparatus
US11385967B2 (en) Method for managing backup data by having space recycling operations on executed backup data blocks

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant