Microkernel file system extensible page cache system and method

By designing a scalable page cache system in the microkernel operating system, the problem of slow file read and write speeds in the microkernel file system is solved, efficient page cache management is achieved, disk I/O performance is improved, and the page cache is enhanced. scalability.

CN114942727BActive Publication Date: 2024-10-25SHANGHAI JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210601308.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-30
Publication Date
2024-10-25
Estimated Expiration
2042-05-30

AI Technical Summary

Technical Problem

The lack of an efficient page cache mechanism in microkernel operating systems results in slow file reading and writing speeds, and existing technologies fail to effectively solve the page cache management problem in microkernel scenarios.

Method used

A microkernel file system scalable page cache system is designed, including module M1 to provide a page cache mechanism for user-mode clients, module M2 to record page cache information in each file system and start the recycling thread, and module M3 to only Stores a copy of the page cache, and module M4 implements a page replacement policy when the page cache resource reaches a threshold.

Benefits of technology

It significantly reduces the time consumed by disk I/O in the microkernel system, improves the efficiency of file reading and writing, and through the encapsulation of the file system library, only simple initialization is required when a new file system is accessed, which enhances the scalability of the page cache mechanism. sex.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114942727B_ABST
    Figure CN114942727B_ABST
Patent Text Reader

Abstract

The present invention provides a micro-kernel file system expandable page cache system and method, including: module M1: used for providing a page cache mechanism when a client that is isolated from a file system manager server and a file system server in different address spaces accesses a file; module M2: used for recording all page cache information separately in each file system, and starting a recycling thread to periodically write back dirty pages in the page cache; module M3: used for managing the page cache at the file system end, and when multiple clients access the same file, only one copy of the page cache is stored in the memory; module M4: used for performing a page replacement strategy after the page cache resource reaches a preset threshold. Compared with the prior art, the application of the page cache mechanism of the present invention significantly reduces the time consumed by disk input / output in the micro-kernel system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of file systems, and in particular to a microkernel file system extensible page cache system and method. Background Art

[0002] Microkernel is an operating system kernel that only provides core functions. Unlike the currently widely used macrokernels such as Linux and Windows, the microkernel simplifies the kernel's functions to achieve high scalability, reliability and stability. The microkernel operating system only puts necessary functions, such as memory management, in the kernel state, and puts other functions, such as file systems and drivers, in the user state. Since the functional modules in the kernel are greatly reduced, the probability of kernel problems is reduced. At the same time, the reduction in the amount of code also makes formal verification or maintenance easier. The crash of the user-state program will not affect other processes, let alone the kernel, because of its natural isolation. However, the microkernel isolates various system services, so requests for various system services need to be transmitted through inter-process communication (IPC), so the cost of requesting services is greater than that of the macrokernel. Therefore, in the decades since it was proposed, it has not been able to become a product with a large user base like Windows or Linux.

[0003] However, with the development of the Internet industry in recent years, operating systems are being used in more and more scenarios. Microkernel operating systems have shown unique advantages in many key areas due to their high scalability, high reliability and stability. They have gradually become a hot research topic. At the same time, microkernels also face many challenges, and the file system is one of them.

[0004] In traditional macro kernel operating systems, the file system is implemented in kernel mode. Without a page cache mechanism, the bottleneck of file input / output (I / O) operations is originally the device I / O. The read and write speed of traditional mechanical hard disks can be two orders of magnitude slower than that of memory. In order to improve the read and write speed of files, developers designed a page cache mechanism.

[0005] When a user accesses a file, the privilege level is first switched to kernel mode through a system call, and then a series of function calls between kernel function modules are used to request disk operations, and finally the read file content is returned to the user. The page cache mechanism will cache the file content in memory when there is no cached file content in memory. The next time the user reads the same file, the memory can be read directly. When the user requests to write a file, the file will be cached in memory and the memory will be modified directly. After a period of time (or when the user actively calls the relevant function), the modified content will be written to the disk at one time. By merging multiple file writes in memory, the file reading and writing speed is greatly increased. This technology is already very mature in macro kernel operating systems.

[0006] However, a highly scalable and efficient page cache mechanism is needed in a microkernel operating system to speed up the file reading and writing efficiency in the microkernel operating system. In the macrokernel scenario, users only need to make system calls to request the file system, switch to kernel mode, and make a series of function calls; in the microkernel scenario, the file system (FileSystem, FS), file system manager (File System Manager, FSM) and user processes run in different address spaces, and they cannot directly perform file operations through function calls. Therefore, it is not feasible to directly apply the page cache mechanism in the macrokernel to the microkernel.

[0007] The present invention is based on running the file system in user mode, as a microkernel operating system of a user mode system service process, and proposes a set of page cache mechanisms to solve the problem of slow disk I / O speed in the microkernel scenario. At the same time, in order to have a good hit rate on different loads under the condition of limited page cache resources, the present invention applies multiple page cache replacement strategies to write inactive pages to disk when page cache resources are less, reducing overhead.

[0008] Patent document CN113326214A discloses a page cache management method, which is executed in a computing device, and includes: obtaining page cache information and process information in any business scenario; regularly counting page cache information, and determining whether the current page cache management strategy needs to be optimized according to the read hit rate and write hit rate of each file block of each file at the last moment in the statistical time period; when optimization is required, determining the problematic files and the stage where the problem occurs according to the read hit rate and write hit rate of each file block of each file at each moment in the statistical time period; determining a new page cache management strategy according to the process information, page cache information, problematic files and the stage where the problem occurs in the statistical time period; replacing the page cache management strategy stored in the configuration file of the page cache with the new page cache management strategy. However, this method does not involve the technical problem of applying the page cache mechanism to the microkernel operating system. Summary of the invention

[0009] In view of the defects in the prior art, the object of the present invention is to provide a microkernel file system scalable page cache system and method.

[0010] A microkernel file system scalable page cache system according to the present invention includes:

[0011] Module M1: used to provide a page cache mechanism for clients that are isolated from the file system manager server and the file system server in different address spaces when accessing files;

[0012] Module M2: used to record all page cache information separately in each file system and start a recycling thread to periodically write back dirty pages in the page cache;

[0013] Module M3: used to manage the page cache on the file system side. When multiple clients access the same file, only one copy of the page cache is stored in the memory.

[0014] Module M4: used to implement a page replacement strategy after the page cache resources reach a preset threshold.

[0015] Preferably, module M1 comprises:

[0016] Module M101: used to set the file system manager process to manage all file systems;

[0017] Module M102: used to register with the file system manager process after all file system servers are started;

[0018] Module M103: used to implement the encapsulation of the page cache mechanism in the file system. Each file system depends on the file system library.

[0019] Preferably, in module M103, when a file system is started, an interface for initializing the cache in the file system library is called to initialize related data structures.

[0020] Preferably, module M3 comprises:

[0021] Module M301: used to abstract the structure virtual node in the memory corresponding to the disk index node. The page cache information corresponding to each index node is maintained in the structure of the virtual node.

[0022] Module M302: When the client opens a file, the file system opens the file location on the disk to generate a corresponding virtual node, and compares it with the existing virtual node. If the index node has been opened, the existing virtual node is directly reused. If the index node has not been opened, a virtual node corresponding to the index node is generated.

[0023] Preferably, a necklace table is maintained in the file system for the client to access the virtual node corresponding to the index node through the file descriptor.

[0024] Preferably, a structure is maintained in each virtual node, maintaining the page cache information corresponding to the file in the memory.

[0025] Preferably, module M4 includes two sets of page replacement strategies.

[0026] Preferably, module M4 includes: when the number of page caches reaches a preset threshold, removing the page caches through a page cache linked list according to preset rules.

[0027] According to a microkernel file system scalable page cache method provided by the present invention, the microkernel file system scalable page cache system is adopted, comprising:

[0028] Step 1: When the file system starts, it registers with the file system manager and calls the page cache initialization interface to initialize related data structures;

[0029] Step 2: The file system starts a recycling thread to periodically check whether there are dirty pages that need to be written back to disk;

[0030] Step 3: The client opens the file and sends a request to the file system manager. The file system manager parses the path, finds the corresponding file system, and returns it to the client.

[0031] Step 4: The client sends a message to the file system. After the file system opens a file, it generates a corresponding virtual node related structure for the file's index node;

[0032] Step 5: The client performs read and write operations and sends messages directly to the file system;

[0033] Step 6: When a new page is generated by the client's access, the file system checks the size of the active list and the inactive list. If the size exceeds the preset threshold, the last page of the active list is inserted into the first page of the inactive list, and the last page of the inactive list is written back to the disk.

[0034] Preferably, step 5 comprises:

[0035] Step 501: The file system finds the corresponding virtual node through the file descriptor and checks whether there is a read / write location;

[0036] Step 502: If yes, perform a read / write operation, if no, read / write the file and cache the data from the disk.

[0037] Compared with the prior art, the present invention has the following beneficial effects:

[0038] 1. The application of the page cache mechanism of the present invention significantly reduces the time consumed by disk I / O in the microkernel system.

[0039] 2. The present invention implements a file system library and encapsulates corresponding operations, so that when a new file system is connected to the file system manager, it only needs to perform certain additional initialization work and encapsulate some interfaces, and the page cache mechanism can be easily applied to the newly transplanted file system.

[0040] 3. The present invention enhances the scalability of the page cache mechanism by implementing a file system library. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0042] Figure 1 It is a schematic diagram of the architecture of the page cache mechanism of the present invention;

[0043] Figure 2 It is a structural schematic diagram of a specific file system of the present invention;

[0044] Figure 3 It is a structural schematic diagram of another specific file system of the present invention;

[0045] Figure 4 It is a schematic diagram of the structure of the structure of the present invention;

[0046] Figure 5 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION

[0047] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0048] The present invention provides a microkernel file system scalable page cache system, including the following modules:

[0049] Module M1: used to provide a page cache mechanism when a client (client) that is isolated in a different address space from the file system manager server (FSM server) and the file system server (FSserver) accesses a file.

[0050] The present invention provides a page cache mechanism for clients that are isolated from the FSM server and the FS server in different address spaces when accessing files.

[0051] Among them, module M1 includes: module M101: used to set the file system manager process to manage all file systems; module M102: used to register with the file system manager process after all file system servers are started; module M103: used to implement the encapsulation of the page cache mechanism in the file system, and each file system depends on the file system library.

[0052] Specifically, in module M103, when a file system is started, an interface for initializing the cache in the file system library is called to initialize related data structures.

[0053] Module M2: used to record all page cache information separately in each file system and start a recycling thread to periodically write back dirty pages in the page cache.

[0054] In the present invention, all page cache information is recorded separately in each specific file system, and a recycling thread is started to periodically write back dirty pages in the page cache.

[0055] Module M3: used to manage the page cache on the file system side. When multiple clients access the same file, only one copy of the page cache is stored in the memory.

[0056] In the present invention, the memory resources used by the page cache are limited. Multiple clients may access the same file, but the same file should not have multiple copies in the memory. Therefore, the present invention manages the page cache on the specific FS side, and when multiple clients access the same file, only one page cache copy exists in the memory.

[0057] Among them, module M3 includes: module M301: abstracting the structural virtual node in the memory corresponding to the disk index node, and the page cache information corresponding to each index node is maintained in the structure of the virtual node; module M302: when the client opens the file, the file system opens the location of the file on the disk to generate a corresponding virtual node, and compares it with the existing virtual node. If the index node has been opened, the existing virtual node is directly reused. If the index node has not been opened, a virtual node corresponding to the index node is generated.

[0058] Specifically, a necklace table is maintained in the file system for the client to access the virtual node corresponding to the index node through the file descriptor.

[0059] In the present invention, a structure is maintained in each virtual node, which maintains the page cache information corresponding to the file in the memory.

[0060] Module M4: used to implement a page replacement strategy after the page cache resources reach a preset threshold.

[0061] The present invention does not impose any limitation on the setting of the preset threshold value. Exemplarily, it can be set as the upper limit of the page cache resource.

[0062] In the present invention, the memory resources used by the page cache are limited, so a page replacement strategy should be implemented after the page cache resources reach the set upper limit. In order to support high cache hit rates under different scenarios and different loads, the present invention applies multiple sets of page cache replacement strategies.

[0063] Furthermore, in order to support some special scenarios, the present invention supports a policy that allows the user to specify that a certain page resides in the memory.

[0064] Wherein, module M4 includes: when the number of page caches reaches a preset threshold, removing the page caches through the page cache linked list according to preset rules.

[0065] In the present invention, module M4 includes two sets of page replacement strategies.

[0066] Embodiment 1

[0067] Figure 1 FIG. 1 is a schematic diagram of the architecture of the page cache mechanism of the present invention. Figure 1 As shown, it includes: client, FSM, file allocation table (File Allocation Table, FAT) file system, fourth extended file system (Fourth extended file system, EXT4) and file system library (FS_BASE), wherein FAT and EXT4 are a kind of file system. Since different file systems run in different address spaces, their management cannot be performed directly through function calls (function calls) like Linux. Therefore, the present invention first sets up the FSM process for managing all specific FS, such as FAT32 and EXT4. All different FS servers should register with it after startup. At the same time, each FS depends on the FS_BASE library, which encapsulates the implementation of the page cache mechanism.

[0068] Among them, FAT32 refers to the file allocation table (FAT), which is a disk file management method that uses 32-bit binary number records for management.

[0069] In the present invention, FSM plays the role of part of the virtual file system (VFS). When a FS is started, if it is configured to enable page cache, it will call the interface of initializing page cache in FS_BASE to initialize the relevant data structure. First, the corresponding disk index node (inode) corresponds to the structural virtual node (vnode) in the memory, and all the page cache information corresponding to each inode will be maintained in the vnode structure. In each specific file system, a linked list managing all vnodes will be maintained.

[0070] Figure 2 FIG. 1 is a schematic diagram of a structure of a specific file system of the present invention. Figure 2 As shown in the figure, when a user tries to open a file, the request will be sent to the corresponding specific file system, such as FAT32. When the file system is opened (open), it will generate the index (inode_index) of the corresponding inode for the location of the opened file on the disk, and compare it with the existing vnode in the linked list of virtual nodes (vnode_list). If the inode has been opened before, the existing vnode will be reused directly. Otherwise, a new inode corresponding to the inode will be generated and inserted into the vnode_list. In this way, different clients can correspond to the same vnode when opening the same file, saving the space overhead of the page cache.

[0071] Figure 3 FIG. 1 is a schematic diagram of the structure of another specific file system of the present invention. Figure 3 As shown, in order to quickly access the corresponding vnode through the file descriptor (file descriptor, fd) on the client side, the present invention maintains a necklace table (entry_list) on the file system side. The entry_list can quickly obtain the vnode by using fd as the index (inode_index) of the index node. The entry_list contains multiple vnodes, which can realize the rapid acquisition of fd to vnode (fd->vnode). In order to avoid the conflict of fd between different clients, the present invention maintains a mapping relationship (entry_list_mapping) from client_badge to entry_list on the file system side, and realizes the rapid search from client_badge to entry_list (client_badge->entry_list). Client_badge is an attribute provided by other modules and is different between processes. Therefore, the isolation of file access between different clients can be guaranteed.

[0072] Among them, client_badge uniquely identifies a client, which is similar to the process identification number (Process Identification) in the operating system.

[0073] Each vnode maintains a structure (page_cache_entity_of_inode), which maintains the page cache information corresponding to the file in memory. This structure maintains two index page cache data structures, namely a linked list and a radix tree. The radix tree maintains the mapping relationship from index to page cache, and the index is given by the file offset accessed by the user. Whenever a user accesses a new location in the file and generates a corresponding new page cache, it will be inserted into the list and radix tree at the same time. This ensures that when a user accesses a specific page, he can quickly access the corresponding page cache through the index; and when the user calls an interface function, such as fsync, all dirty pages can be written to disk by traversing the list.

[0074] Figure 4 It is a schematic diagram of the structure of the structure of the present invention, such as Figure 4 As shown in the figure, it is a structure corresponding to a vnode, including an active page list (active_list), an inactive page list (inactive_list) and a pinned list (pinned_list). Each list includes multiple page cache information (page_cache). When the number of page caches reaches the upper limit, the inactive page caches need to be removed to make room for new page caches. The file system needs to be able to quickly access all page caches, so a structure is maintained on each file system. The structure maintains all page cache information managed by the file system, including all page cache lists, page cache strategies, and the read and write interfaces corresponding to the specific file system when reading and writing disks are required. Among them, the page cache list is used to maintain the information of active pages. When a user accesses a new page, it will be placed in the active page list (active_list). If the number of pages in the active_list exceeds the threshold, the last page will be placed in the inactive page list (inactive_list). If the cached pages in the inactive_list exceed the upper limit, the last page will be written back to the disk. In addition, another pinned list (pinned_list) is maintained in this structure. If the user needs, some page caches can be placed in pinned_list. The cache pages in the pinned list will not be replaced out of memory by the cache strategy.

[0075] The present invention also provides a microkernel file system scalable page cache method, using the above-mentioned microkernel file system scalable page cache system, comprising the following steps:

[0076] Step 1: When the file system starts, it registers with the file system manager and calls the page cache initialization interface to initialize related data structures.

[0077] Step 2: The file system starts a recycling thread to periodically check whether there are dirty pages that need to be written back to disk.

[0078] Step 3: The client opens the file and sends a request to the file system manager. The file system manager parses the path, finds the corresponding file system, and returns it to the client.

[0079] Step 4: The client sends a message to the file system. After the file system opens a file, it generates a corresponding virtual node related structure for the file's index node.

[0080] Step 5: The client performs read and write operations and sends messages directly to the file system.

[0081] Among them, step 5 includes: step 501: the file system finds the corresponding virtual node through the file descriptor and finds out whether there is a read / write location; step 502: if so, perform the read / write operation, if not, read / write the file and cache the data from the disk.

[0082] Step 6: When a new page is generated by the client's access, the file system checks the size of the active list and the inactive list. If the size exceeds the preset threshold, the last page of the active list is inserted into the first page of the inactive list, and the last page of the inactive list is written back to the disk.

[0083] Furthermore, the present invention may also include step 7: the client calls the interface function and sends a message to the file system, the file system finds the corresponding virtual node through the file descriptor, and writes all dirty pages back to the disk.

[0084] Specifically, the user can call the interface function to write back all dirty pages, but it is not necessary to call the interface function to write back the dirty pages. The user can choose not to write back the dirty pages.

[0085] Embodiment 2

[0086] The present invention implements three page cache strategies: direct, write_back and write_through. The direct strategy directly writes the page cache back to the disk and releases it when writing to the disk; the write_back strategy writes the page cache back and marks the page as a dirty page; the write_through strategy writes the page cache back to the disk but does not release it. The three strategies can be used in different scenarios.

[0087] Figure 5 It is a schematic diagram of the process of the present invention, such as Figure 5 As shown, it includes the following steps: step S1: when the file system starts, it registers itself with the FSM and calls the page cache initialization interface to initialize the relevant data structure; step S2: the file system will start a recycling thread to regularly check whether there are dirty pages that need to be written back to the disk, so as to periodically write back to the thread; step S3: the user of the client calls the open operation to open the file, and first sends a request to the FSM. After the FSM parses the path, it searches for the corresponding file system (FS) and FS_BASE, and returns it to the client; step S4, the client continues to send messages to the specific file system. After the file system opens a file, it generates a corresponding vnode related structure for the file inode; step S5: the user performs file system operations, including read / write (open / read) operations, and directly sends messages to the file system. The file system will first find the corresponding vnode through fd, and find out whether there is a page cache at the read (write) position in the radix tree through the offset of the read and write position. If so, the page cache is read and written. Specifically, when reading a file, the content of the page cache is directly read and returned, or when writing a file, the page cache is written, and the choice of writing back to the disk or marking as a dirty page is selected according to different strategies. If not, both reading and writing files need to cache data from the disk; Step S6: When a new page is generated due to user access, the file system will check the size of the active page list and the inactive list. If the size exceeds the threshold, the last page of the active page list will be inserted into the first page of the inactive page list, and the last page of the inactive list will be written back to the disk; Step S7: When the user calls fsync, a message is directly sent to the file system, and the file system will find the corresponding vnode through fd, and sequentially scan the page cache list to write all dirty pages back to the disk.

[0088] Among them, in step S7, the user can but does not necessarily need to call the fsync function. If the user calls fsync, a message is directly sent to the file system. The file system will find the corresponding vnode through fd and sequentially scan the page cache list to write all dirty pages back to the disk.

[0089] Note that for ease of understanding, Figure 5 Among them, ①, ②, ③, ④, ⑤, ⑥ and ⑦ represent step S1, step S2, step S3, step S4, step S5, step S6 and step S7 respectively.

[0090] It can be seen that multiple sets of page cache replacement strategies are applied in the present invention, including: direct, write through, write back and pinned_list.

[0091] In order to enable different clients to access the same page cache content when accessing the same file, the present invention maintains a data structure vnode in memory for each independent file, and the vnode manages all page caches of the same file. An additional thread that wakes up at a fixed time is used to write back all dirty pages; in order for users to quickly find the corresponding page cache according to the offset when accessing, the mapping from the index generated by the offset to the page cache is maintained and stored through a radix tree to achieve the purpose of fast access; in order for users to quickly traverse all cached pages in the vnode corresponding to the fd when calling fsync, and write the dirty pages to the disk, a linked list of all page caches is maintained again in the vnode. When calling fsync, a linked list is traversed; in order to adapt to different scenarios, multiple page cache strategies are adopted, including: direct, write_back and write_through strategies; a pinned_list strategy is proposed for specific scenarios, allowing users to specify that some pages are never replaced out of memory; the present invention proposes a complete microkernel system architecture suitable for most isolated file systems, and a page cache method for accelerating disk I / O for microkernel file systems.

[0092] The technical problems solved by the present invention are as follows:

[0093] 1. How to design a feasible page cache mechanism for the microkernel user-mode file system?

[0094] 2. How does the microkernel's page cache mechanism adapt to different scenarios and different load conditions?

[0095] 3. How to adopt appropriate page cache strategies to achieve a higher cache hit rate with limited page cache resources?

[0096] 4. When there are too many cached pages, how can we quickly find the pages required by the client so that the required results can be returned to the client with the least number of IPC times?

[0097] 5. When there are too many cached pages, the client calls an interface function, such as fsync. How to write all dirty pages back to disk with the least number of IPCs?

[0098] The technical principles of the present invention are as follows:

[0099] 1. The present invention provides a page cache mechanism for a client that is isolated from an FSM and an FS server in a different address space when accessing a file.

[0100] 2. The present invention records all page cache information separately in each specific file system, and starts a recycling thread to periodically write back dirty pages in the page cache.

[0101] 3. The memory resources used by the page cache in the present invention are limited. Multiple clients may access the same file, but the same file should not be stored in memory.

[0102] 4. There are multiple copies in the present invention. Therefore, the present invention manages the page cache in a specific FS, and when multiple clients access the same file, only one page cache copy exists in the memory.

[0103] 5. The memory resources used by the page cache of the present invention are limited, so a page replacement strategy should be implemented after the page cache resources reach the set upper limit. In order to support high cache hit rates under different scenarios and different loads, the present invention applies multiple sets of page cache replacement strategies.

[0104] 6. In order to support some special scenarios, the present invention supports a strategy that allows the user to specify that a certain page resides in memory.

[0105] Those skilled in the art know that, in addition to implementing the system, device and its various modules provided by the present invention in a purely computer-readable program code, it is entirely possible to implement the same program in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method submodule M. Therefore, the system, device and its various modules provided by the present invention can be considered as a hardware component, and the modules included therein for implementing various programs can also be considered as structures within the hardware component; the modules for implementing various functions can also be considered as both software programs for implementing methods and structures within hardware components.

[0106] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A microkernel file system scalable page cache system, characterized in that: include: Module M1: used to provide a page cache mechanism for clients that are isolated from the file system manager server and the file system server in different address spaces when accessing files; Module M2: used to record all page cache information separately in each file system and start a recycling thread to periodically write back dirty pages in the page cache; Module M3: used to manage the page cache on the file system side. When multiple clients access the same file, only one copy of the page cache is stored in the memory. Module M4: used to implement a page replacement strategy after the page cache resources reach a preset threshold; The module M3 comprises: Module M301: used to abstract the structure virtual node in the memory corresponding to the disk index node, and the page cache information corresponding to each index node is maintained in the structure of the virtual node; Module M302: When a client opens a file, the file system opens the file location on the disk to generate a corresponding virtual node, and compares it with the existing virtual node. If the index node has been opened, the existing virtual node is directly reused. If the index node has not been opened, a virtual node corresponding to the index node is generated.

2. The microkernel file system scalable page cache system according to claim 1, characterized in that: The module M1 comprises: Module M101: used to set the file system manager process to manage all file systems; Module M102: used to register with the file system manager process after all file system servers are started; Module M103: used to implement encapsulation of the page cache mechanism in the file system, and each file system depends on the file system library.

3. The microkernel file system scalable page cache system according to claim 2, characterized in that: In the module M103, when a file system is started, an interface for initializing the cache in the file system library is called to initialize related data structures.

4. The microkernel file system scalable page cache system according to claim 1, characterized in that: A necklace table is maintained in the file system for the client to access the virtual node corresponding to the index node through the file descriptor.

5. The microkernel file system scalable page cache system according to claim 1, characterized in that: A structure is maintained in each virtual node, which maintains the page cache information corresponding to the file in memory.

6. The microkernel file system scalable page cache system according to claim 1, characterized in that: The module M4 includes two sets of page replacement strategies.

7. The microkernel file system scalable page cache system according to claim 1, characterized in that: The module M4 includes: when the number of page caches reaches a preset threshold, removing the page caches through the page cache linked list according to preset rules.

8. A microkernel file system scalable page cache method, characterized in that: The microkernel file system scalable page cache system according to claims 1 to 7 comprises: Step 1: When the file system starts, it registers with the file system manager and calls the page cache initialization interface to initialize related data structures; Step 2: The file system starts a recycling thread to periodically check whether there are dirty pages that need to be written back to disk; Step 3: The client opens the file and sends a request to the file system manager. The file system manager parses the path, finds the corresponding file system, and returns it to the client. Step 4: The client sends a message to the file system. After the file system opens a file, it generates a corresponding virtual node related structure for the file's index node; Step 5: The client performs read and write operations and sends messages directly to the file system; Step 6: When a new page is generated by the client's access, the file system checks the size of the active list and the inactive list. If the size exceeds the preset threshold, the last page of the active list is inserted into the first page of the inactive list, and the last page of the inactive list is written back to the disk.

9. The microkernel file system scalable page cache method according to claim 8, characterized in that: The step 5 comprises: Step 501: The file system finds the corresponding virtual node through the file descriptor and checks whether there is a read / write location; Step 502: If yes, perform a read / write operation, if no, read / write the file and cache the data from the disk.