CN102012823A - Method and device for quickly restarting computer - Google Patents
Method and device for quickly restarting computer Download PDFInfo
- Publication number
- CN102012823A CN102012823A CN2009101714633A CN200910171463A CN102012823A CN 102012823 A CN102012823 A CN 102012823A CN 2009101714633 A CN2009101714633 A CN 2009101714633A CN 200910171463 A CN200910171463 A CN 200910171463A CN 102012823 A CN102012823 A CN 102012823A
- Authority
- CN
- China
- Prior art keywords
- new kernel
- new
- computer
- module
- entry
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 52
- 230000009191 jumping Effects 0.000 claims description 9
- 238000012545 processing Methods 0.000 claims description 3
- 238000002360 preparation method Methods 0.000 abstract 1
- 230000006870 function Effects 0.000 description 10
- 230000002093 peripheral effect Effects 0.000 description 3
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Landscapes
- Stored Programmes (AREA)
Abstract
The invention provides a method for quickly restarting a computer, comprising the steps of: storing a new kernel and loading a guidance code by a computer when the computer receives a command about restarting an operating system, wherein the guidance code is a code independent of position and a global variable is accessed relative to the current operation address; executing a step of shutting down the operating system by the computer, wherein the new kernel information required by the computer during the preparation of restarting at least comprises the size of the new kernel and the physical address of an inlet during the execution; skipping to an inlet of the guidance code by the computer so as to introduce the new kernel information as a parameter; and skipping to the physical address of the inlet during the execution by the computer so as to execute the new kernel and finish the quick starting process. Correspondingly, the invention also provides a device for quickly restarting the computer, which comprises a guidance module, a storage module, an operating system shutdown module and a loading module. The method and the device greatly shorten the offline time of the operating system and simplify the starting process.
Description
Technical Field
The present invention relates to computer systems, and more particularly, to a method and apparatus for quickly rebooting a computer.
Background
With the continuous development of embedded systems, in order to implement more complex functions, more and more external devices need to be initialized in the boot stage, and the boot program is designed to be more and more complex, which results in great reduction of the start speed. Thus, when a system needs to be restarted with some important components updated, the time it takes to get the system offline to the next online when restarting is started is increasingly longer, which is unacceptable in certain applications.
In the prior art, the designer of the operating system usually selects the technology of microkernel design and loadable modules, and tries to avoid restarting the system when modifying part of the functions. However, when the kernel is modified, the operation of restarting the system cannot be avoided.
When the system needs to be restarted, the designer usually performs some processing on the current state, such as saving data in the current cache, notifying all processes to exit, and the like, and then resets the whole system by using the function of the watchdog or the power management chip. Such as: if the watchdog is used for resetting, the processor enters an internal self-checking state after being reset, a bootstrap program is read from the outside after the self-checking is finished, the bootstrap program initializes the necessary peripheral hardware, and then the kernel of the operating system is booted.
Thus, the current computer restart process involves: after the processor is reset, the bootstrap program is reloaded; after the initialization of the processor and the peripheral devices is finished by the boot lead, trying to read and load an operating system kernel; after the kernel of the operating system is started, necessary software and hardware initialization is carried out, and then an application program is loaded; and after the application program starts to run normally, the system enters the online state again. Restarting the operating system in this manner currently takes the system offline for a long time.
Disclosure of Invention
The invention aims to provide a method and a device for quickly restarting a computer, which can realize quick start of a computer system.
In order to solve the above problem, the present invention provides a method for quickly rebooting a computer, comprising:
after the computer receives a command of restarting an operating system, the computer stores a new kernel and loads a boot code; the boot code is a code irrelevant to the position, and accesses a global variable relative to a current running address;
the computer executes to close the operating system;
the computer prepares the new kernel information needed when restarting, including at least the size of the new kernel and the physical address of the entry when executing;
the computer jumps to the boot code entrance to transmit the new kernel information as a parameter;
and the computer jumps to the physical address of the execution entry to execute the new kernel, and the quick starting process is finished.
Further, the method also has the following characteristics:
and the computer saves the new kernel into a RAM and saves the boot code into the RAM or an external module.
Further, the method also has the following characteristics:
after the computer jumps to the entry of the boot code and enters the new kernel information as a parameter, the computer jumps to the physical address of the entry during execution before executing the new kernel, and the method further comprises the following steps:
the boot code backs up the new kernel information in a copy to a physical address of the execution-time entry.
Further, the method also has the following characteristics:
the new kernel information also comprises the current virtual address of the new kernel, the virtual address of an inlet in execution and the state of a storage management unit;
when the state of the storage management unit is enabled, the computer jumps to a physical address of the execution entry before executing the new kernel after the boot code entry has the new kernel information as a parameter, and further includes:
the boot code backs up the new kernel information in a copy to a virtual address of the execution entry and disables storage management unit functionality.
Further, the method also has the following characteristics:
and after the new kernel information is backed up by the boot code in a copy mode, processing important data segments including code segments, data segments and bss segments.
Further, the method also has the following characteristics:
the new kernel information further includes: boot parameters of the current kernel;
before the computer jumps to the physical address of the execution time entry to execute the new kernel, the method further comprises:
and establishing a new stack, copying the boot parameters of the kernel to a new area, and constructing the boot parameters of the new kernel.
In order to solve the above problems, the present invention further provides a device for rapidly restarting a computer, which includes a boot module, a storage module, an operating system shutdown module and a loading module; wherein,
the boot module is used for loading a boot code after receiving a command for restarting the operating system, instructing the storage module to store a new kernel, and instructing the operating system shutdown module to shut down the operating system; the boot code is a code irrelevant to the position, and accesses a global variable relative to a current running address;
the storage module is used for storing the boot code and storing the new kernel after receiving the instruction of the boot module;
the operating system closing module is used for executing the closing of the operating system after receiving an operating system closing instruction of the guide module, and indicating the loading module after the execution is finished;
the loading module is used for preparing new kernel information required by restarting after receiving an instruction of closing the module by the operating system, wherein the new kernel information at least comprises a new kernel size and a physical address of an entry during execution; and calling the boot code in the storage module, jumping to an entrance of the boot code, introducing the new kernel information as a parameter, and then jumping to a physical address of the execution entrance to execute the new kernel.
Further, the device also has the following characteristics:
the loading module jumps to the entry of the boot code, after the new kernel information is introduced as a parameter, and jumps to the physical address of the entry during execution before the new kernel is executed, and the method further includes:
the boot code backs up the new kernel information in a copy to a physical address of the execution-time entry.
Further, the device also has the following characteristics:
the new kernel information also comprises the current virtual address of the new kernel, the virtual address of an inlet in execution and the state of a storage management unit;
when the state of the storage management unit is enabled, the loading module jumps to a physical address of the execution entry before executing the new kernel after the boot code entry has the new kernel information as a parameter, and further includes:
the boot code backs up the new kernel information in a copy to a virtual address of the execution entry and disables storage management unit functionality.
Further, the device also has the following characteristics:
the new kernel information further includes: boot parameters of the current kernel;
before the loading module jumps to the physical address of the execution entry to execute the new kernel, the method further includes:
and establishing a new stack, copying the guide parameters of the current kernel to a new area, and constructing the guide parameters of the new kernel.
The method and the device adopt the method of directly loading the kernel of the operating system, greatly shorten the off-line time of the operating system, skip unnecessary starting steps on the basis of ensuring the stability and the functional integrity of the operating system, namely, the processor is not reset, the system is not subjected to internal self-checking, and peripheral necessary hardware is not required to be initialized, thereby simplifying the starting process, reducing the starting time and realizing the rapid restart of the system. In addition, performance indexes such as Mean Time Between Failures (MTBF) and the like also increase along with the decrease of the offline Time of the system, and the service reliability of the system is also greatly improved.
Drawings
FIG. 1 is a flow chart of a fast reboot computer of an embodiment of the invention;
FIG. 2 is a block diagram of an apparatus for quickly restarting a computer in which an embodiment of the present invention is implemented;
fig. 3 is a flowchart of a fast restart of an example of an application of the present invention.
Detailed Description
Embodiments of the apparatus and method of the present invention are described in further detail below with reference to the accompanying drawings.
The method for quickly restarting a computer system of the embodiment is shown in fig. 1, and comprises the following steps:
(a) when the computer receives a command for restarting the operating system, the computer saves a new kernel (the kernel of the operating system after restarting) and loads a boot code;
to simplify the reboot process, the system may save the new kernel to RAM (e.g., memory), although other agreed locations are possible.
The boot code is used for copying and loading a new kernel when the operating system is restarted; the boot code does not use absolute addresses for access, i.e. independent of location, but rather uses relative to the current running address to access global variables.
The boot code can be saved in the RAM together with the new kernel, and also can be saved in the external module and loaded in the new kernel in the external module mode, and the boot code does not need to be stored with the new kernel integrally.
(b) The computer executes the function of closing the operating system;
the existing restart process comprises two parts of operating system closing and operating system resetting, the invention only executes the operating system closing without resetting the operating system, thus the high-level power management chip and the watchdog cannot be reset;
wherein, the operation of forbidding external interruption is included in the function of the operating system, thereby ensuring that all the following steps can be executed in sequence without other branches;
in addition, since the advanced power management chip is not turned off in this step, the information of the new core saved in step (a) is not lost.
(c) Preparing new kernel information required by the computer when restarting;
the new kernel information comprises a physical address of an entry when the new kernel is executed, and can further comprise a current virtual address of the new kernel, a virtual address of the entry when the new kernel is executed, a state of a storage management unit, a size of the new kernel, a boot parameter of the current kernel and the like;
if the processor of the computer does not have a Memory Management Unit (MMU), or does not use the memory management unit function, the new kernel information does not need to include the memory management unit state, the current virtual address of the new kernel and the virtual address of the entry during execution; the virtual address of the execution time entry is used before the MMU is closed, and the physical address of the execution time entry is used after the MMU is closed.
(d) Jumping to the entrance of the boot code by the computer, and transmitting the new kernel information collected in the step (c) as a parameter to the entrance of the boot code;
wherein entry of the boot code is deterministic to an operating system of the computer;
(e) the computer backups the new kernel information to the virtual address of the entrance in execution time in a copy mode;
in the step, in order to avoid that the new kernel information is damaged due to the failure of the operating system, the step is optional; if the system does not have MMU functionality or the MMU is not enabled, the physical address of the entry is backed up to execution time here.
(f) The computer backups the new kernel to the physical address of the entry during execution and processes important data segments such as bss segments, and the step is optional;
if the state of the storage management unit indicates that the MMU is available and enabled, the new kernel needs to be backed up to a virtual address of an entry during execution, and then the function of the storage management unit is disabled;
if the processor does not have a storage management unit, or the state of the storage management unit indicates that the processor is prohibited from using the storage management unit, the new kernel is directly backed up to the physical address of the entry in the execution time without disabling the function of the storage management unit.
(g) The computer establishes a new stack, copies the guide parameter of the current kernel backed up in the step (d) to a new area, and processes the guide parameter according to the kernel requirement to construct the guide parameter of the new kernel;
(h) and the computer jumps to the physical address of the entry during execution, the new kernel starts execution, and the quick starting process is finished.
Correspondingly, the embodiment also provides a device for quickly restarting a computer, which implements the method described above, and as shown in fig. 2, the device includes a boot module, a storage module, an operating system shutdown module, and a loading module; wherein,
the boot module is used for loading a boot code after receiving a command for restarting the operating system, indicating the storage module to store a new kernel and indicating the operating system shutdown module to shut down the operating system; guiding the code independent of the position to access the global variable relative to the current operation address;
the storage module is used for storing the boot codes and storing the new kernel after receiving the instruction of the boot module;
the operating system closing module is used for executing the closing of the operating system after receiving an instruction of the guiding module for closing the operating system and indicating the loading module after the execution is finished;
and the loading module is used for receiving an instruction of closing the module by the operating system, preparing new kernel information required by restarting, calling the boot code in the storage module, jumping to the entrance of the boot code, introducing the new kernel information as a parameter, and jumping to the physical address of the entrance during execution to execute the new kernel.
The loading module jumps to the entry of the boot code, after the new kernel information is introduced as a parameter, and jumps to the physical address of the entry during execution before the new kernel is executed, and the method further includes:
the boot code backs up the new kernel information in a copy to the physical address of the entry at execution time.
The new kernel information also comprises the current virtual address of the new kernel, the virtual address of an inlet in execution and the state of a storage management unit;
when the state of the storage management unit is enabled, after the loading module jumps to the entry of the boot code and transfers the new kernel information as a parameter, the loading module jumps to the physical address of the execution entry before executing the new kernel, and the method further comprises the following steps:
the boot code backs up the new kernel information in a copy to a virtual address of the execution entry and disables the storage management unit functionality.
The new kernel information further includes: boot parameters of the current kernel;
before the loading module jumps to the physical address of the execution entry to execute the new kernel, the method further includes:
and establishing a new stack, copying the guide parameters of the current kernel to a new area according to the guide parameters of the current kernel, and constructing the guide parameters of the new kernel.
Referring now to FIG. 3, a process for a fast reboot system of an example application is described, wherein the processor in the example application has an MMU, and the MMU is enabled.
In the application example, the boot code is already contained in the current kernel and is location-independent code, and the following quick restart process includes the following steps:
the kernel space that cannot be exchanged is: global memory areas are set in the MMU, and the areas cannot be invalidated or exchanged and are determined by an operating system;
swap (swap), which generally refers to data exchange between virtual memory and hardware;
since not all information is useful, this is the most important part of the data, including code, data and bss segments; a code segment refers to a segment in which a code is stored; the data segment is a segment for storing initialization data; the bss section is a section storing uninitialized data;
synchronizing data to a disk in this step is only a special case, and in order to increase the execution speed, an operating system generally caches a part of data, and when the system is closed, the operating system writes the part of data into a hard disk so as to ensure the integrity of the data;
150, jumping to the boot code for execution;
step 160, copying the important information to the corresponding area of the boot code data segment;
the important information comprises a virtual address of a new kernel mirror image inlet, a virtual address and a physical address of the inlet during execution, the size of a new kernel mirror image, the initial address and the size of a bss section, an MMU state, a virtual address and a physical address of a quick restart code and the like;
Furthermore, the above application example describes only one implementation based on a particular operating system and processor characteristics, but the invention is not limited thereto.
As described above, the fast restart procedure does not utilize a high-level power management chip or a watchdog chip to restart the system, thereby avoiding an unnecessary system boot process and speeding up the system restart process.
It is clear that the invention is not limited to the examples described above, but that modifications and variations are possible depending on the actual requirements, without departing from the scope and gist of the invention.
Claims (10)
1. A method of quickly rebooting a computer, comprising:
after the computer receives a command of restarting an operating system, the computer stores a new kernel and loads a boot code; the boot code is a code irrelevant to the position, and accesses a global variable relative to a current running address;
the computer executes to close the operating system;
the computer prepares the new kernel information needed when restarting, including at least the size of the new kernel and the physical address of the entry when executing;
the computer jumps to the boot code entrance to transmit the new kernel information as a parameter;
and the computer jumps to the physical address of the execution entry to execute the new kernel, and the quick starting process is finished.
2. The method of claim 1, wherein:
and the computer saves the new kernel into a RAM and saves the boot code into the RAM or an external module.
3. The method of claim 1, wherein:
after the computer jumps to the entry of the boot code and enters the new kernel information as a parameter, the computer jumps to the physical address of the entry during execution before executing the new kernel, and the method further comprises the following steps:
the boot code backs up the new kernel information in a copy to a physical address of the execution-time entry.
4. The method of claim 1, wherein:
the new kernel information also comprises the current virtual address of the new kernel, the virtual address of an inlet in execution and the state of a storage management unit;
when the state of the storage management unit is enabled, the computer jumps to a physical address of the execution entry before executing the new kernel after the boot code entry has the new kernel information as a parameter, and further includes:
the boot code backs up the new kernel information in a copy to a virtual address of the execution entry and disables storage management unit functionality.
5. The method of claim 3 or 4, wherein:
and after the new kernel information is backed up by the boot code in a copy mode, processing important data segments including code segments, data segments and bss segments.
6. The method of claim 1 or 2, wherein:
the new kernel information further includes: boot parameters of the current kernel;
before the computer jumps to the physical address of the execution time entry to execute the new kernel, the method further comprises:
and establishing a new stack, copying the boot parameters of the kernel to a new area, and constructing the boot parameters of the new kernel.
7. An apparatus for rapidly restarting a computer, the apparatus comprising a boot module, a storage module, an operating system shutdown module, and a loading module; wherein,
the boot module is used for loading a boot code after receiving a command for restarting the operating system, instructing the storage module to store a new kernel, and instructing the operating system shutdown module to shut down the operating system; the boot code is a code irrelevant to the position, and accesses a global variable relative to a current running address;
the storage module is used for storing the boot code and storing the new kernel after receiving the instruction of the boot module;
the operating system closing module is used for executing the closing of the operating system after receiving an operating system closing instruction of the guide module, and indicating the loading module after the execution is finished;
the loading module is used for preparing new kernel information required by restarting after receiving an instruction of closing the module by the operating system, wherein the new kernel information at least comprises a new kernel size and a physical address of an entry during execution; and calling the boot code in the storage module, jumping to an entrance of the boot code, introducing the new kernel information as a parameter, and then jumping to a physical address of the execution entrance to execute the new kernel.
8. The apparatus of claim 7, wherein:
the loading module jumps to the entry of the boot code, after the new kernel information is introduced as a parameter, and jumps to the physical address of the entry during execution before the new kernel is executed, and the method further includes:
the boot code backs up the new kernel information in a copy to a physical address of the execution-time entry.
9. The apparatus of claim 7, wherein:
the new kernel information also comprises the current virtual address of the new kernel, the virtual address of an inlet in execution and the state of a storage management unit;
when the state of the storage management unit is enabled, the loading module jumps to a physical address of the execution entry before executing the new kernel after the boot code entry has the new kernel information as a parameter, and further includes:
the boot code backs up the new kernel information in a copy to a virtual address of the execution entry and disables storage management unit functionality.
10. The method of claim 7, 8 or 9, wherein:
the new kernel information further includes: boot parameters of the current kernel;
before the loading module jumps to the physical address of the execution entry to execute the new kernel, the method further includes:
and establishing a new stack, copying the guide parameters of the current kernel to a new area, and constructing the guide parameters of the new kernel.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009101714633A CN102012823A (en) | 2009-09-04 | 2009-09-04 | Method and device for quickly restarting computer |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009101714633A CN102012823A (en) | 2009-09-04 | 2009-09-04 | Method and device for quickly restarting computer |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102012823A true CN102012823A (en) | 2011-04-13 |
Family
ID=43842999
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2009101714633A Pending CN102012823A (en) | 2009-09-04 | 2009-09-04 | Method and device for quickly restarting computer |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102012823A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2016101519A1 (en) * | 2014-12-26 | 2016-06-30 | 中兴通讯股份有限公司 | Method and device for realizing restart of operating system |
WO2017166447A1 (en) * | 2016-03-30 | 2017-10-05 | 百度在线网络技术(北京)有限公司 | Method and device for loading kernel module |
CN115292721A (en) * | 2022-10-09 | 2022-11-04 | 北京麟卓信息科技有限公司 | Starting method for adapting to multiple Linux kernels in android compatible environment |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6393560B1 (en) * | 1998-04-30 | 2002-05-21 | Intel Corporation | Initializing and restarting operating systems |
CN1818869A (en) * | 2006-03-15 | 2006-08-16 | 浙江大学 | Mirror starting optimization of built-in operation system |
CN101436234A (en) * | 2008-04-30 | 2009-05-20 | 北京飞天诚信科技有限公司 | System and method for ensuring operation environment safety |
-
2009
- 2009-09-04 CN CN2009101714633A patent/CN102012823A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6393560B1 (en) * | 1998-04-30 | 2002-05-21 | Intel Corporation | Initializing and restarting operating systems |
CN1818869A (en) * | 2006-03-15 | 2006-08-16 | 浙江大学 | Mirror starting optimization of built-in operation system |
CN101436234A (en) * | 2008-04-30 | 2009-05-20 | 北京飞天诚信科技有限公司 | System and method for ensuring operation environment safety |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2016101519A1 (en) * | 2014-12-26 | 2016-06-30 | 中兴通讯股份有限公司 | Method and device for realizing restart of operating system |
CN105786547A (en) * | 2014-12-26 | 2016-07-20 | 中兴通讯股份有限公司 | Operation system restarting method and apparatus |
WO2017166447A1 (en) * | 2016-03-30 | 2017-10-05 | 百度在线网络技术(北京)有限公司 | Method and device for loading kernel module |
CN115292721A (en) * | 2022-10-09 | 2022-11-04 | 北京麟卓信息科技有限公司 | Starting method for adapting to multiple Linux kernels in android compatible environment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10452404B2 (en) | Optimized UEFI reboot process | |
CN101814035B (en) | Method and system to enable fast platform restart | |
US9189248B2 (en) | Specialized boot path for speeding up resume from sleep state | |
CN101464807B (en) | Application program loading method and device | |
US8484631B2 (en) | Supporting hardware configuration changes in a UEFI firmware component | |
US8595552B2 (en) | Reset method and monitoring apparatus | |
JP6399916B2 (en) | Information processing apparatus and control method thereof | |
KR101673299B1 (en) | Operating system recovery method and apparatus, and terminal device | |
WO2016101519A1 (en) | Method and device for realizing restart of operating system | |
JP2007206885A (en) | Computer system and system starting method | |
CN109408122B (en) | Equipment starting method, electronic equipment and computer storage medium | |
CN111857776A (en) | Online upgrading method for application programs of DSP (digital Signal processor) board cards | |
CN102479121A (en) | Method for realizing and testing redundant array of independent disks (RAID) | |
CN114528557A (en) | Self-adaptive starting method of embedded SOC chip | |
WO2012149774A1 (en) | Method and apparatus for activating processor | |
CN101697132A (en) | Method, device and network equipment for quickly restarting operating system | |
CN113076142B (en) | TCON parameter initialization method and display device | |
CN111078469A (en) | Data processing method and data processing equipment | |
CN112306782B (en) | Debugging test-oriented operating system kernel guiding and loading hardware and method | |
CN102012823A (en) | Method and device for quickly restarting computer | |
US20160179626A1 (en) | Computer system, adaptable hibernation control module and control method thereof | |
US20240176887A1 (en) | Method for Running Startup Program of Electronic Device, and Electronic Device | |
CN102455919A (en) | Automatic optimization setting method for basic input output system(BIOS) | |
WO2008048581A1 (en) | A processing device operation initialization system | |
CN109582370B (en) | Starting method and device of NOR FLASH embedded equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20110413 |