Reading and writing method of solid state hard disk and computer readable storage medium

By introducing virtual memory page space and decentralized memory page allocator into the operating system kernel module, the correspondence between solid-state drive pages and physical memory pages is established, and the problem that the existing page table management mechanism cannot fully utilize the performance of NVMe solid-state drives is achieved, and efficient solid-state drive read and write operations and DBMS performance improvements are achieved.

CN119200962BActive Publication Date: 2025-05-16BERGMEIS (SHENZHEN) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411157152.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-22
Publication Date
2025-05-16
Estimated Expiration
2044-08-22

AI Technical Summary

Technical Problem

The existing page table management mechanism cannot fully utilize the performance of modern NVMe solid-state drives in dealing with high I/O throughput scenarios, resulting in page table operations becoming a performance bottleneck, and DBMS loses control over page missing and elimination, affecting transaction security and performance optimization.

Method used

A method of reading and writing for solid-state drives is introduced. By maintaining a continuous virtual memory page space and a decentralized memory page allocator in the operating system kernel module, the correspondence between the solid-state drive page and the physical memory page is established to achieve efficient read and write operations.

Benefits of technology

It improves the read and write efficiency of solid-state drives, ensures that DBMS performance improves several times when the data load does not exceed the memory capacity, and the performance declines smoothly when the data load exceeds the memory capacity. After stability, the performance improvement compared with the existing solutions is more obvious.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119200962B_ABST
    Figure CN119200962B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a method for reading and writing a solid-state hard disk and a computer-readable storage medium. The method is applied to a read-write module in a kernel module of an operating system; the read-write module is used to maintain a continuous virtual memory page space and a distributed memory page allocator, the virtual memory page space is composed of multiple virtual memory pages, and each virtual memory page corresponds to a solid-state hard disk page one by one; the distributed memory page allocator is composed of several working threads, and each working thread manages a local memory pool composed of physical memory pages; the method includes the following steps: parsing the obtained read-write instructions to determine the target data to be processed and the read-write requirements; locating the corresponding virtual memory page and physical memory page according to the target data address; processing the target data in the solid-state hard disk page and / or physical memory page according to the read-write requirements to complete the read-write operation of the target data. The present application can improve the read-write efficiency of solid-state hard disk files.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of operating systems, and in particular, relates to a reading and writing method for a solid state hard disk and a computer-readable storage medium. Background Art

[0002] The task of a database management system (DBMS) is to process massive amounts of data, which often exceeds the storage capacity of computer memory. Therefore, DBMS must store data on hard disks with larger storage capacity but relatively slow access speeds. Fortunately, with the development of technology, solid-state drives (SSDs) based on the NVMe protocol have significantly improved performance, providing millions of input and output operations per second (IOPS) and microsecond read and write latency, and the cost is gradually decreasing. This gives DBMS a new option: using NVMe SSDs as an extension of memory. At the same time, with the increasing memory capacity of database servers and the good locality shown by database workloads, more and more data operations can be completed efficiently in memory. The Linux operating system introduces the mmap mechanism, which can use NVMe SSDs as memory. mmap maps files or storage devices to the virtual address space of a process. When a process accesses a mapped address, if the data is not in physical memory, a page miss is triggered. The operating system is responsible for loading the missing page from the storage device into physical memory and updating the page table so that subsequent access can be performed quickly. The Linux operating system encapsulates mmap into an operating system call, which is simple and easy to use, without the need to write complex page management code. In addition, mmap uses the TLB to speed up the conversion of the process's virtual address to the physical memory address. When the cache hits, the access speed of the solid-state drive is as fast as that of ordinary memory access.

[0003] However, after DBMS adopts the mmap mechanism, it will lose control over page missing and elimination, and cannot guarantee transaction security, nor can it implement the DBMS optimized page replacement algorithm. In addition, mmap lacks an asynchronous I / O interface, which leads to unpredictable I / O stagnation and complex I / O error handling. A more serious problem is that Linux's virtual memory implementation cannot fully utilize the performance of modern NVMe solid-state drives, especially in scenarios with high I / O throughput, where page table operations become a performance bottleneck. Existing page table management mechanisms have obvious drawbacks when dealing with workloads with high page turnover rates. How to improve the efficiency of file reading and writing in solid-state drives is a technical problem that needs to be urgently solved by those skilled in the art.

[0004] The preceding description is intended to provide general background information and does not necessarily constitute prior art. Summary of the invention

[0005] Based on this, it is necessary to propose a solid state drive reading and writing method and a computer-readable storage medium to address the above problems, which can improve the file reading and writing efficiency in the solid state drive.

[0006] The present application solves the technical problem by adopting the following technical solutions:

[0007] The present application provides a method for reading and writing a solid-state hard disk, which is applied to a read-write module, and the read-write module is a kernel module of an operating system; the operating system manages the solid-state hard disk and the physical memory, and the solid-state hard disk is configured to store data together with the physical memory; the storage space of the solid-state hard disk is composed of multiple solid-state hard disk pages; the read-write module maintains a continuous virtual memory page space, and the virtual memory page space is composed of multiple virtual memory pages, and each virtual memory page corresponds to a solid-state hard disk page one by one and has the same size; the read-write module also maintains a distributed memory page allocator with a preset number of working threads, and each working thread manages a local memory pool composed of physical memory pages; the size of each physical memory page is consistent with the size of each virtual memory page; all physical memory The pages are all non-overlapping blocks of physical memory; the read / write module configures each virtual memory page with 4 Boolean status bits, and the Boolean status bits include ejected / non-ejected, locked / unlocked, dirty / non-dirty, and discardable / non-discardable; the method includes the following steps: when a read / write instruction is obtained, the read / write instruction is parsed to determine the target data to be processed and the read / write requirements, and the read / write requirements include read requirements and write requirements; the corresponding solid state disk page is located according to the target data address of the target data, and the corresponding virtual memory page and the corresponding physical memory page are determined according to the solid state disk page; the target data in the solid state disk page and / or the physical memory page are processed according to the read / write requirements to complete the read and write operations of the target data, and the read and write operations include configuring the Boolean status bits of the virtual memory page.

[0008] In an optional embodiment of the present application, the read requirement is to read the target data from the solid-state drive and write it into the physical memory; when the read / write requirement is a read requirement, the target data content of the target data is stored in the solid-state drive; the target data in the solid-state drive page and / or the physical memory page is processed according to the read / write requirements to complete the read and write operations of the target data, including: obtaining the target data content in the solid-state drive page; writing the target data content into the corresponding physical memory page, and calling the physical memory page into which the target data content is written the first physical memory page; and returning to the first physical memory page.

[0009] In an optional embodiment of the present application, the write requirement is to write the target data in the physical memory page to the specified solid-state hard disk page; when the read / write requirement is a write requirement, the target data content of the target data is stored in the physical memory; the target data in the solid-state hard disk page and / or the physical memory page is processed according to the read / write requirements to complete the read and write operations of the target data, including: obtaining the target data content, copying the target data content to the corresponding physical memory page; setting the Boolean status bit of the corresponding virtual memory page to a dirty state.

[0010] In an optional embodiment of the present application, the data address of each solid-state hard disk page is called the solid-state hard disk page address, the data address of each virtual memory page is called the virtual memory page address, and the data address of each physical memory page is called the physical memory page address; the read-write module stores a first page table and a second page table; the first page table is maintained by the operating system, and the first page table is used to implement a first conversion, and the first conversion is a conversion between the solid-state hard disk page address and the virtual memory page address; the solid-state hard disk page address and the virtual memory page address have a one-to-one correspondence; the second page table is maintained by the read-write module, and the second page table is used to implement a second conversion, and the second conversion is a conversion between the virtual memory page address and the physical memory page address, and the second conversion uses the cache of the CPU core of the operating system to improve the conversion efficiency, and the cache buffer is used to store the mapping information from the virtual address to the physical address; the physical memory page set is a subset of the virtual memory page set; according to the solid The method comprises: performing a first conversion on a solid-state hard disk page address according to a first page table to determine the corresponding virtual memory page; judging a Boolean state bit of the virtual memory page; when the Boolean state bit is in an ejected state, triggering a page fault interrupt, blocking the current thread, and starting an interrupt service process, wherein the interrupt service process is used to obtain an idle physical memory page to build a mapping relationship with the virtual memory page; when the Boolean state bit is in a non-ejected state, after waiting for the Boolean state bit of the virtual memory page to enter an unlocked state, performing a second conversion on the virtual memory page address according to a second page table to determine the physical memory page corresponding to the virtual memory page; if the corresponding physical memory page can be found, setting the Boolean state bit of the virtual memory page to a non-discardable state, and returning the physical memory page; if the corresponding physical memory page cannot be found, triggering a page fault interrupt, blocking the current thread, and starting the interrupt service process.

[0011] In an optional embodiment of the present application, the interrupt service process includes: determining whether there is a physical memory page that meets the preset free condition in the local memory pool governed by the working thread corresponding to the virtual memory page; if there is a physical memory page that meets the preset free condition in the local memory pool governed by the corresponding working thread, marking the physical memory page that meets the preset free condition as an idle physical memory page; performing mapping and wake-up operations on the idle physical memory page and the virtual memory page; if there is no physical memory page that meets the preset free condition in the local memory pool governed by the corresponding working thread, starting a stealing operation to steal a idle physical memory page from the remaining working threads in the distributed memory page allocator; performing mapping and wake-up operations on the idle physical memory page and the virtual memory page.

[0012] In an optional embodiment of the present application, the stealing operation includes: determining whether there are physical memory pages with preset free conditions in the local memory pool governed by the remaining working threads; if there are physical memory pages that meet the preset free conditions in the local memory pool governed by the remaining working threads, randomly selecting a physical memory page and marking it as a free physical memory page, and moving the free physical memory page to the local memory pool governed by the corresponding working thread; performing mapping and wake-up operations on the free physical memory pages and virtual memory pages; if there are no physical memory pages that meet the preset free conditions in the local memory pool governed by the remaining working threads, starting a batch elimination operation to eliminate a preset number of physical memory pages in the local memory pool governed by the corresponding working thread, and randomly selecting a physical memory page marked as a free physical memory page from the eliminated physical memory pages; performing mapping and wake-up operations on the free physical memory pages and virtual memory pages.

[0013] In an optional embodiment of the present application, a batch elimination operation includes: obtaining physical memory pages that meet the elimination conditions from the physical memory, the elimination conditions include a preset idle condition, and the Boolean status bit of the virtual memory page corresponding to the physical memory page is in a discardable state; using the operating system to eliminate the physical memory pages that meet the elimination conditions in batches, marking the eliminated physical memory pages as eliminated physical memory pages; marking the virtual memory pages corresponding to the eliminated physical memory pages as eliminated virtual memory pages; setting the Boolean status bit of the eliminated virtual memory page to an ejected state; mapping the eliminated virtual memory page to a preset fixed read-only physical memory page that has been pre-filled in the cache buffer in the second page table; if the Boolean status bit of the eliminated virtual memory page is in a dirty state, setting the Boolean status bit of the eliminated virtual memory page to a locked state, and after writing the data in the eliminated physical memory page to the corresponding solid-state hard disk page, restoring the Boolean status bit of the eliminated virtual memory page to an unlocked state and a non-dirty state.

[0014] In an optional embodiment of the present application, the mapping and wake-up operations include: establishing a mapping relationship between free physical memory pages and virtual memory pages in the second page table and the cache buffer; waking up the blocked current thread, setting the Boolean status bit of the virtual memory page to a non-eviction state and a non-discardable state, and returning the free physical memory page.

[0015] In an optional embodiment of the present application, the Boolean status bit of the virtual memory page is configured, including: if an initialization instruction is obtained, the Boolean status bit of the virtual memory page is configured to be evicted, unlocked, non-dirty and discardable; if the virtual memory page has a corresponding physical memory page, the virtual memory page is in a non-evicted state, otherwise it is in an evicted state; if the data of the physical memory page corresponding to the virtual memory page is being written to the solid-state hard disk page, the virtual memory page is in a locked state, otherwise it is in an unlocked state; if the data of the physical memory page corresponding to the virtual memory page is updated but not written to the solid-state hard disk page, the virtual memory page is in a dirty state, otherwise it is in a non-dirty state; if the data of the physical memory page corresponding to the virtual memory page has been read within a preset period, the virtual memory page is in a non-discardable state, otherwise it is in a discardable state.

[0016] The present application also provides a computer-readable storage medium storing a computer program, which implements the aforementioned method when the computer program is executed by a processor.

[0017] The embodiments of the present application have the following beneficial effects:

[0018] This application adds a read-write module in the kernel module of the operating system, which is used to maintain a continuous virtual memory page space, which corresponds to the solid-state hard disk page managed by the operating system one by one and has the same size, and maintains a distributed memory page distributor with a preset number of working threads, each of which manages a local memory pool composed of physical memory pages, and the size of each physical memory page is consistent with the size of each virtual memory page. When the read-write module reads and writes to the solid-state hard disk, it uses the virtual memory page as an intermediary to establish a corresponding relationship between the solid-state hard disk page involved in the read-write operation and the physical memory page governed by the distributed memory page distributor, and converts the read-write operation for the solid-state hard disk page into the read-write operation for the physical memory page, thereby improving the read-write efficiency of the solid-state hard disk. The above method can ensure that the DBMS achieves several times the performance improvement when the data load does not exceed the memory capacity; even when the data load exceeds the memory capacity, the performance degradation is gentle, and the performance improvement relative to the existing solution is more obvious after stabilization.

[0019] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented according to the contents of the specification, and in order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the following preferred embodiments are specifically cited and described in detail with the accompanying drawings. It should be understood that the above general description and the detailed description below are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0021] in:

[0022] Figure 1 A flowchart of a method for reading and writing a solid state hard disk provided by an embodiment;

[0023] Figure 2 A schematic diagram of the composition principle of a read / write module provided by an embodiment;

[0024] Figure 3 A schematic diagram of a page location process provided by an embodiment;

[0025] Figure 4 A schematic diagram of an interrupt service process flow diagram provided by an embodiment;

[0026] Figure 5 A schematic diagram of a stealing operation flow provided by an embodiment;

[0027] Figure 6 A schematic diagram of a batch elimination operation process provided by an embodiment;

[0028] Figure 7 A schematic diagram of a mapping and wake-up operation flow provided by an embodiment. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0030] Existing computer equipment often needs to process a large amount of data in a short time, especially for workstations or server-type computers. For example, for computer equipment equipped with a database management system (DBMS), its task is to process massive data, which often exceeds the storage capacity of the computer memory. Therefore, DBMS must store data on hard disks with larger storage capacity but relatively slow access speeds. Fortunately, with the development of technology, solid-state drives (SSDs) based on the NVMe protocol have significantly improved performance, providing millions of input and output operations per second (IOPS) and microsecond read and write delays, and the cost is gradually decreasing. This gives DBMS a new option: using NVMe solid-state drives as an extension of memory. At the same time, with the continuous increase in the memory capacity of database servers and the good locality shown by database workloads, more and more data operations can be efficiently completed in memory.

[0031] The Linux operating system introduces the mmap mechanism (Memory Map), which can use NVMe SSDs as memory. mmap maps files or storage devices to the virtual address space of the process. When the process accesses the mapped address, if the data is not in the physical memory, a page miss is triggered. The operating system is responsible for loading the missing page from the storage device into the physical memory and updating the page table so that subsequent access can be performed quickly. The Linux operating system encapsulates mmap into an operating system call, which is simple and easy to use, without the need to write complex page management code. In addition, mmap uses the Translation Lookaside Buffer (TLB) to speed up the conversion operation from the virtual address of the process to the physical memory address. When the cache hits, the access speed of the SSD is as fast as that of ordinary memory access. However, after the DBMS adopts the mmap mechanism, it will lose control of page misses and eliminations, cannot guarantee transaction security, and cannot implement the DBMS optimized page replacement algorithm. In addition, mmap lacks an asynchronous I / O interface, resulting in unpredictable I / O stagnation and complex I / O error handling.

[0032] A more serious problem is that Linux's virtual memory implementation cannot fully utilize the performance of modern NVMe SSDs, especially in scenarios with high I / O throughput, where page table operations become a performance bottleneck. The existing page table management mechanism has obvious drawbacks when dealing with workloads with high page turnover rates. First, in a multi-core CPU system, each core has an independent TLB cache to store virtual address to physical address mapping information. When one core modifies the page table, the TLB caches in other cores may contain outdated mapping information. At this time, Linux will ensure cache consistency through TLB invalidation broadcast (shootdown), which will trigger an inter-processor interrupt (IPI), causing all other cores to clear their TLBs. Second, Linux uses a centralized page allocator, and all threads share the same page pool, resulting in contention and latency. In addition, for security reasons, Linux also needs to zero the page when allocating it, further reducing efficiency.

[0033] To solve the above problems, the present application provides a method for reading and writing a solid state hard disk. Figure 1 to Figure 7 , including steps S110 to S130.

[0034] First of all, it should be noted that the method provided in this application is applied to the read-write module. In this application, the read-write module is called BrightMap, which is a kernel module of the operating system (such as the Linux system). By introducing a new kernel-level API, fast and scalable page table operations are achieved, thereby solving the performance problems of TLB invalidation broadcast and virtual memory page allocation. For the schematic diagram of the composition principle of the read-write module, please refer to Figure 2 .like Figure 2 As shown, the operating system where the read / write module is located manages the solid-state drive and the physical memory. The solid-state drive is configured to store data together with the physical memory. The storage space of the solid-state drive consists of multiple solid-state drive pages; the read / write module maintains a continuous virtual memory page space, which consists of multiple virtual memory pages, and as shown Figure 2 As shown, each virtual memory page corresponds to a solid state drive page one by one and has the same size.

[0035] In addition, the read / write module maintains a distributed memory page allocator with a preset number of worker threads. Each worker thread manages a local memory pool consisting of physical memory pages. The size of each physical memory page is the same as the size of each virtual memory page. All physical memory pages are non-overlapping blocks of physical memory. Also refer to Figure 2It can be seen that the number of physical memory pages in the local memory pools is not consistent. In fact, in the implementation of the present application, the number of physical memory pages owned by the local memory pool is given at the time of initialization, but in the subsequent process, because the method provided by the present application has a stealing operation, the physical memory pages in the local memory pool will be switched between each other, resulting in a change in the number of physical memory pages in the local memory pool, resulting in a situation where the number of physical memory pages in the local memory pools is different from each other. The specific implementation process of the stealing operation will be expanded in the following text, and will not be repeated here.

[0036] Furthermore, each virtual memory page is configured with 4 Boolean status bits by the read / write module, including evicted / non-evicted, locked / unlocked, dirty / non-dirty, and discardable / non-discardable. It is worth noting that each Boolean status bit is independent of each other; however, in actual processes, according to actual needs, all state combinations of virtual memory pages are not unlimited, that is, in actual use, Boolean status bits can affect each other. The specific configuration method will be described in detail in the configuration process later, and will not be expanded here for the time being.

[0037] Step S110: when the read / write instruction is obtained, the read / write instruction is parsed to determine the target data to be processed and the read / write requirements, where the read / write requirements include a read requirement and a write requirement.

[0038] In one embodiment, when the system receives a read / write instruction, it indicates that the corresponding data needs to be processed, and the read / write instruction needs to be parsed to determine the target data and the read / write requirements. The first thing to be clear is that the target data is the data to be processed, which may include data content and / or data address, which will be described in detail in the actual processing process later.

[0039] The second is to understand the read and write requirements, which include read requirements and write requirements, which have different requirements and meanings. In this embodiment: the read requirement can be to read the target data from the SSD and write it to the physical memory; the write requirement can be to write the target data in the physical memory page to the specified SSD page.

[0040] Step S120: locating a corresponding solid state disk page according to the target data address of the target data, and determining a corresponding virtual memory page and a corresponding physical memory page according to the solid state disk page.

[0041] In one embodiment, to read and write target data, the first step is to locate the page where the target data is located. The data address of each SSD page is called the SSD page address, the data address of each virtual memory page is called the virtual memory page address, and the data address of each physical memory page is called the physical memory page address.

[0042] Therefore, when reading and writing the target data of the solid-state drive, the read-write module can use two page tables to map the target data address of the real target data to the physical memory address. The read-write module stores a first page table and a second page table. The first page table is maintained by the operating system, and the first page table is used to implement the first conversion, which is the conversion between the solid-state drive page address and the virtual memory page address. And refer to the above and Figure 2 As shown in the schematic diagram, the SSD page address corresponds to the virtual memory page address one by one, and further, the SSD page and the corresponding virtual memory page also meet the condition of being the same size.

[0043] The second page table is maintained by the read / write module. The second page table is used to implement the second conversion. The second conversion is the conversion between the virtual memory page address and the physical memory page address. The second conversion uses the fast table buffer (TLB) cache of the CPU core of the operating system to accelerate the conversion operation from the virtual memory address to the physical memory address, thereby improving the conversion efficiency. The fast table buffer is used to store the mapping information from the virtual address to the physical address. Furthermore, the virtual memory page and the corresponding physical memory page also meet the condition of the same size. Reference Figure 2 It can be seen that the physical memory page set is a subset of the virtual memory page set, so the virtual memory page address may not be directly converted to the physical memory page address. At this time, the operating system's page fault interrupt will be triggered, blocking the current thread from running, and starting the interrupt service process to allocate the physical memory page corresponding to the virtual memory page for subsequent processing. This will be described in detail later.

[0044] For ease of explanation, Figure 3 It demonstrates how the solid-state drive reading and writing method provided in this application can quickly determine the mapping relationship between the solid-state drive memory pages, virtual memory pages and physical memory pages. Figure 3 This is a schematic diagram of a page positioning process, including steps S310 to S360.

[0045] Step S310: performing a first conversion on the solid state disk page address according to the first page table to determine the corresponding virtual memory page.

[0046] In one embodiment, a first page table maintained by an operating system is used to convert a solid state disk page address where target data is located to a virtual memory page address, thereby determining a corresponding virtual memory page.

[0047] Step S320: Determine the Boolean status bit of the virtual memory page.

[0048] When the Boolean state bit is in the ejection state, step S330 is executed: starting the interrupt service process.

[0049] In one embodiment, as described above, each virtual memory page is configured with 4 independent Boolean status bits by the read / write module. In this step, it is mainly determined whether the Boolean status bit of the virtual memory page is in an ejected state. The ejected state corresponds to the situation that there is no corresponding physical memory page for the virtual memory page; the non-ejected state, that is, the virtual memory page has a corresponding physical memory page. Whether there is a corresponding physical memory page can be determined by the second page table, and there is no restriction on this.

[0050] It is understandable that if the virtual memory page does not have a corresponding physical memory page, the corresponding target data cannot be copied and placed in the physical memory, that is, the computer cannot directly read the data in the end, resulting in a processing error. For this reason, it is necessary to set the virtual memory page so that it has a corresponding physical memory page to facilitate the execution of subsequent steps. Therefore, when the Boolean state bit is in the ejected state, step S330 is executed: start the interrupt service process, that is, trigger the page fault interrupt, block the current thread, and obtain the idle physical memory page to build a mapping relationship with the virtual memory page. The specific process of the interrupt service process will be specifically expanded in the following text and will not be explained here for the time being.

[0051] When the Boolean state bit is in the non-evicted state, step S340 is executed: after waiting for the Boolean state bit of the virtual memory page to enter the unlocked state, a second conversion is performed on the virtual memory page address according to the second page table to determine the physical memory page corresponding to the virtual memory page.

[0052] In one embodiment, if the virtual memory page is in a non-evicted state, that is, it is determined that the virtual memory page has a corresponding physical memory page, then after waiting for the Boolean state bit of the virtual memory page to enter an unlocked state, a second conversion is performed on the virtual memory page address according to the second page table to specifically determine the physical memory page corresponding to the virtual memory page. The unlocked state means that the physical memory page corresponding to the virtual memory page is not being written to a file. Further, during the execution of the second conversion process, the read-write module can use the TLB cache of the CPU core to accelerate the conversion operation from the virtual memory address to the physical memory address.

[0053] Step S350: Determine whether the physical memory page corresponding to the virtual memory page can be found.

[0054] If the corresponding physical memory page can be found, step S360 is executed: the Boolean state bit of the virtual memory page is set to a non-discardable state, and the physical memory page is returned.

[0055] If the corresponding physical memory page cannot be found, execute step S330.

[0056] In one embodiment, if the corresponding physical memory page can be found, the Boolean state bit of the virtual memory page can be set to a non-discardable state, and the non-discardable state is specifically used to indicate that the data of the physical memory page corresponding to the virtual memory page has been read recently. Similarly, if the corresponding physical memory page cannot be found, return to S330 to try to redetermine the mapping relationship between the virtual memory page and the physical memory page, so that the data can be copied to the physical memory for easy reading and processing by the computer.

[0057] In one implementation, in order to clearly explain the interrupt service process, please refer to Figure 2 and Figure 4 ,in Figure 4 It is a flowchart of the interrupt service process, including steps S410 to S430.

[0058] In one embodiment, referring to the above description and Figure 2 It can be seen that the read-write module also maintains a distributed memory page allocator. The distributed memory page allocator has multiple working threads, each of which has its own control interface and manages a local memory pool. The local memory pool is composed of physical memory pages. The number of physical memory pages in each memory pool is given according to an arbitrary preset number when the distributed memory page allocator is initialized, and can be changed during operation through stealing operations. For example, Figure 2 As shown, the number of physical memory pages in each local memory pool can be different during operation. The introduction of local memory pools avoids dependence on the kernel global allocator and reduces lock contention during memory allocation; in addition, the physical memory pages in the local memory pool are only managed within the same process, and do not share pages with other processes. There is no risk of leaking sensitive data to other processes. Therefore, the physical pages in the local memory pool only need to be cleared once when the memory pool is created, and will not be cleared repeatedly later, thereby reducing the overhead of memory operations and improving the efficiency of virtual memory management. The physical memory pages in the local memory pool are organized and managed in the form of a bidirectional linked list, which is only one of the feasible organizational methods. The use of other organizational methods such as one-way linked lists, stacks, directed graphs, and undirected graphs should not be considered to exceed the technical scope protected by this application.

[0059] Step S410: Determine whether there is a physical memory page with a preset free condition in the local memory pool managed by the working thread corresponding to the virtual memory page.

[0060] In one embodiment, the preset idle condition can be determined according to the size of the target data. For example, the target data needs to occupy three physical memory pages, so the idle condition is that there are at least three blank physical memory pages in the local memory pool. The specific setting conditions can be set arbitrarily according to actual needs and are not limited here.

[0061] If so, execute step S420: mark the physical memory page that meets the preset idle condition as an idle physical memory page; perform mapping and wake-up operations on the idle physical memory page and the virtual memory page.

[0062] If not, execute step S430: start the stealing operation, randomly steal a free physical memory page from the remaining working threads in the distributed memory page allocator; perform mapping and wake-up operations on the free physical memory page and virtual memory page.

[0063] In one embodiment, if there are physical memory pages that meet the preset idle conditions in the local memory pool governed by the corresponding working thread, the physical memory pages that meet the preset idle conditions can be directly marked as idle physical memory pages and returned. This allows the idle physical memory pages to establish a mapping relationship with the virtual memory pages, and the specific construction process requires the execution of mapping and wake-up operations. The mapping and wake-up operations will appear again after this step, so the specific implementation process of the operation will be specifically expanded in the following text and will not be repeated here.

[0064] On the contrary, if there is no physical memory page with preset free conditions in the local memory pool governed by the working thread corresponding to the virtual memory page, that is, the existing free pages cannot meet the corresponding processing requirements, a stealing operation can be performed to randomly steal a free physical memory page from the remaining working threads in the distributed memory page allocator for performing mapping and wake-up operations.

[0065] For the specific execution process of the stealing operation, please refer to Figure 5 , including steps S510 to S530.

[0066] Step S510: Determine whether there are physical memory pages with preset free conditions in the local memory pools managed by the remaining working threads.

[0067] In one embodiment, the judgment process of step S510 can refer to S410, and the judgment conditions can be the same. The difference is that the judgment object is changed from the local memory pool governed by the working thread corresponding to the virtual memory page to the local memory pool governed by the other working threads.

[0068] If so, execute step S520: randomly select a physical memory page and mark it as a free physical memory page, and move the free physical memory page to the local memory pool governed by the corresponding working thread; perform mapping and wake-up operations on the free physical memory page and virtual memory page.

[0069] In one embodiment, if there are physical memory pages that meet the preset free condition in the remaining memory pools, then they can be randomly selected from the physical memory pages that meet the preset free condition and marked as free physical memory pages. The free physical memory pages are migrated from the local memory pool where they were originally located to the local memory pool governed by the working thread corresponding to the virtual memory page. Similar to step S420, mapping and waking operations are performed on the free physical memory pages and the virtual memory pages, thereby constructing a mapping relationship between the free physical memory pages and the virtual memory pages and returning it, so that the computer can perform subsequent operations.

[0070] If it does not exist, execute step S530: start a batch elimination operation to eliminate a preset number of physical memory pages in the local memory pool governed by the corresponding working thread, and randomly select a physical memory page marked as free from the eliminated physical memory pages; perform mapping and wake-up operations on the free physical memory pages and virtual memory pages.

[0071] In one embodiment, if there are no physical memory pages that meet the preset free conditions in the remaining memory pools, a batch elimination operation can be performed to free up enough physical memory pages to meet the memory allocation requirements. Multiple physical memory pages are eliminated by calling the operating system as few times as possible, thereby reducing the TLB invalidation broadcast behavior caused by page elimination. It is understandable that the physical memory pages on which the batch elimination operation is performed are blank pages, so they can be marked as free physical memory pages and returned. Further, the mapping and wake-up operations can be performed with reference to the process described above.

[0072] The present application introduces a page stealing mechanism between different local memory pools. Whether this mechanism is adopted or not will not affect the normal processing flow of the read-write module, but the adoption of this mechanism can reduce the frequency of batch elimination of physical memory pages and improve the read-write efficiency. The description of this application does not make more detailed restrictions on the page stealing mechanism, but only points out that a free physical memory page is randomly stolen from other local memory pools. Other variations may propose more detailed methods for selecting free physical memory pages, such as selecting free pages from different local memory pools with different probabilities, where the probability is proportional to the number of free pages in the local memory pool, but these methods are only specific implementations of the page stealing mechanism and should not be considered to exceed the technical scope protected by this application.

[0073] For the specific execution process of batch elimination operations, please refer to Figure 6 , including steps S610 to S650.

[0074] Step S610: obtaining a physical memory page that meets an elimination condition from the physical memory, where the elimination condition includes a preset idle condition, and the Boolean state bit of the virtual memory page corresponding to the physical memory page is in a discardable state.

[0075] In one embodiment, the elimination condition specifically includes two parts, one part is the requirement for the physical memory page, and the other part is the requirement for the virtual memory page corresponding to the physical memory page. The former corresponds to the preset idle conditions, such as the size of the space, the importance, whether it can be eliminated, etc., which can be set arbitrarily according to actual needs, and are not limited here. At the same time, it can be understood that the physical memory page may correspond to a virtual memory page, and the Boolean status bit of the virtual memory page indicates the page status, so some settings corresponding to the virtual memory page will cause the physical memory page to not be eliminated. Specifically, when the Boolean status bit of the virtual memory page corresponding to the physical memory page is a discardable state or a non-dirty state, the physical memory page can be eliminated. In the case that any physical memory page cannot be eliminated, feedback can be given to wait, or it can be directly informed that the current memory is full and cannot be operated.

[0076] Step S620: using the operating system to batch eliminate physical memory pages that meet elimination conditions, and marking the eliminated physical memory pages as eliminated physical memory pages.

[0077] Step S630: Mark the virtual memory page corresponding to the eliminated physical memory page as an eliminated virtual memory page; and set the Boolean state bit of the eliminated virtual memory page to an eviction state.

[0078] Step S640: Mapping the obsolete virtual memory page to a preset fixed read-only physical memory page that has been pre-filled in the cache buffer in the second page table.

[0079] Step S650: If the Boolean status bit of the eliminated virtual memory page is in a dirty state, the Boolean status bit of the eliminated virtual memory page is set to a locked state, and after the data in the eliminated physical memory page is written to the corresponding solid-state hard disk page, the Boolean status bit of the eliminated virtual memory page is restored to an unlocked state and a non-dirty state.

[0080] In one embodiment, for obsolete physical memory pages, as few operating system calls as possible (i.e., continuous physical memory pages use a single operating system call) can be used to mark these physical memory pages as obsolete, thereby reducing the TLB invalidation broadcast behavior caused by page elimination. For each obsolete physical memory page that is eliminated, its corresponding virtual memory page is set to an ejected state, and the obsolete virtual memory page is mapped to a preset fixed read-only physical memory page that has been pre-filled in the TLB in the second page table, and the dirty page drop process of the obsolete virtual memory page is started, that is, if the obsolete virtual memory page is in a dirty state, the current read interrupt service process first sets the obsolete virtual memory page to a locked state, and then writes the content of the obsolete physical memory page to the file page corresponding to the obsolete virtual memory page, and then restores the obsolete virtual memory page to an unlocked state and a non-dirty state.

[0081] When a page is eliminated, the page table entry is pointed to a fixed read-only physical memory page that has been pre-filled into the TLB, rather than the invalid physical memory page with address 0 used by Linux when eliminating pages. This page table entry redirection method used when eliminating pages can greatly improve the TLB hit rate compared to redirecting to an invalid page with address 0 or other empty pages, and effectively prevent attackers from creating security vulnerabilities by accessing empty pages. In addition, this page table entry redirection method can avoid TLB invalidation broadcast behavior triggered by page reallocation, because the invalidation of read-only pages during page reallocation will not cause the invalidation of TLB entries in other CPU cores.

[0082] In the previous steps, mapping and wake-up operations are mentioned. To clearly describe the mapping and wake-up operations, please refer to Figure 7 , including steps S710 to S720.

[0083] Step S710: Establish a mapping relationship between free physical memory pages and virtual memory pages in the second page table and the cache buffer.

[0084] Step S720: Wake up the blocked current thread, set the Boolean state bit of the virtual memory page to a non-evicted state and a non-discarded state, and return a free physical memory page.

[0085] In one embodiment, a mapping relationship between an idle physical memory page and a virtual memory page is established in the second page table and the TLB of the current CPU core to wake up the originally blocked thread. For example, in step S330, the thread is blocked, the interrupt service process is started, and finally the mapping and wake-up operations are started in step S410 or 420, and the mapping relationship between the idle physical memory page and the virtual memory page is constructed, that is, the virtual memory page determines the corresponding physical memory page, and the subsequent steps can be returned to step S350. For other cases, this embodiment can be referred to, so it is not listed one by one. Correspondingly, the Boolean state bit of the virtual memory page can also be set, set to a non-ejected state and a non-abandonable state, to indicate that the virtual memory page has a determined physical memory page, and the data of the physical memory page corresponding to the virtual memory page has been read recently, and the corresponding physical memory page cannot be eliminated. As a result, the virtual memory page that originally did not have a corresponding physical memory page is finally constructed with a corresponding physical memory page, and the read and write operations of the target data in the solid-state hard disk are converted into read and write operations in the memory, thereby improving the read and write efficiency.

[0086] Step S130: Process the target data in the SSD page and / or the physical memory page according to the read / write requirements to complete the read / write operation of the target data, wherein the read / write operation includes configuring the Boolean status bit of the virtual memory page.

[0087] In one embodiment, the read demand is to read the target data from the solid state drive and write it into the physical memory. When the read / write demand is a read demand, the target data content of the target data is stored in the solid state drive; step S130: according to the read / write demand, the target data in the solid state drive page and / or the physical memory page is processed to complete the read / write operation of the target data, including: obtaining the target data content in the solid state drive page; writing the target data content into the corresponding physical memory page, and the physical memory page into which the target data content is written is called the first physical memory page; returning to the first physical memory page.

[0088] In one embodiment, in the previous steps, the mapping relationship between the solid-state drive page, the virtual memory page and the physical memory page has been determined. When reading is required, the corresponding target data content can be directly read from the solid-state drive and written into the corresponding physical memory page. It can be understood that for a computer, the CPU can read and process the target data only if the corresponding data is written into the physical memory. It can be seen that at this time, the target data is specifically manifested as data content, which is referred to as target data content. When the target data content is written into the corresponding physical memory page, the physical memory page containing the target data content can be referred to as the first physical memory page. Returning to the first physical memory page allows the subsequent steps to be continued.

[0089] In one embodiment, the write requirement is to write the target data in the physical memory page to the specified solid state disk page. When the read / write requirement is a write requirement, the target data content of the target data is stored in the physical memory; step S130: according to the read / write requirement, the target data in the solid state disk page and / or the physical memory page is processed to complete the read / write operation of the target data, including: obtaining the target data content, copying the target data content to the corresponding physical memory page; setting the Boolean state bit of the corresponding virtual memory page to a dirty state.

[0090] In one embodiment, similarly, when the read-write module needs to write the target data content in a physical memory page to a specified solid-state hard disk page, it corresponds to a write demand. The read-write module only needs to copy the target data content from the physical memory area where it is located to the corresponding physical memory page to complete the processing. To make a distinction, the physical memory page to which the target data content is to be written can be called the second physical memory page. In the process of writing to the second physical memory page, the Boolean state bit of the virtual memory page corresponding to the second physical memory page can be configured and set to a dirty state. The distributed memory page allocator will start the dirty page drop process in the subsequent physical memory page batch elimination operation, that is, write the target data content in the second physical memory page to the solid-state hard disk page corresponding to the virtual memory page. There is a definite one-to-one mapping relationship between the second physical memory page, the virtual memory page and the solid-state hard disk page, which has been determined in the previous text. Further, to ensure successful writing, the target data can include not only the target data content, but also the target data address, so as to ensure that the target data content can be correctly written into the corresponding page.

[0091] In one embodiment, as described above, the read / write module manages and configures each virtual memory page to have four independent Boolean status bits, namely: ejected / non-evicted, locked / unlocked, dirty / non-dirty, discardable / non-discardable. The read / write module will configure the Boolean status bit of the virtual memory page according to the most recent processing performed on the virtual memory page, wherein all virtual memory pages are initialized to ejected, unlocked, non-dirty and discardable states. Specifically, the configuration of each Boolean status bit can be configured with reference to the following situations.

[0092] If a virtual memory page has a corresponding physical memory page, the virtual memory page is in a non-eviction state, otherwise it is in an eviction state.

[0093] If the data of the physical memory page corresponding to the virtual memory page is being written to the solid state drive page, the virtual memory page is in a locked state, otherwise it is in an unlocked state.

[0094] If the data of the physical memory page corresponding to the virtual memory page is updated but not written to the SSD page, the virtual memory page is in a dirty state, otherwise it is in a non-dirty state.

[0095] If the data of the physical memory page corresponding to the virtual memory page has been read within a preset period, the virtual memory page is in a non-discardable state, otherwise it is in a discardable state.

[0096] Furthermore, during operation, the read / write module may start a background process to reset all virtual memory pages to a discardable state after a preset time period.

[0097] It is understandable that other variations may use different data structures (such as more or fewer Boolean status bits, or multi-valued status bits, etc.) to record the status of virtual memory pages, but as long as the same virtual memory page status is considered, it should not be considered to exceed the technical scope protected by this application.

[0098] Therefore, the present application adds a read-write module in the kernel module of the operating system, which is used to maintain a continuous virtual memory page space, which corresponds to the solid-state hard disk page managed by the operating system one by one and has the same size, and maintains a distributed memory page allocator with a preset number of working threads, each of which manages a local memory pool composed of physical memory pages, and the size of each physical memory page is consistent with the size of each virtual memory page. When the read-write module reads and writes to the solid-state hard disk, it uses the virtual memory page as an intermediary to establish a corresponding relationship between the solid-state hard disk page involved in the read-write operation and the physical memory page governed by the distributed memory page allocator, and converts the read-write operation for the solid-state hard disk page into the read-write operation for the physical memory page, thereby improving the read-write efficiency of the solid-state hard disk. The above method can ensure that the DBMS achieves several times the performance improvement when the data load does not exceed the memory capacity; even when the data load exceeds the memory capacity, the performance degradation is gentle, and the performance improvement relative to the existing solution is more obvious after stabilization.

[0099] In one embodiment, the present application further proposes a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes the steps of the method described in any of the aforementioned embodiments.

[0100] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0101] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0102] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for reading and writing a solid state hard disk, characterized in that: Applied to a read-write module, the read-write module being a kernel module of an operating system; The operating system manages the solid state drive and the physical memory, and the solid state drive is configured to store data together with the physical memory; the storage space of the solid state drive is composed of a plurality of solid state drive pages; The read / write module is used to maintain a continuous virtual memory page space, the virtual memory page space is composed of a plurality of virtual memory pages, each of the virtual memory pages corresponds to the solid state hard disk page one by one and has the same size; The read-write module also maintains a distributed memory page allocator; the distributed memory page has a preset number of working threads, each of which manages a local memory pool consisting of physical memory pages; the size of each physical memory page is consistent with the size of each virtual memory page; all the physical memory pages are non-overlapping blocks of the physical memory; The read / write module configures each of the virtual memory pages with 4 Boolean status bits, wherein the Boolean status bits include evicted / non-evicted, locked / unlocked, dirty / non-dirty, and discardable / non-discardable; The method comprises the following steps: When a read / write instruction is obtained, the read / write instruction is parsed to determine the target data to be processed and the read / write requirements, wherein the read / write requirements include a read requirement and a write requirement; Locating a corresponding solid state disk page according to a target data address of the target data, and determining a corresponding virtual memory page and a corresponding physical memory page according to the solid state disk page; The target data in the solid state drive page and / or the physical memory page is processed according to the read and write requirements to complete the read and write operations of the target data, and the read and write operations include configuring the Boolean status bit of the virtual memory page.

2. The method for reading and writing a solid state hard disk according to claim 1, wherein: The read requirement is to read the target data from the solid state drive and write it into the physical memory; When the read / write requirement is the read requirement, the target data content of the target data is stored in the solid state drive; The processing of the target data in the solid state drive page and / or the physical memory page according to the read / write requirements to complete the read / write operation of the target data includes: Obtaining target data content in the solid state drive page; Writing the target data content into the corresponding physical memory page, and calling the physical memory page into which the target data content is written a first physical memory page; Return the first physical memory page.

3. The method for reading and writing a solid state hard disk according to claim 1, wherein: The write requirement is to write the target data in the physical memory page into a specified solid state drive page; When the read / write requirement is the write requirement, the target data content of the target data is stored in the physical memory; The processing of the target data in the solid state drive page and / or the physical memory page according to the read / write requirements to complete the read / write operation of the target data includes: Acquire the target data content, and copy the target data content to the corresponding physical memory page; The Boolean status bit of the corresponding virtual memory page is set to a dirty state.

4. The method for reading and writing a solid state hard disk as claimed in claim 1, characterized in that: The data address where each of the solid state disk pages is located is referred to as a solid state disk page address, the data address where each of the virtual memory pages is located is referred to as a virtual memory page address, and the data address where each of the physical memory pages is located is referred to as a physical memory page address; The read / write module stores a first page table and a second page table; The first page table is maintained by the operating system, and the first page table is used to implement a first conversion, wherein the first conversion is a conversion between the solid state drive page address and the virtual memory page address; the solid state drive page address and the virtual memory page address have a one-to-one correspondence and are consistent in size; The second page table is maintained by the read-write module, and the second page table is used to implement a second conversion, the second conversion is a conversion between the virtual memory page address and the physical memory page address, the second conversion uses a cache of a fast table cache area of ​​a CPU core of the operating system to improve conversion efficiency, and the fast table cache area is used to store mapping information from virtual addresses to physical addresses; the physical memory page set is a subset of the virtual memory page set; The determining the corresponding virtual memory page and the corresponding physical memory page according to the solid state hard disk page includes: Performing the first conversion on the solid state drive page address according to the first page table to determine the corresponding virtual memory page; Determining a Boolean status bit of the virtual memory page; When the Boolean state bit is in the ejected state, a page fault interrupt is triggered, the current thread is blocked, and an interrupt service process is started, wherein the interrupt service process is used to obtain an idle physical memory page to construct a mapping relationship with the virtual memory page; When the Boolean state bit is in a non-evicted state, after waiting for the Boolean state bit of the virtual memory page to enter an unlocked state, performing the second conversion on the virtual memory page address according to the second page table to determine a physical memory page corresponding to the virtual memory page; If the corresponding physical memory page can be found, the Boolean status bit of the virtual memory page is set to a non-discardable state, and the physical memory page is returned; If the corresponding physical memory page cannot be found, a page fault interrupt is triggered, the current thread is blocked, and the interrupt service process is started.

5. The method for reading and writing a solid state hard disk as claimed in claim 4, characterized in that: The interrupt service process includes: Determine whether there is a physical memory page with a preset free condition in the local memory pool governed by the working thread corresponding to the virtual memory page; If there is a physical memory page that meets the preset idle condition in the local memory pool managed by the corresponding working thread, the physical memory page that meets the preset idle condition is marked as an idle physical memory page; and mapping and waking operations are performed on the idle physical memory page and the virtual memory page; If there is no physical memory page that meets the preset free condition in the local memory pool governed by the corresponding working thread, a stealing operation is initiated to steal an idle physical memory page from the remaining working threads in the distributed memory page allocator; and the mapping and wake-up operations are performed on the idle physical memory page and the virtual memory page.

6. The method for reading and writing a solid state hard disk as claimed in claim 5, characterized in that: The stealing operation includes: Determine whether there is a physical memory page with a preset idle condition in the local memory pool managed by the remaining working threads; If there are physical memory pages that meet the preset idle conditions in the local memory pools governed by other working threads, one of the physical memory pages is randomly selected and marked as an idle physical memory page, and the idle physical memory page is moved to the local memory pool governed by the corresponding working thread; the mapping and waking operations are performed on the idle physical memory page and the virtual memory page; If there are no physical memory pages that meet the preset free conditions in the local memory pool governed by the remaining working threads, a batch elimination operation is initiated to eliminate a preset number of physical memory pages in the local memory pool governed by the corresponding working threads, and a physical memory page marked as free is randomly selected from the eliminated physical memory pages; the mapping and wake-up operations are performed on the free physical memory page and the virtual memory page.

7. The method for reading and writing a solid state hard disk as claimed in claim 6, characterized in that: The batch elimination operation includes: Acquire a physical memory page that meets an elimination condition from the physical memory, wherein the elimination condition includes a preset idle condition, and a Boolean state bit of a virtual memory page corresponding to the physical memory page is in a discardable state; The physical memory pages meeting the elimination conditions are eliminated in batches by using the operating system, and the eliminated physical memory pages are marked as eliminated physical memory pages; Marking the virtual memory page corresponding to the eliminated physical memory page as an eliminated virtual memory page; setting the Boolean state bit of the eliminated virtual memory page to an eviction state; Mapping the eliminated virtual memory page to a preset fixed read-only physical memory page that has been pre-filled into the cache buffer in the second page table; If the Boolean status bit of the eliminated virtual memory page is in a dirty state, the Boolean status bit of the eliminated virtual memory page is set to a locked state, and after the data in the eliminated physical memory page is written into the corresponding solid-state hard disk page, the Boolean status bit of the eliminated virtual memory page is restored to an unlocked state and a non-dirty state.

8. The method for reading and writing a solid state hard disk according to claim 5 or 6, characterized in that: The mapping and waking operations include: Establishing a mapping relationship between the free physical memory page and the virtual memory page in the second page table and the cache buffer; The blocked current thread is awakened, the Boolean state bit of the virtual memory page is set to a non-evicted state and a non-discarded state, and the free physical memory page is returned.

9. The method for reading and writing a solid state hard disk as claimed in claim 1, characterized in that: The configuring the Boolean status bit of the virtual memory page comprises: If the initialization instruction is obtained, the Boolean state bit of the virtual memory page is configured to be evicted, unlocked, non-dirty and discardable; If the virtual memory page has a corresponding physical memory page, the virtual memory page is in a non-evicted state, otherwise it is in an evicted state; If the data of the physical memory page corresponding to the virtual memory page is being written to the solid state disk page, the virtual memory page is in a locked state, otherwise it is in an unlocked state; If the data of the physical memory page corresponding to the virtual memory page is updated but not written to the solid state disk page, the virtual memory page is in a dirty state, otherwise it is in a non-dirty state; If the data of the physical memory page corresponding to the virtual memory page has been read within a preset period, the virtual memory page is in a non-discardable state, otherwise it is in a discardable state.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Dynamic EMS memory mappings method of virtual machine manager

    CN101158924A

  • Memory management method and device, storage medium and terminal

    CN118245398A