A file processing method and device, electronic equipment and storage medium thereof

By latching dependent files and forming a radix tree in the autonomous driving vehicle system, the hard page fault problem caused by insufficient system free memory is solved, thus improving the system's stability and performance.

CN116302154BActive Publication Date: 2026-11-27GUANGZHOU WERIDE TECH LTD CO
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211567049.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-07
Publication Date
2026-11-27
Estimated Expiration
2042-12-07

AI Technical Summary

Technical Problem

In autonomous driving vehicle systems, when there is insufficient free memory, the operating system deletes physical memory pages that have not been used for a long time, resulting in hard page faults, which slows down disk read and write speeds and affects system performance.

Method used

When a business process is detected to start, dependent files are identified and latched, a radix tree is formed to record the reference count, and memory reclamation is performed by skipping latched cache pages and only releasing unlatched cache pages.

Benefits of technology

Reduce the occurrence of hard page faults, avoid data loading waits, and improve system stability and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116302154B_ABST
    Figure CN116302154B_ABST
Patent Text Reader

Abstract

The application discloses a file processing method and device, electronic equipment and a storage medium thereof. The method comprises the following steps: in the case that a business process is detected to be started, determining dependent files of the business process; in the case that each dependent file is cached to a physical memory page, performing latch processing on each dependent file cached in the physical memory page; and in the process of performing memory recycling processing on the physical memory page, if any cached page file is latched, skipping the latched cached page, and releasing at least part of the cached page which is not latched. By using the file processing method, the dependent files of the business process are cached in the physical memory page and are subjected to latch processing in the process of starting the business process, the problem that the accessed file does not exist in the physical memory page in the process of starting the process is solved, the occurrence of the hard page fault exception problem is reduced, the waiting of data loading caused by the hard page fault exception is avoided, and therefore the stability of the system is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of document processing technology, and in particular to a document processing method, apparatus, electronic device and its storage medium. Background Technology

[0002] With the development of modern automotive industry and electronic technology, electronic systems with functions such as vehicle navigation, communication, mobile office, multimedia entertainment, security-assisted driving and remote fault diagnosis can be networked and integrated into autonomous driving vehicle systems.

[0003] In an autonomous driving vehicle system, during application startup, the onboard operating system identifies all dynamic libraries that the application depends on, reads the dynamic library data from the disk sequentially, and loads it into physical memory pages. Once all dynamic libraries are loaded, the program will begin running. If insufficient free memory occurs during application startup, the operating system will initiate memory page reclamation, freeing up physical memory page frames that have not been used for a long time for use by other processes.

[0004] Based on the aforementioned existing technical solutions, when system free memory is insufficient, the operating system initiates memory page reclamation, deleting physical memory pages that have not been used for a long time. This leads to a problem when applications start, where files that need to be accessed are not present in the physical memory pages, triggering a hard page fault. To start the application, the required dynamic database data needs to be read back from the disk into physical memory. During the process of rereading the dynamic database, the disk read / write speed is too slow, causing system lag and impacting system performance. Summary of the Invention

[0005] This invention provides a file processing method, apparatus, electronic device, and storage medium thereof to solve the problem of hard page faults.

[0006] According to one aspect of the present invention, a document processing method is provided, comprising:

[0007] If the startup of a business process is detected, determine the dependent files of that business process;

[0008] If all dependent files have been cached in physical memory pages, perform latching on each dependent file cached in the physical memory pages;

[0009] Furthermore, during the memory reclamation process of physical memory pages, if any cache page file is latched, the latched cache page is skipped, and at least a portion of the unlatched cache pages are released.

[0010] Optionally, latching is performed on each dependent file cached in the physical memory page, including:

[0011] For any dependent file, if the dependent file is not latched, latch the dependent file and increment its reference count by one;

[0012] If the dependent file is already locked, increment the reference count of the dependent file by one.

[0013] Optionally, latching of dependency files may be performed, including:

[0014] The latch function is invoked to start the latch service in the latch kernel module based on the pre-created latch device file, and to perform latch processing on the dependent files.

[0015] Optionally, the method also includes:

[0016] If any business process is detected to have exited, the reference count of the dependent files corresponding to the exited business process is decremented by one.

[0017] In addition, it unlocks dependency files with zero references.

[0018] Optionally, the method also includes:

[0019] When the system starts, a process exit tracing function is registered. This function is used to capture the exit of business processes.

[0020] Optionally, the method also includes:

[0021] A radix tree is formed based on the file identifier and reference count of each dependent file;

[0022] Correspondingly, during the memory reclamation process of physical memory pages, files with a reference count greater than or equal to 1 in the radix tree are identified as latched files, and each latched file includes at least one latched cache page.

[0023] Files with a reference count of 0 in the radix tree are identified as unlocked files, and each unlocked file contains at least one unlocked cache page.

[0024] Optionally, at least a portion of the unlocked cached pages may be released, including:

[0025] Determine the reference frequency of the unlocked cache pages, and determine the cache pages to be released based on the reference frequency.

[0026] According to another aspect of the present invention, a document processing apparatus is provided, comprising:

[0027] The dependency file determination module is used to determine the dependency files of a business process when the business process is detected to be starting.

[0028] The dependency file latching module is used to latch each dependency file cached in the physical memory page when each dependency file has been cached in the physical memory page;

[0029] The memory reclamation module is used to, during the process of reclamation of physical memory pages, skip any latched cache page if it is latched, and release at least a portion of the unlatched cache pages.

[0030] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0031] At least one processor; and

[0032] A memory that is communicatively connected to at least one processor; wherein,

[0033] The memory stores a computer program that can be executed by at least one processor, such that the at least one processor is able to perform the file processing method of any embodiment of the present invention.

[0034] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores computer instructions for causing a processor to execute and implement the file processing method of any embodiment of the present invention.

[0035] The technical solution of this invention proposes an efficient optimization method to reduce the occurrence of hard page faults. This method locks each node application and its corresponding dependent dynamic libraries in physical memory pages. When the system runs out of free memory, the operating system skips the locked cache pages and releases other unlocked cache pages. This solves the problem that when a process starts up, the address it needs to access does not exist in the physical memory page. This can significantly reduce the occurrence of hard page faults, avoid the data loading wait caused by hard page faults, and thus greatly improve the stability of the system.

[0036] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0037] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0038] Figure 1 This is a flowchart of a file processing method provided in Embodiment 1 of the present invention;

[0039] Figure 2 This is a flowchart of the file processing method provided in Embodiment 2 of the present invention;

[0040] Figure 3 This is a schematic diagram of the structure of a file processing device provided in Embodiment 3 of the present invention;

[0041] Figure 4 This is a schematic diagram of the structure of an electronic device that implements the file processing method of the present invention. Detailed Implementation

[0042] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0043] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0044] Example 1

[0045] Figure 1 This is a flowchart of a file processing method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where files depended on by an application during startup are latched. This method can be executed by a file processing device, which can be implemented in hardware and / or software, and can be configured in an in-vehicle system. Figure 1 As shown, the method includes:

[0046] S110. If the business process is detected to have started, determine the dependent files of the business process.

[0047] Specifically, dependency files can be understood as files required by the business process during runtime. These dependency files include executable files and dynamic database files, among others. A dynamic database is an executable file that functions as a shared function library, allowing the process to call functions that are not part of its executable code. The startup of the business process depends on a large number of dynamic databases, which are stored on disk and occupy a certain amount of space.

[0048] The operating system can detect whether a business process is running. For example, it can detect if an application on a touchscreen has been selected and clicked. If a click signal is detected, it indicates that the application needs to be launched, and the corresponding business process will also be launched. Alternatively, a process launch detection function can be pre-registered to detect launched business processes. The method for determining dependent files is achieved by controlling the system to search through all dynamic databases that the business process depends on. Dynamic databases are read sequentially from the disk and loaded into physical memory pages. When a business process starts, the corresponding dependent file is read from the physical memory page. Optionally, a list of correspondences between business processes and dependent files can be pre-set. This list stores the correspondence between business process identifiers and their dependent file identifiers. Accordingly, when a business process is detected to be running, its identifier is matched against this list to determine the dependent file corresponding to that business process.

[0049] Specifically, when the operating system detects a signal indicating the start of a business process, it identifies all dynamic libraries that the node application depends on. It then reads these dynamic libraries from the disk and loads them into physical memory pages. Once all dynamic libraries are loaded, the business process begins running, and consequently, the application also starts running. Before reading dynamic library data from the disk and loading it into physical memory pages, it checks if the files already loaded in the physical memory pages include the dependency files corresponding to the business process. For already loaded dependency files, they do not need to be loaded again; for unloaded dependency files, they are read from the disk and loaded. Different business processes may have overlapping dependency files, and multiple business processes can be running simultaneously.

[0050] For example, in an autonomous driving vehicle system, each node application relies on a large number of dynamic libraries, which are stored on the disk and occupy a certain amount of space. Each node application also contains at least one business process. When node application A is selected and clicked, the operating system searches for all dynamic databases that all business processes depend on in the dynamic database, reads the dynamic databases from the system disk in turn, and loads the corresponding dependency files into physical memory pages. After the dependency files are loaded, the application calls these dependency files, all business processes start up, and the application begins to run.

[0051] In this embodiment, the operating system detects the startup of the business process and determines the dependent files corresponding to the business process. The dependent files are then directly retrieved from the physical memory pages, reducing file loading time and improving system performance.

[0052] S120. If each dependent file has been cached in a physical memory page, perform latching on each dependent file cached in the physical memory page.

[0053] Caching involves storing frequently accessed file data in memory. Caching mechanisms enable data sharing between different processes or between different parts of the same process. Page caching is used to cache data in files. Physical memory, also known as RAM (main memory), exists in the form of memory modules embedded in the motherboard's memory slots. It loads various programs and data for the processor to run and use directly. A physical memory page can be understood as obtained by paging physical memory, which can be accomplished using page allocation functions. Latching can be understood as a method of locking memory pages, which can be performed by calling memory lock functions.

[0054] Specifically, when a business process starts, the operating system detects the files that the business process depends on from the dynamic database and caches them in physical memory. These dependent files can be cached in physical memory pages using a page caching mechanism, which is a page-based, file-oriented caching mechanism. During the caching of dependent files in physical memory, a page allocation function is called to complete the paging process of physical memory, and then the dependent files are stored in the allocated physical memory pages. Each dependent file can correspond to at least one cache page. Once all dependent files have been cached in physical memory pages, a memory locking function is used to perform locking processing on each dependent file corresponding to the business process in the running state.

[0055] Furthermore, latching is performed on each dependent file cached in the physical memory page, including:

[0056] For any dependent file, if the dependent file is not latched, latch the dependent file and increment its reference count by one;

[0057] If the dependent file is already locked, increment the reference count of the dependent file by one.

[0058] The reference count can be understood as a record of how many times a dependent file is mapped, that is, how many running business processes share the dependent file. This can be recorded by a custom parameter or directly using parameters from the physical memory page management structure, such as `_mapcount`. The reference count of a dependent file represents the number of times the file is currently referenced. A dependent file can be referenced by multiple running business processes simultaneously. A reference count greater than or equal to 1 indicates that there are running business processes referencing the dependent file; a reference count of 0 indicates that there are currently no running business processes referencing the file.

[0059] The latch status of dependent files can be determined by controlling the current state of the physical memory pages. For example, if the latch status value is True, it means that the dependent file in the current physical memory page is latched; otherwise, it is not latched. Alternatively, the latch status of dependent files can be set using key-value pairs, such as using the dependent file name as the key and the latch status as the value.

[0060] Specifically, during the latching process of each dependent file cached in the physical memory page, all dependent files and their data information are traversed to determine the latching status of the dependent files. If a dependent file is not latched, latching is performed on the dependent file and the reference count of the dependent file is incremented by one. If a dependent file has been latched, repeated latching is not required for the dependent file; only the reference count of the dependent file needs to be incremented by one.

[0061] Optionally, latching of dependent files can be performed, including: calling a latching function, starting a latching service in the latching kernel module based on a pre-created latching device file, and performing latching of dependent files.

[0062] In this context, a latch function can specifically be a page-locking memory function, such as PageLocker. A key attribute of page-locked memory is that the operating system will not perform paging or swapping operations on the locked memory, ensuring that it always resides in physical memory. A device file can be understood as an interface to a device driver, stored in the file system. It typically provides a simple interface to standard devices (such as printers and serial ports), but can also be used to access specific unique resources on these devices (such as disk partitions). Correspondingly, a latch device file is a driver interface used for latching. Latch device files can be created using the `mknod` command. A kernel module can be understood as a single, very large program. The kernel dynamically loads modules for each hardware component. We can think of these dynamic modules as hardware drivers. By default, Linux hardware drivers do not require manual installation. If a function is critical, it will be directly compiled into the kernel; if it is not critical, such as a hardware driver, it will be compiled as a module and called by the kernel when needed. The latch kernel module contains latch services for handling latches.

[0063] Specifically, the operating system can pre-create a latch device file by executing the mknod command. When the latch function is called, the operating system can obtain the latch device file, call the latch service in the latch kernel module through the kernel module, and perform latch processing on the dependent files.

[0064] Furthermore, the latching process for each dependency file cached in the physical memory page also includes: decrementing the reference count of the dependency file corresponding to the exiting business process by one when any business process is detected to have exited; and unlocking the dependency file with a reference count of zero.

[0065] The exit of a business process can be detected by the operating system, such as by checking whether a shutdown command has been received from the system or whether the close button corresponding to the business process has been clicked.

[0066] Specifically, if the operating system detects an instruction or signal indicating that any business process has exited, the reference count of the dependent files corresponding to that business process will be decremented. If the reference count of a queried dependent file is 0, it means that the dependent file is no longer referenced by any other business process, and the physical memory page corresponding to that dependent file will be unlocked and released from latch.

[0067] Optionally, when the system starts, a process exit tracing function is registered. This function is used to capture the exit of business processes.

[0068] Specifically, the process exit tracing function can be understood as a function that terminates process operations and tracks the termination process. Before a process terminates, a process exit tracing function can be registered with the process. When the process terminates, the registered function will be automatically called. The process exit tracing function can be registered using the `atexit` function, and the registered function will be executed after the process exits normally. The registered function is specifically used to capture the exit processing operations of business processes.

[0069] Furthermore, the method of latching each dependent file cached in the physical memory page also includes forming a radix tree based on the file identifier and reference count of each dependent file.

[0070] In this context, a file identifier can be understood as an identifier set for a dependent file. One identifier corresponds to one dependent file, and this can be achieved by setting corresponding parameter variables, such as the file name. A page cache refers to a tree-like structure, called a radix tree, that organizes all the physical pages of a file in memory. This tree manages the cached content belonging to the same file in memory. All the physical pages corresponding to a file in memory can form a radix tree, which contains the file identifiers and reference counts of dependent files. The file identifiers and reference counts of dependent files are stored using key-value pairs, and the corresponding values ​​can be quickly looked up using these key-value pairs. For example, using the file identifier as the key and the reference count as the value, the corresponding dependent file can be directly found.

[0071] Specifically, when locking dependent files, a radix tree data structure is used to record the file identifier and reference count of the physical memory page corresponding to the dependent file.

[0072] In this embodiment, when dependent files are cached in physical memory pages, a page caching mechanism is used to cache them. After caching all dependent files in physical memory pages, all physical memory pages are latched, and a reference count is set to record the number of times the dependent file is referenced.

[0073] S130. During the memory reclamation process of physical memory pages, if any cache page file is latched, the latched cache page is skipped, and at least a portion of the unlatched cache pages are released.

[0074] Specifically, the recycling process can be understood as deleting at least a portion of the loaded data from a physical memory page, releasing that memory space, and freeing it up for use as a cached data. The triggering condition for recycling can be that the number or percentage of empty pages in the physical memory page is less than a preset threshold. In this embodiment, the specific operation of the recycling process can be to release at least a portion of the cached pages in the physical memory page that are not in a latched state.

[0075] Optionally, during the memory reclamation process of physical memory pages, files with a reference count greater than or equal to 1 in the radix tree are identified as latched files, and each latched file includes at least one latched cache page; files with a reference count equal to 0 in the radix tree are identified as unlatched files, and each unlatched file includes at least one unlatched cache page.

[0076] Specifically, based on the steps described above, the radix tree contains the file identifiers and reference counts of dependent files. During memory reclamation, all dependent files are traversed to obtain their corresponding reference counts. If the reference count is greater than or equal to 1, it indicates that the dependent file has been latched in a physical memory page. Therefore, it can be determined that the dependent file has been latched, meaning its corresponding cache page has been latched. A dependent file can be paged and cached in one or more physical memory pages; correspondingly, a latched file contains at least one latched cache page. When a file in the radix tree has a reference count of 0, it can be determined that this file is not referenced by any running business process, has not undergone latching, and is considered an unlatched file. It can be understood that unlatched files each contain at least one unlatched cache page.

[0077] In this embodiment, during the recycling process, at least some of the unlocked cache pages are released, while the locked cache pages are not recycled. The locked cache pages are referenced by business processes that are currently running, which avoids the situation where business processes in the running state cannot continue to run. While releasing the cache pages, the normal operation of the business processes is guaranteed.

[0078] Optionally, at least a portion of the unlocked cache pages may be released, including: determining the reference frequency of the unlocked cache pages and determining the cache pages to be released based on the reference frequency.

[0079] Reference frequency can be understood as the number of times a cached page is referenced, similar to the reference count of dependent files. Reference frequency can be recorded by setting corresponding parameters. Whether an unlocked cached page should be released depends on its reference frequency; the lower the reference frequency, the greater the probability of it being released.

[0080] Specifically, it iterates through all cache pages that have not been latched, determines the reference frequency of each cache page, and sorts the reference frequencies in ascending order. When the system needs to perform reclamation, it prioritizes reclamating cache pages with lower reference frequencies until the memory space after releasing some cache pages is sufficient for the system to run.

[0081] In this embodiment, during the reclamation of physical memory pages, all cache pages are traversed to determine whether they are latched. Latched cache pages are skipped without reclamation. For unlatched cache pages, their reclamation priority is determined based on their reference frequency. This reclamation method avoids reclaiming frequently referenced cache pages, reducing page faults and improving system performance.

[0082] The technical solution of this embodiment latches the files that each business process depends on during the execution of the application. It also records the number of times the dependent files are referenced using a radix tree data structure. This allows the operating system to skip latched cache pages and release other unlatched cache pages during the reclamation of physical memory pages. This avoids too many hard page faults, reduces the waiting time for data loading caused by hard page faults, and improves the stability of the system.

[0083] Example 2

[0084] Figure 2 This is a flowchart of the file processing method provided in Embodiment 2 of the present invention. This embodiment is a flowchart of the workflow applicable to the method of the above embodiments in an in-vehicle system. Figure 2 As shown, the steps of this workflow include:

[0085] S201, Vehicle system starts.

[0086] When the driver presses the vehicle start button to start the vehicle, the onboard system will also start.

[0087] S202, Install the lock kernel module.

[0088] During the startup process of the vehicle system, the built-in operating system can compile the source code of the lock kernel module and complete the installation of the lock kernel module.

[0089] S203, Registration process exit tracking function.

[0090] The operating system can use the atexit function to register a process exit tracking function, which is used to capture the exit of business processes.

[0091] S204. Create latch device file.

[0092] The operating system can create latch device files by executing the mknod command.

[0093] S205. Determine if any business processes have exited.

[0094] The operating system can execute a pre-set judgment function to make a judgment based on received information related to the business process. The business process information serves as the input parameter of the judgment function. If a business process has exited, the judgment function outputs "yes"; otherwise, it outputs "no". Alternatively, it can use a registered process exit tracking function, which also outputs "yes" or "no". If the output is "yes", then execute S211; if the output is "no", then execute S206.

[0095] S206. Determine if any business process has started the latch service.

[0096] The operating system can complete the judgment process by executing program code that determines whether the latching service has been started, and finally return yes or no. If the return result is yes, then S207 is executed; if the return result is no, then S205 is executed.

[0097] S207, Update the number of business processes.

[0098] If a business process is detected to have started the latch service, then it can be determined that a new business process has been started, and the operating system updates the number of business processes.

[0099] S208. Obtain the dependency files of the current process.

[0100] When a new business process starts, the kernel module will find all the dynamic libraries that the business program depends on, read the dynamic library data from the disk in turn, and load it into the physical memory page. In other words, the dependent files are read out and cached in the physical memory page.

[0101] S209. Use a radix tree to record unsaved dependency files, and increment the reference count of saved dependency files by one.

[0102] The radix tree records the dependency files obtained by the kernel module. The radix tree contains variables such as the file identifier and reference count for each dependency file. Before saving the dependency files, the reference count for each dependency file is 0. After saving, the reference count for the corresponding dependency file is incremented by one.

[0103] S210. Lock the retrieved cached page.

[0104] The business process calls a latching function, such as PageLocker, to start the latching service in the latching kernel module (LoaderK) via the latching device file. At this point, the kernel module retrieves the dependent files of the current process and stores them in a radix tree, then performs locking operations on all cached pages of the dependent files. Then, S205 is executed.

[0105] S211. Obtain the dependency files of the current process.

[0106] If a business process is detected to have exited, read all the dependency files corresponding to the current process.

[0107] S212, Decrease the reference count of dependent files by one.

[0108] Decrement the reference count of the dependent files obtained in S211 by one.

[0109] S213. Unlock dependency files with a reference count of 0.

[0110] When the reference count of a dependent file drops to 0, it means that the dependent file is no longer depended on by the business process. In the garbage collection process, the dependent file with a reference count of 0 will be unlocked, and the physical memory pages occupied by the dependent file will be released.

[0111] The technical solution of this embodiment, by installing a latch kernel module, registering a process exit tracking function, and creating a latch device file when the vehicle system starts up, utilizes the latch kernel module, functions, and device files generated in the above steps to perform locking and unlocking processing on the dependent files corresponding to the business processes. This reduces the occurrence of hard page faults, can also unlock physical memory pages in a timely manner, release memory space, reduce the frequency of insufficient memory space, and improve system performance.

[0112] Example 3

[0113] Figure 3 This is a schematic diagram of the structure of a file processing device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device includes:

[0114] The dependency file determination module 310 is used to determine the dependency files of a business process when the business process is detected to have started.

[0115] The dependency file latching module 320 is used to latch each dependency file cached in the physical memory page when each dependency file has been cached in the physical memory page;

[0116] The memory reclamation module 330 is used to, during the memory reclamation process of physical memory pages, skip any latched cache page if any cache page file is latched, and release at least a portion of the unlatched cache pages.

[0117] Optional, dependent on file latch module 320, specifically used for:

[0118] The cached dependency files in the physical memory pages are latched, including: for any dependency file, if the dependency file is not latched, the dependency file is latched and its reference count is incremented by one; if the dependency file is already latched, its reference count is incremented by one.

[0119] The process of latching dependent files includes: calling latching functions, starting the latching service in the latching kernel module based on a pre-created latching device file, and performing latching processing on the dependent files.

[0120] The latching process for each dependency file cached in the physical memory page also includes: decrementing the reference count of the dependency file corresponding to the exiting business process by one when the exit of any business process is detected; and unlocking the dependency file with a reference count of zero.

[0121] When the system starts, a process exit tracing function is registered. This function is used to capture the exit of business processes.

[0122] The method for latching each dependent file cached in the physical memory page also includes forming a radix tree based on the file identifier and reference count of each dependent file.

[0123] Optional, the memory reclamation module 330 is specifically used for:

[0124] During the memory reclamation process of physical memory pages, files with a reference count greater than or equal to 1 in the radix tree are identified as latched files, and each latched file includes at least one latched cache page; files with a reference count equal to 0 in the radix tree are identified as unlatched files, and each unlatched file includes at least one unlatched cache page.

[0125] Releasing at least a portion of the unlocked cache pages includes: determining the reference frequency of the unlocked cache pages, and determining the cache pages to be released based on the reference frequency.

[0126] The file processing apparatus provided in the embodiments of the present invention can execute the file processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.

[0127] Example 4

[0128] Figure 4 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0129] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0130] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0131] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as file processing methods.

[0132] In some embodiments, the file processing method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the file processing method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the file processing method by any other suitable means (e.g., by means of firmware).

[0133] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0134] Computer programs for implementing the document processing methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0135] Example 5

[0136] Embodiment 5 of the present invention also provides a computer-readable storage medium storing computer instructions for causing a processor to execute a file processing method, the method comprising:

[0137] If the startup of a business process is detected, determine the dependent files of that business process;

[0138] If all dependent files have been cached in physical memory pages, perform latching on each dependent file cached in the physical memory pages;

[0139] Furthermore, during the memory reclamation process of physical memory pages, if any cache page file is latched, the latched cache page is skipped, and at least a portion of the unlatched cache pages are released.

[0140] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0141] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0142] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0143] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0144] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0145] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A file processing method, characterized in that, include: Upon detecting the startup of a business process, the dependent files of the business process are determined; wherein, the dependent files are selected from all dynamic databases that the business process depends on, the dynamic databases are read sequentially from the system disk, and the corresponding dependent files are loaded and written into physical memory pages; If each of the dependent files has been cached in a physical memory page, the dependent files cached in the physical memory page are latched. In addition, during the memory reclamation process of physical memory pages, if any cache page containing the file is latched, the latched cache page is skipped, and at least a portion of the unlatched cache pages are released. The step of latching each of the dependent files cached in the physical memory page includes: For any of the dependent files, if the dependent file is not latched, the dependent file is latched and its reference count is incremented by one. If the dependent file is already latched, increment the reference count of the dependent file by one; The method further includes: A radix tree is formed based on the file identifier and reference count of each dependent file. Accordingly, during the memory reclamation process of physical memory pages, files with a reference count greater than or equal to 1 in the radix tree are identified as latched files, and the latched files include at least one latched cache page; Files with a reference count of 0 in the radix tree are identified as unlocked files, and each unlocked file includes at least one unlocked cache page.

2. The method according to claim 1, characterized in that, The latching process for the dependent files includes: The latch function is invoked to start the latch service in the latch kernel module based on the pre-created latch device file, and the dependent file is latched.

3. The method according to claim 1, characterized in that, The method further includes: If any business process is detected to have exited, the reference count of the dependent files corresponding to the exited business process is decremented by one. In addition, it unlocks dependency files with zero references.

4. The method according to claim 3, characterized in that, The method further includes: When the system starts, a process exit tracing function is registered, which is used to capture the exit of business processes.

5. The method according to claim 1, characterized in that, Releasing at least a portion of the unlocked cache pages, including: Determine the reference frequency of the unlocked cache pages, and determine the cache pages to be released based on the reference frequency.

6. A document processing device, characterized in that, include: The dependency file determination module is used to determine the dependency files of a business process when the business process is detected to have started; wherein the dependency files are selected from all dynamic databases that the business process depends on, the dynamic databases are read from the system disk in sequence, and the corresponding dependency files are loaded and written into physical memory pages; The dependency file latching module is used to latch each of the dependency files cached in the physical memory page when each of the dependency files has been cached in the physical memory page; The memory reclamation module is used to, during the memory reclamation process of physical memory pages, skip the latched cache page if any cache page of the file is latched, and release at least a portion of the unlatched cache pages; Specifically, the dependency file latching module is used to latch any dependency file if it is not latched, and increment the reference count of the dependency file by one; and to increment the reference count of the dependency file if it is latched. The apparatus is further configured to form a radix tree based on the file identifier and reference count of each dependent file; correspondingly, during the memory reclamation process of physical memory pages, files in the radix tree with a reference count greater than or equal to 1 are identified as latched files, and the latched files include at least one latched cache page; files in the radix tree with a reference count equal to 0 are identified as unlatched files, and the unlatched files each include at least one unlatched cache page.

7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the file processing method according to any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that are used to cause a processor to execute the file processing method of any one of claims 1-5.

Citation Information

Patent Citations

  • Memory scheduling method and device and computer readable storage medium

    CN112131009A

  • Method for accelerating starting of application program and electronic equipment

    CN112783564A