System Startup with Kernel Page-Cache Preloading
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional system startup methods in terminal devices face delays and congestion due to the need for disk file system checks (fsck) after sudden power-offs, which require disk read/write operations, increasing startup time.
Innovation Solution
A first thread is created in the kernel mode to pre-cache metadata of a disk partition into a page cache, allowing direct reading from the cache during subsequent fsck and mount processes, leveraging the higher read/write speed of memory over disks.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If file system check (fsck) is performed on disk partition during system startup, then disk availability and reliability are ensured, but system startup time increases due to disk read/write operations and congestion
Solution Approach 1:
The patent applies preliminary action by creating a pre-read thread during system startup that reads disk partition metadata into page cache before the fsck process executes. This advance preparation stores frequently accessed metadata in memory, so when fsck needs to verify the file system, it reads from the already-cached metadata rather than performing additional disk read operations. This resolves the contradiction by ensuring reliability through proper fsck execution while reducing startup time by eliminating redundant disk I/O operations.
2Reliability
If disk read/write operations are performed during fsck process, then file system integrity is verified, but system congestion occurs and startup speed decreases
Solution Approach 1:
The patent applies the copying principle by creating a copy of disk partition metadata and storing it in page cache during system startup. When the fsck process needs to verify file system integrity, it operates on this cached copy rather than repeatedly accessing the original disk. This allows fsck to perform its integrity verification function while avoiding the speed penalty of multiple disk read operations, as the metadata is readily available in memory from the preliminary copy operation.
3Measurement precision
If metadata is read from disk during fsck process, then accurate file system information is obtained, but I/O congestion increases and startup time is extended
Solution Approach 1:
The patent applies preliminary action by pre-reading and caching disk partition metadata into page cache before the fsck process begins. This advance preparation ensures that when fsck needs accurate file system information, the metadata is already available in memory in its original, unmodified form. The preliminary caching action separates the I/O intensive reading operation from the verification process, maintaining measurement precision while eliminating the time penalty of repeated disk access during fsck execution.
Data Source
Figure 1
Figure 2
Figure 3~4
AI summary
Embodiments of this application disclose a system startup method and a related device. The method includes: creating a first thread when a kernel driver in a kernel mode detects a first disk partition; reading, in the kernel mode, metadata of the first disk partition by using the first thread; and writing the metadata of the first disk partition into a first page cache by using the first thread. In the kernel mode, metadata of a disk partition is pre-cached into a page cache by using the first thread, and in a subsequent process in a user mode, the metadata of the disk partition may be directly read from the page cache. A storage area of the page cache is memory and has a higher read/write operation rate compared with a disk. Therefore, congestion occurring when a system of a terminal device starts can be effectively avoided, and time required for system startup can be reduced.