Linux system quick starting method and device based on dormancy mechanism optimization

By optimizing the hibernation mechanism of the Linux system, compressing memory and generating a minimized image during the shutdown phase, and directly booting with a trimmed boot kernel during the wake-up phase, the problem of slow Linux system startup speed is solved, and a faster startup process is achieved.

CN121116403APending Publication Date: 2025-12-12UNIONTECH SOFTWARE TECH CO LTD

Patent Information

Application Number
CN202511187198.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-22
Publication Date
2025-12-12

AI Technical Summary

Technical Problem

The low boot efficiency of Linux systems is mainly due to redundant initialization processes, excessively large hibernation images, and excessively long boot times caused by dual hardware initialization.

Method used

The hibernation mechanism is optimized by actively releasing memory cache and temporary data during the shutdown phase to generate a minimal hibernation image, which is then directly started by the trimmed boot kernel during the wake-up phase, avoiding redundant hardware initialization and service startup processes.

Benefits of technology

It significantly improves the boot speed of Linux systems, reduces I/O operation time, optimizes the boot process, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121116403A_ABST
    Figure CN121116403A_ABST
Patent Text Reader

Abstract

The invention discloses a Linux system quick starting method and device based on dormancy mechanism optimization. The method comprises the following steps: in response to detection of shutdown, executing the following dormancy operations: actively releasing a memory cache and temporary data, setting the size of a dormancy mirror image as a preset lower limit value, and generating the dormancy mirror image with the corresponding size; and in response to detecting that the system is powered on, executing the following wake-up operation: directly starting by the clipped boot kernel, and after the clipped boot kernel is started and before the initial memory disk is initialized, reading the sleep mirror image and restoring the system state. According to the Linux system quick starting method based on dormancy mechanism optimization, the starting speed of the Linux system can be remarkably increased by optimizing the core process of the dormancy mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of operating system technology, specifically to a method and apparatus for fast startup of a Linux system based on a hibernation mechanism optimization. Background Technology

[0002] Currently, the Windows operating system employs a "fast startup" mechanism, which saves the system kernel and driver state to a hibernation file (hiberfil.sys) before shutdown and restores it directly upon startup, thus significantly reducing boot time. In contrast, although the Linux system supports hibernation and wake-up mechanisms, its boot efficiency is still limited by factors such as kernel loading, driver initialization, and graphics card startup, resulting in a poorer user experience.

[0003] The current Linux desktop system boot process suffers from significant performance bottlenecks. The traditional boot process involves multiple stages, including BIOS (Basic Input / Output System) self-test, GRUB (GRand Unified Bootloader) boot loading, kernel initialization, initrd (initial RAM disk) decompression, and systemd (Linux system and service manager) service startup. This entire process is time-consuming and severely impacts user experience. While Linux supports hibernation, enabling rapid recovery by saving the system state to disk, existing hibernation solutions suffer from the following key drawbacks:

[0004] Redundant initialization process: Upon wakeup, the system needs to first start a complete boot kernel, load all necessary drivers, and initialize memory management before it can restore the hibernation image. This process repeats the hardware detection and initialization work performed during normal startup, resulting in wasted time.

[0005] Excessively large hibernation image: Traditional hibernation mechanisms save the entire system's memory state, including cache and temporary data, resulting in a bloated image file that requires a long loading and decompression time during recovery.

[0006] Dual hardware initialization: During hibernation and wake-up, the hardware device needs to go through two power-down and power-up processes (suspend / resume), which adds unnecessary latency.

[0007] Due to the shortcomings of existing hibernation schemes, the current Linux system has low boot efficiency, and there is an urgent need for an innovative fast boot solution. Summary of the Invention

[0008] This application provides a method and apparatus for fast booting a Linux system based on a hibernation mechanism optimization.

[0009] In a first aspect, this application provides a method for fast startup of a Linux system based on a hibernation mechanism, comprising the following steps: in response to detecting a shutdown, performing the following hibernation operations: actively releasing memory cache and temporary data, setting the hibernation image size to a preset lower limit value, and generating a hibernation image of the corresponding size; in response to detecting a system power-on, performing the following wake-up operations: directly starting from a trimmed boot kernel, and after the trimmed boot kernel starts but before the initial memory disk initialization, reading the hibernation image and restoring the system state.

[0010] In some alternative implementations, the trimmed boot kernel includes only the device drivers required to load the hibernation image.

[0011] In some optional implementations, after the trimmed boot kernel starts up and before the initial memory disk initialization, the hibernation image is read and the system state is restored. The method further includes: during the device wake-up phase after the trimmed boot kernel starts up and before the initial memory disk initialization, the hibernation image is read and the system state is restored.

[0012] In some optional implementations, the hibernation operation specifically includes: checking whether an EFI STUB exists and whether a fast boot configuration exists; if an EFI STUB exists and a fast boot configuration exists, then performing the operation of actively releasing memory cache and temporary data, setting the hibernation image size to a preset lower limit value, and generating a hibernation image of the corresponding size.

[0013] In some optional implementations, the wake-up operation specifically includes: checking if an EFI STUB exists; if an EFI STUB exists, checking if a trimmed boot kernel already exists; if it does, modifying the EFI STUB kernel to the trimmed boot kernel, specifying the location of the hibernation image in the boot project, and then directly booting from the trimmed boot kernel; after the trimmed boot kernel starts and before the initial memory disk initialization, reading the hibernation image and restoring the system state.

[0014] In some optional implementations, after checking whether an EFI STUB exists, the wake-up operation further includes: if an EFI STUB does not exist, adding a fastboot grub boot entry in the unified boot loader, checking whether a trimmed boot kernel already exists, and if so, modifying the fastboot kernel to the trimmed boot kernel, specifying the location of the hibernation image in the boot entry, and then directly booting from the trimmed boot kernel. After the trimmed boot kernel boots and before the initial memory disk initialization, reading the hibernation image and restoring the system state.

[0015] In some alternative implementations, after checking whether a trimmed boot kernel already exists if an EFI STUB exists, the method further includes: if no trimmed boot kernel exists, retaining the default kernel; and after adding a fastboot grub boot entry in the unified boot loader if an EFI STUB does not exist, and checking whether a trimmed boot kernel already exists, the method further includes: if no trimmed boot kernel exists, retaining the default kernel.

[0016] Secondly, this application provides a Linux system fast boot device based on a hibernation mechanism, comprising: a hibernation module configured to perform the following hibernation operations in response to detecting a shutdown: actively releasing memory cache and temporary data, setting the hibernation image size to a preset lower limit value, and generating a hibernation image of the corresponding size; and a wake-up module configured to perform the following wake-up operations in response to detecting a system power-on: directly booting from a trimmed boot kernel, and after the trimmed boot kernel boots but before the initial memory disk initialization, reading the hibernation image and restoring the system state.

[0017] In some alternative implementations, the trimmed boot kernel includes only the device drivers required to load the hibernation image.

[0018] In some optional implementations, the wake-up module is further configured to read the hibernation image and restore the system state during the device wake-up phase after the trimmed boot kernel has started and before the initial memory disk initialization.

[0019] In some optional implementations, the hibernation module is further configured to: check whether EFI STUB exists and whether there is a fast boot configuration; if EFI STUB exists and there is a fast boot configuration, then perform the operation of actively releasing memory cache and temporary data, setting the hibernation image size to a preset lower limit value, and generating a hibernation image of the corresponding size.

[0020] In some optional implementations, the wake-up module is further configured to: check if EFI STUB exists; if EFI STUB exists, check if a trimmed boot kernel already exists; if it does, modify the EFI STUB kernel to the trimmed boot kernel, specify the location of the hibernation image in the boot project, and then directly boot from the trimmed boot kernel. After the trimmed boot kernel starts and before the initial memory disk initialization, read the hibernation image and restore the system state.

[0021] In some optional implementations, the wake-up module is further configured to: after checking whether an EFI STUB exists, if no EFI STUB exists, add a fastboot grub boot entry in the unified boot loader, check whether a trimmed boot kernel already exists, and if so, modify the fastboot kernel to the trimmed boot kernel, specify the location of the hibernation image in the boot entry, and then boot directly from the trimmed boot kernel. After the trimmed boot kernel boots and before the initial memory disk initialization, read the hibernation image and restore the system state.

[0022] In some optional implementations, the wake-up module is further configured to: after checking whether a trimmed boot kernel already exists if EFI STUB exists, retain the default kernel if no trimmed boot kernel exists; and after adding a fastboot grub boot entry in the unified boot loader if EFI STUB does not exist, checking whether a trimmed boot kernel already exists, retain the default kernel if no trimmed boot kernel exists.

[0023] Thirdly, this application provides a computer device, including: one or more processors; and a storage device having one or more programs stored thereon, which, when executed by the one or more processors, cause the one or more processors to perform the method as described in the first aspect.

[0024] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by one or more processors, implements the method described in the first aspect.

[0025] To address the technical problem of insufficient startup speed in current Linux systems, this application proposes a fast startup method for Linux systems based on hibernation mechanism optimization. The core process of the hibernation mechanism is optimized in the following ways: (1) Optimize the efficiency of hibernation file generation by releasing memory and compressing images during the shutdown phase; (2) Optimize the wake-up process by trimming the boot kernel (i.e., startup kernel) and redundant device initialization processes. In this way, the startup speed of Linux systems can be significantly improved. Attached Figure Description

[0026] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings. The drawings are for illustrative purposes only and are not intended to limit the invention. In the drawings:

[0027] Figure 1 This is a flowchart illustrating the boot process of an existing Linux system;

[0028] Figure 2 This is a flowchart illustrating the hibernation process of an existing Linux system;

[0029] Figure 3 This is a flowchart illustrating the wake-up process of an existing Linux system;

[0030] Figure 4 This is a flowchart illustrating a fast boot method for a Linux system based on a hibernation mechanism optimized according to an embodiment of this application;

[0031] Figure 5 This is a timing diagram of the fast boot configuration enabling process in a specific application scenario embodiment of this application;

[0032] Figure 6 This is a timing diagram of the quick shutdown configuration shutdown process in a specific application scenario embodiment of this application;

[0033] Figure 7 This is a schematic diagram of a Linux system fast boot device based on a hibernation mechanism optimized according to an embodiment of this application;

[0034] Figure 8 This is a schematic diagram of the hardware configuration of a computer device according to an embodiment of this application. Detailed Implementation

[0035] In order to gain a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference and illustration only and are not intended to limit the embodiments of this application.

[0036] refer to Figure 1 , Figure 1 This is a flowchart illustrating the boot process of an existing Linux system. For example... Figure 1 As shown, the boot process of an existing Linux system includes the following steps.

[0037] Step 101: After power is turned on, BIOS / UEFI (Unified Extensible Firmware Interface) initializes: responsible for initializing hardware and finding boot devices.

[0038] Step 102, Bootloader: such as GRUB, used to load the Linux kernel and initramfs (initial RAMfile system).

[0039] Step 103, Loading and initializing the kernel (vmlinuz): This includes decompressing the kernel itself, initializing basic hardware drivers, and initializing the kernel subsystem.

[0040] Step 104: Mount the root file system: Mount initramfs or rootfs (root file system).

[0041] Step 105: Start init (initialization process), such as systemd / init: the first process in user space (PID1).

[0042] Step 106, Service Startup: Perform system service initialization, enter multi-user mode / graphical interface, and start services such as network, logs, and graphical interface according to configuration.

[0043] Step 107: Finally, you will enter the user login / desktop environment interface.

[0044] refer to Figure 2 , Figure 2 This is a flowchart illustrating the hibernation process of an existing Linux system (Linux desktop system). For example... Figure 2 As shown, the hibernation process of an existing Linux system includes the following steps.

[0045] Step 201: After triggering hibernation, freeze the process.

[0046] Step 202: Release some memory

[0047] Step 203: The device enters the suspend-freeze state (i.e., suspend and receive the power management suspend-freeze message PMSG_FREEZE).

[0048] Step 204: Power off the device, specifically power off the non-boot processor (Boot CPU).

[0049] Step 205: Save the CPU (Central Processing Unit) status.

[0050] Step 206: Create a hibernation image.

[0051] Step 207: Power on the device.

[0052] Step 208: Device resumes operation (i.e., upon receiving the power management recovery message PMSG_RESTORE).

[0053] Step 209: Write the hibernation image to the disk.

[0054] Step 210: Power off the entire machine.

[0055] As can be seen from the above process, before hibernation, there is a suspend-freeze (PMSG_FREEZE) and then a resume-unfreeze (PMSG_RESTORE). The reason for suspending is to allow the system to reach a stable state point, and the reason for resuming is to write the hibernation image to the disk, so the relevant disk devices need to be working properly.

[0056] refer to Figure 3 , Figure 3 This is a flowchart illustrating the wake-up process of an existing Linux system (Linux desktop system). For example... Figure 3 As shown, the wake-up process of an existing Linux system includes the following steps.

[0057] Step 301: Boot kernel (boot or start kernel) Start normally.

[0058] Step 302: Check if there is a hibernation image. You can check if there is a hibernation image in initrd (initial memory disk) or in late_initcall (late initialization call, or late initialization hook).

[0059] Step 303: Read the hibernation image into memory.

[0060] Step 304: Freeze the process.

[0061] Step 305: The device enters the suspend-freeze state (i.e., suspend and receive the power management suspend-freeze message PMSG_FREEZE).

[0062] Step 306: Copy the hibernation image to the actual memory space.

[0063] Step 307: Switch to the target kernel, which is the kernel saved in the hibernation image.

[0064] Step 308: Restore CPU status.

[0065] Step 309: Power on the device.

[0066] Step 310: Device restoration (restore), or restore-unfreeze (i.e., PMSG_RESTORE).

[0067] Step 311: Unfreeze the process.

[0068] As mentioned above, when waking up, the kernel needs to be started normally once. At this time, the kernel is called the bootkernel. Then, the hibernation image is checked. If the hibernation image exists, the wake-up action will be performed.

[0069] The main drawbacks of the existing wake-up process are: repeated hardware initialization, excessively large hibernation image files, and dual power-on and power-off (i.e., dual hardware initialization) leading to low startup efficiency.

[0070] refer to Figure 4 , Figure 4 This is a flowchart illustrating a fast boot method for a Linux system based on a hibernation mechanism optimized according to one embodiment of this application. The method of this application aims to solve the problem of slow boot times in existing Linux systems, especially Linux desktop systems. This method combines the characteristics of the hibernation process and optimizes some redundant initialization and resource loading processes, further improving device boot efficiency. The core idea of ​​this method is to achieve rapid saving and restoration of system state through deep optimization of the Linux hibernation mechanism.

[0071] like Figure 4 As shown, the Linux system fast startup method based on hibernation mechanism optimization proposed in this application includes:

[0072] Step 401: In response to the detection of shutdown, perform the following hibernation operations: actively release memory cache and temporary data, set the hibernation image size to a preset lower limit value, and generate a hibernation image of the corresponding size;

[0073] Step 402: In response to the detection of system power-on, perform the following wake-up operation: directly boot from the trimmed boot kernel; after the trimmed boot kernel boots and before the initial memory disk initialization, read the hibernation image and restore the system state.

[0074] In some alternative implementations, the trimmed boot kernel includes only the device drivers required to load the hibernation image.

[0075] In some alternative implementations, after the trimmed boot kernel starts up and before the initial memory disk initialization, the hibernation image is read and the system state is restored. The method further includes: during the device wake-up phase (i.e., the resume phase) after the trimmed boot kernel starts up and before the initial memory disk initialization, the hibernation image is read and the system state is restored.

[0076] As described above, the method of this application has been briefly explained. In summary, the method of this application specifically includes the following key technical improvements.

[0077] 1. Dynamic hibernation image optimization: Actively release memory cache and temporary data before system shutdown to generate a minimal hibernation image, significantly reducing IO operation time.

[0078] 2. Boot Process Restructuring: The wake-up path has been redesigned to begin restoring the system state early in the kernel boot process, avoiding redundant hardware initialization and service startup procedures. Specifically, wake-up can begin during the kernel resume phase, eliminating the need for initrd (initial memory disk) initialization and redundant device initialization.

[0079] 3. Simplify the boot mechanism: Reduce the size of the wake-up kernel (i.e., the startup kernel or boot kernel) and optimize redundant kernel initialization processes. The scaled-down boot kernel retains only the kernel modules related to loading the image—device drivers. The streamlined kernel used to load the hibernation image serves as the hibernation boot kernel. Specifically, only login-related desktop components can be retained, and maximum memory reclamation and extreme image compression are performed before hibernation.

[0080] refer to Figure 5 , Figure 5 This is a timing diagram of the quick boot configuration startup process in a specific application scenario embodiment of this application.

[0081] against Figure 5 The key steps in the timing sequence are explained below:

[0082] 5.1 When a user enables fast boot configuration, the system first checks if the conditions are met. If not, a message indicating the reason for the failure will be displayed; if the conditions are met, proceed to the next step.

[0083] 5.2 Desktop-related configuration writing: Write desktop components to the configuration file to enable fast startup.

[0084] 5.3 Check if EFI STUB (Extensible Firmware Interface Stub Bootloader, abbreviated as EFI stub bootloader) exists (supports).

[0085] 5.4 If EFI STUB direct boot is supported, perform the following operations:

[0086] Add a new fast startup configuration parameter to indicate that fast startup is currently enabled. Also, add a `resume=swap` partition to the startup items, and modify the boot kernel `BOOT_IMAGE=xxx` according to whether a boot kernel exists.

[0087] Specifically, first check if a boot kernel already exists. If a boot kernel already exists, change the EFI STUB kernel to the boot kernel; if no boot kernel exists, retain the default kernel. Regardless of whether a boot kernel exists, add the hibernation recovery parameter `resume=xx(swap partition)` to the boot program to specify the location of the hibernation image, and delete other unnecessary configuration items. End.

[0088] 5.5 If EFTSUB does not exist (is not supported), then do the following:

[0089] In GRUB, add a new fastboot entry based on the current default kernel. In the boot entry, add a resume=swap partition, and modify the boot kernel BOOT_IMAGE=xxx depending on whether a boot kernel exists.

[0090] Specifically, a new fastboot GRUB boot entry is added. GRUB checks if a boot kernel exists. If it does, fastboot will switch and modify the kernel to the boot kernel; otherwise, the default kernel will be retained. Regardless of whether a boot kernel exists, fastboot will then add resume=xx (swap partition) to specify the location of the hibernation image.

[0091] Steps 5.1 to 5.5 above correspond to, for example: Figure 4 Step 402 in the Linux system fast startup method based on hibernation mechanism optimization shown is a refinement of step 402 in a specific application scenario embodiment.

[0092] refer to Figure 6 , Figure 6This is a timing diagram of the quick shutdown configuration shutdown process in a specific application scenario embodiment of this application.

[0093] against Figure 6 The key steps in the timing sequence are explained below:

[0094] 6.1 After detecting that the user has shut down the computer, first check whether fast startup is enabled. If not, proceed with the normal shutdown process. If it is enabled, check whether the relevant fast startup conditions are met. If not, proceed with the normal shutdown process.

[0095] 6.2 Check if EFI STUB exists. If EFI STUB is supported and fast boot configuration is enabled, skip to step 6.4.

[0096] 6.3 If EFI STUB is not supported, check if there is a fast boot configuration in the GRUB boot entries. If not, proceed with the normal shutdown process. Otherwise, set the boot entry for the next boot session using `sudo grub-reboot` based on the location of the fast boot configuration.

[0097] 6.4 Desktop component hibernation preparation.

[0098] 6.5 Release cache (memory cache and temporary data): echo 3> / proc / sys / vm / drop_caches.

[0099] 6.6 Set the minimum hibernation image size: echo 0> / sys / power / image_size.

[0100] 6.7 To hibernate: echo disk> / sys / power / state.

[0101] 6.8 If hibernation is successful, the process is complete; if hibernation fails, proceed with the normal shutdown procedure.

[0102] Steps 6.1 to 6.8 above correspond to, for example: Figure 4 Step 401 in the Linux system fast startup method based on hibernation mechanism optimization shown is a refinement of step 401 in a specific application scenario embodiment.

[0103] Next, combined with, for example Figure 5 The boot process shown and as follows Figure 6 The shutdown process shown illustrates the beneficial effects of this application.

[0104] (1) Steps 5.3-5.4 utilize the characteristics of hibernation. The first kernel boot during hibernation wake-up is called the bootkernel. This kernel only needs to ensure image loading and does not require complete device drivers for the current machine. Therefore, we set the fast-boot kernel as a trimmed kernel. The trimming method is to retain only the device drivers related to loading and compressing the image, mainly including the NVMe driver and related parent device driver interfaces. This can optimize the boot time by about 1-2 seconds.

[0105] (2) Steps 5.3-5.6 advance the regular wake-up process to the kernel startup, eliminating the need to wait for the initrd to finish booting. This avoids the initfs file and some redundant device initialization processes, optimizing the time by about 0.5 seconds.

[0106] (3) Step 5.3 adds the EFISTUB mechanism to fast startup, which can skip GRUB and reduce the loading time of GRUB. It can optimize the time by about 1-2 seconds.

[0107] (4) Steps 6.4-6.7 minimize the size of the hibernation image by optimizing desktop components and releasing memory. This reduces the time spent on image decompression and loading, optimizing the time by about 1-1.5 seconds.

[0108] (5) Step 6.7 The image will be recreated every time the device is shut down, which can avoid the risks caused by device updates and system updates and is more robust.

[0109] refer to Figure 7 , Figure 7 This is a schematic diagram of a Linux system fast boot device 700 based on a hibernation mechanism optimized according to an embodiment of this application. This device embodiment is similar to... Figure 4 The method embodiments shown correspond to the implementation of the above method.

[0110] like Figure 7 As shown, the Linux system fast boot device 700 based on hibernation mechanism optimization of this application may include:

[0111] The hibernation module 701 is configured to perform the following hibernation operations in response to a detected shutdown: actively release memory cache and temporary data, set the hibernation image size to a preset lower limit, and generate a hibernation image of the corresponding size;

[0112] The wake-up module 702 is configured to perform the following wake-up operations in response to detecting system power-on: directly booting from the trimmed boot kernel, and after the trimmed boot kernel has started but before the initial memory disk initialization, reading the hibernation image and restoring the system state.

[0113] In some alternative implementations, the trimmed boot kernel includes only the device drivers required to load the hibernation image.

[0114] In some alternative implementations, the wake-up module 702 is further configured to read the hibernation image and restore the system state during the device wake-up phase after the trimmed boot kernel has started and before the initial memory disk initialization.

[0115] In some optional implementations, the hibernation module 701 is further configured to: check whether an EFI STUB exists and whether a fast boot configuration exists; if an EFI STUB exists and a fast boot configuration exists, perform the operation of actively releasing memory cache and temporary data, setting the hibernation image size to a preset lower limit value, and generating a hibernation image of the corresponding size.

[0116] In some optional implementations, the wake-up module 702 is further configured to: check if EFI STUB exists; if EFI STUB exists, check if a trimmed boot kernel already exists; if it does, modify the EFI STUB kernel to the trimmed boot kernel, specify the location of the hibernation image in the boot project, and then boot directly from the trimmed boot kernel. After the trimmed boot kernel boots and before the initial memory disk initialization, the hibernation image is read and the system state is restored.

[0117] In some optional implementations, the wake-up module 702 is further configured to: after checking whether EFI STUB exists, if EFI STUB does not exist, add a fastboot grub boot entry in the unified boot loader, check whether a trimmed boot kernel already exists, if it does, modify the fastboot kernel to the trimmed boot kernel, specify the location of the hibernation image in the boot entry, and then boot directly from the trimmed boot kernel. After the trimmed boot kernel boots and before the initial memory disk initialization, read the hibernation image and restore the system state.

[0118] In some alternative implementations, the wake-up module 702 is further configured to: if an EFI STUB exists, check if a trimmed boot kernel already exists; if no trimmed boot kernel exists, retain the default kernel; and if an EFI STUB does not exist, add a fastboot grub boot entry in the unified boot loader, check if a trimmed boot kernel already exists; if no trimmed boot kernel exists, retain the default kernel.

[0119] It should be noted that the implementation details and technical effects of each module in the device of this embodiment can be found in the descriptions of other embodiments in this application, and will not be repeated here. The implementation schemes of each module of this device are diverse, as long as the purpose of the module can be achieved, and the actual deployment is not limited to the specific implementation scheme.

[0120] refer to Figure 8 , Figure 8 This is a schematic diagram of the structure of a computer device for implementing a server according to an embodiment of this application. Figure 8 As shown, the computer device 800 of this application may include:

[0121] One or more processors 801;

[0122] Memory 802, on which one or more programs 803 are stored;

[0123] Components such as processor 801 and memory 802 can be coupled together via bus system 804; bus system 804 is used to realize the connection and communication between these components.

[0124] When one or more programs 803 are executed by one or more processors 801, the one or more processors 801 implement the Linux system fast startup method based on hibernation mechanism optimization as disclosed in the above method embodiments.

[0125] The bus system 804 may include a data bus, a power bus, a control bus, and a status signal bus. The memory 802 may be volatile or non-volatile, or both. The processor 801 may be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0126] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by one or more processors, implements the Linux system fast startup method based on hibernation mechanism optimization as disclosed in the above method embodiments.

[0127] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0128] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0129] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0130] It should be understood that the terms "system" and "network" are often used interchangeably in this application. The term "and / or" in this application is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Furthermore, the character " / " in this application generally indicates that the preceding and following related objects have an "or" relationship.

[0131] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for fast startup of a Linux system based on a hibernation mechanism, characterized in that, Includes the following steps: In response to the detection of shutdown, the following hibernation operations are performed: actively release memory cache and temporary data, set the hibernation image size to a preset lower limit, and generate a hibernation image of the corresponding size; In response to the detection of system power-on, the following wake-up operations are performed: the system is directly booted by the trimmed boot kernel; after the trimmed boot kernel has started but before the initial memory disk initialization, the hibernation image is read and the system state is restored.

2. The method according to claim 1, characterized in that, The trimmed boot kernel includes only the device drivers required to load the hibernation image.

3. The method according to claim 1, characterized in that, After the trimmed boot kernel starts and before the initial memory disk initialization, the hibernation image is read and the system state is restored. The method further includes: After the trimmed boot kernel starts up, and during the device wake-up phase before the initial memory disk initialization, the hibernation image is read and the system state is restored.

4. The method according to claim 1, characterized in that, The hibernation operation specifically includes: Check if an EFI STUB exists and if a fast boot configuration exists. If an EFI STUB exists and a fast boot configuration exists, perform the operation of actively releasing memory cache and temporary data, setting the hibernation image size to a preset lower limit, and generating a hibernation image of the corresponding size.

5. The method according to claim 1, characterized in that, The wake-up operation specifically includes: Check if an EFI STUB exists; If EFI STUB exists, check if a trimmed boot kernel already exists. If it does, modify the EFI STUB kernel to the trimmed boot kernel and specify the location of the hibernation image in the boot project. Then, boot directly from the trimmed boot kernel. After the trimmed boot kernel boots and before the initial memory disk initialization, read the hibernation image and restore the system state.

6. The method of claim 5, characterized in that, After checking for the presence of an EFI STUB, the wake-up operation further includes: If EFI STUB does not exist, add a fastboot grub boot entry in the unified boot loader, check if a trimmed boot kernel already exists, and if it does, modify the fastboot kernel to the trimmed boot kernel, specify the location of the hibernation image in the boot entry, and then boot directly from the trimmed boot kernel. After the trimmed boot kernel boots and before the initial memory disk initialization, read the hibernation image and restore the system state.

7. The method of claim 6, characterized in that, After checking whether a trimmed boot kernel already exists if an EFI STUB exists, the method further includes: if no trimmed boot kernel exists, retaining the default kernel; and After adding a fastboot grub boot entry in the unified bootloader if EFI STUB does not exist and checking if a trimmed boot kernel already exists, the method further includes: if no trimmed boot kernel exists, retaining the default kernel.

8. A Linux system fast boot device based on a hibernation mechanism, characterized in that, include: The hibernation module is configured to perform the following hibernation operations in response to a detected shutdown: actively release memory cache and temporary data, set the hibernation image size to a preset lower limit, and generate a hibernation image of the corresponding size; The wake-up module is configured to perform the following wake-up operations in response to detecting system power-on: directly booting from the trimmed boot kernel, and after the trimmed boot kernel has booted and before the initial memory disk initialization, reading the hibernation image and restoring the system state.

9. A computer device, characterized in that, include: One or more processors; Storage device, on which one or more programs are stored, When the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by one or more processors, implements the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Operating system recovery method and device and terminal equipment

    CN103729211A

  • Deep sleep method, awakening method and sleep and awakening method of system on chip

    CN111506351A

  • System sleep memory management method and device based on Linux kernel

    CN113392038A

  • Mirror starting optimization of built-in operation system

    CN1818869A

Cited By

  • Swap exchange partition reservation method and device, storage medium and program product

    CN121764412A

  • Swap partition reservation method, device, storage medium and program product

    CN121764412B