A fault recovery method based on an embedded operating system
By using a checkpoint file structure and a method of storing modified states only in a rollback manner in the embedded operating system, the high overhead and low efficiency problems in embedded operating system fault recovery are solved, and efficient and correct fault recovery is achieved.
Patent Information
- Application Number
- CN202411385841.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-09-30
AI Technical Summary
In existing fault recovery methods for embedded operating systems, the checkpoint recording and recovery process suffers from high system overhead and low efficiency.
The method employs a checkpoint file structure and a process approach that only rolls back to mark the storage modification state. It constructs a target process structure containing task information and storage information, uses checkpoint files to save the information required for process recovery, and performs global consistency checkpoint setting and recovery according to the process relationship structure in the event of system failure.
It reduces the system overhead of fault recovery, improves efficiency, and ensures the correctness and efficiency of fault recovery.
Smart Images

Figure CN119248577B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a fault recovery method based on an embedded operating system, belonging to the field of operating system fault handling technology. Background Technology
[0002] Computer systems are widely used in safety-critical fields such as aerospace. Errors in these systems can have serious consequences, making the establishment of highly reliable computer systems extremely important in such fields. The operating system, as the most fundamental underlying software in a computer system, is key to building a highly reliable computer system.
[0003] The following application problems need to be solved during the implementation process: (1) Checkpoints for embedded operating systems are mainly recorded using status files, which results in high system overhead and low efficiency when searching for them; (2) For fault recovery of embedded operating systems, the method of directly rolling back all processes is mainly used, which results in relatively high system overhead. Summary of the Invention
[0004] The technical problem solved by this invention is to overcome the shortcomings of the prior art and propose a fault recovery method based on an embedded operating system. By using a checkpoint file structure and a method of only rolling back the process that sets the storage modification status, the fault recovery of the embedded operating system is realized. This solves the problems of low efficiency and high overhead caused by the need to roll back all processes when performing fault recovery in the prior art.
[0005] The technical solution of this invention is:
[0006] A fault recovery method based on an embedded operating system includes:
[0007] Step 1: Based on the multiple processes running on the embedded operating system, construct the target process structure containing task information and storage information;
[0008] Step 2: Index and store the files related to the checkpoints using the checkpoint file; the checkpoint file stores all the information required for the recovery process to run.
[0009] The checkpoint file consists of file start data, end marker, and several process data; the file start data includes the file start header, program version, kernel version, number of processes, and process information storage structure;
[0010] Process data includes process ID, storage modification flag, associated process storage modification flag, process relationship structure, process file system information, process write-back file, and other process data;
[0011] The end marker indicates the end of the checkpoint file;
[0012] Step 3: Set multi-task collaborative checkpoints according to the set time intervals, and save the checkpoint time intervals;
[0013] Step 4: During system operation, update the data in the checkpoint file according to the checkpoint time interval;
[0014] Step 5: When the system receives a checkpoint setting request, it performs globally consistent checkpoint settings according to the process relationship structure in the checkpoint file, and sets the storage modification flags for process data and associated processes.
[0015] Step 6: When the system receives the checkpoint recovery command, it rolls back the corresponding processes according to the process relationship structure in the checkpoint file, the current process storage modification flag recorded in the checkpoint file, and the associated process storage modification flag, and restores all data of each process.
[0016] Furthermore, when the system receives a checkpoint setting request, it performs globally consistent checkpoint setting according to the process relationship structure. The specific method is as follows:
[0017] After receiving the checkpoint setting, wait for the user's interrupt save request; the callback worker process sends an interrupt save signal according to the process relationship structure, and the target process of the checkpoint setting receives the interrupt save signal;
[0018] Update and save the process relationship structure of the target process, save all process data, and set the checkpoint end flag for this process;
[0019] If the global consistency checkpoint setting is not completed, other process checkpoints will be set according to the process relationship structure; otherwise, the global consistency checkpoint processing will end.
[0020] Furthermore, when the system receives a checkpoint recovery command, the method for recovering processes running on the system is as follows:
[0021] Once the next process that needs to be resumed is determined, the corresponding process is blocked according to the process relationship structure.
[0022] Wake up the main process and check the storage modification status of related processes according to the process structure: if the storage modification flag of the process data indicates that the process itself has made storage modifications, then roll back the process; if the storage modification flag of the associated process indicates that the related process has made storage modifications, then roll back the related process.
[0023] Restore all data in the process and resume the process;
[0024] Find and store the next process that has a dependency on the modified process according to the stored process relationships, until all processes have been restored.
[0025] Furthermore, the method for updating the data in the checkpoint file during system operation is as follows:
[0026] Record the beginning data of the checkpoint file. Record the program version, kernel version, and number of processes, and record the corresponding position of each process in the file in the process information storage structure.
[0027] Record all process data. For each process, record the corresponding process ID according to the order of the process information storage structure. If a read or write operation is performed during the process, set the storage modification flag of this process; otherwise, clear it. If a related process is read or written, set the storage modification flag of the related process; otherwise, clear it.
[0028] Furthermore, the checkpoint time interval is:
[0029]
[0030] In the formula, T Chek The interval t for setting checkpoints in the system BDS It is the average time interval between system failures, t SP This is the time consumed by the checkpoint operation; the parameter σ has a range of 0 < σ ≤ 100.
[0031] Furthermore, the storage modification flag records whether the process has made memory or register storage modifications; the associated process storage modification flag records whether other processes related to the process have made storage modifications.
[0032] Furthermore, the target process structure records process relationship information, including information on process creation and hierarchical relationships between processes.
[0033] Furthermore, the process information storage structure in the initial data of the file records the location of all process IDs in the checkpoint file.
[0034] The advantages of this invention compared to the prior art are:
[0035] (1) The checkpoint file used in this invention has a process information storage structure in the file header that records the position of all processes in the checkpoint file, which facilitates searching the checkpoint file and is inventive.
[0036] (2) The checkpoint file used in this invention describes the constraint dependency relationship between processes. The process storage modification flag indicates that the process itself has made storage modifications, and the associated process storage modification status word records the storage modification status of related processes.
[0037] (3) The present invention adopts a method of only rolling back the process that sets the storage modification status, and uses a process relationship information file to ensure that all processes that have a dependency relationship with the storage modification process have been rolled back, thus ensuring the correct execution of fault recovery. Attached Figure Description
[0038] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0039] Figure 1 This is a schematic diagram of the checkpoint file format according to an embodiment of the present invention;
[0040] Figure 2 This is a schematic diagram of the checkpoint setting method according to an embodiment of the present invention;
[0041] Figure 3 This is a schematic diagram of the checkpoint recovery method according to an embodiment of the present invention. Detailed Implementation
[0042] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0043] Multiple processes run on top of an embedded operating system. This invention proposes a fault recovery method based on an embedded operating system, comprising:
[0044] S1, construct a target process structure that includes task information and storage information.
[0045] S2 uses checkpoint files to store checkpoint-related files. The checkpoint files store all the information needed for the recovery process to run;
[0046] Checkpoint files such as Figure 1 As shown, it consists of a file start and end marker and several process data.
[0047] The file begins with a header flag, program version, kernel version, number of processes, and process information storage structure (the location of all process IDs in the checkpoint file).
[0048] Process data includes: process ID, storage modification flag of this process, storage modification flag of associated processes, process relationship structure, process file system information, process write-back file, and process-related data.
[0049] The end marker indicates the end of the checkpoint file.
[0050] S3, the system sets multi-task collaborative checkpoints at certain time intervals, and saves the checkpoint interval as follows:
[0051]
[0052] T Chek The optimal interval for setting checkpoints for the system, t BDS It is the average time interval between system failures; t SP This is the time consumed by the checkpoint operation; the parameter σ has a range of 0 < σ ≤ 100.
[0053] S4. During system operation, update the checkpoint file data according to the following steps.
[0054] (1) After receiving the checkpoint setting, wait for the user to interrupt the save request; the callback worker process sends an interrupt save signal according to the process relationship structure, and the target process of the checkpoint setting receives the interrupt save signal.
[0055] (2) Update and save the process relationship structure of the target process, save all process data, and set the checkpoint end flag for this process;
[0056] (3) If the global consistency checkpoint setting is not completed, other process checkpoints are set according to the process relationship structure; otherwise, the global consistency checkpoint processing ends.
[0057] S5, such as Figure 2 As shown, the system receives a checkpoint setting request and performs globally consistent checkpoint settings based on the checkpoint file:
[0058] (1) After receiving the checkpoint setting, wait for the user's interrupt save request. The callback worker process sends an interrupt save signal according to the process relationship structure. The target process of the checkpoint setting receives the interrupt save signal.
[0059] (2) Update and save the process relationship structure of the target process, save all process data, and set the checkpoint end flag for this process.
[0060] (3) If the global consistency checkpoint setting is not completed, other process checkpoints will be set according to the process structure; otherwise, the global consistency checkpoint processing will end.
[0061] (4) After setting a global consistency checkpoint, reset the storage modification flag of the current process and the storage modification flag of the associated processes.
[0062] S6, such as Figure 3 As shown, when the system receives a checkpoint recovery command, it recovers the processes running on that processor core:
[0063] (1) After determining the next process that needs to be restored, block the corresponding process according to the process relationship tree.
[0064] (2) The main process is awakened, and the storage modification status of related processes is checked according to the process structure. If the storage modification flag of the process being modified is not zero, it means that the process itself has made storage modifications and the process needs to be rolled back. If the storage modification flag of the associated process is not zero, it means that the related process has made storage modifications and the related process needs to be rolled back. Based on the relationship between processes, the checkpoint is restored, and the rollback is implemented only for processes that have made storage modifications, which reduces the recovery cost while ensuring the correct execution of the process.
[0065] (3) Restore all data of the process and restore the process.
[0066] (4) Find and store the next process that modifies the process relationship according to the stored process relationship structure until all processes are restored.
[0067] The embodiments described above are merely preferred embodiments of the present invention. Ordinary variations and substitutions made by those skilled in the art within the scope of the technical solution of the present invention should be included within the protection scope of the present invention.
Claims
1. A fault recovery method based on an embedded operating system, characterized in that, include: Step 1: Based on the multiple processes running on the embedded operating system, construct the target process structure containing task information and storage information; Step 2: Index and store the files related to the checkpoints using the checkpoint file; the checkpoint file stores all the information required for the recovery process to run. The checkpoint file consists of file start data, end marker, and several process data; the file start data includes the file start header, program version, kernel version, number of processes, and process information storage structure; Process data includes process ID, storage modification flag, associated process storage modification flag, process relationship structure, process file system information, process write-back file, and other process data; The end marker indicates the end of the checkpoint file; Step 3: Set multi-task collaborative checkpoints according to the set time intervals, and save the checkpoint time intervals; Step 4: During system operation, update the data in the checkpoint file according to the checkpoint time interval; Step 5: When the system receives a checkpoint setting request, it performs globally consistent checkpoint settings according to the process relationship structure in the checkpoint file, and sets the storage modification flags for process data and associated processes. Step 6: When the system receives the checkpoint recovery command, it rolls back the corresponding processes according to the process relationship structure in the checkpoint file, the current process storage modification flag recorded in the checkpoint file, and the associated process storage modification flag, and restores all data of each process.
2. The fault recovery method based on an embedded operating system according to claim 1, characterized in that, When the system receives a checkpoint setting request, it performs globally consistent checkpoint setting according to the process relationship structure. The specific method is as follows: After receiving the checkpoint setting, wait for the user's interrupt save request; the callback worker process sends an interrupt save signal according to the process relationship structure, and the target process of the checkpoint setting receives the interrupt save signal; Update and save the process relationship structure of the target process, save all process data, and set the checkpoint end flag for this process; If the global consistency checkpoint setting is not completed, other process checkpoints will be set according to the process relationship structure; otherwise, the global consistency checkpoint processing will end.
3. The fault recovery method based on an embedded operating system according to claim 1, characterized in that, When the system receives a checkpoint recovery command, the method for recovering processes running on the system is as follows: Once the next process that needs to be resumed is determined, the corresponding process is blocked according to the process relationship structure. Wake up the main process and check the storage modification status of related processes according to the process structure: if the storage modification flag of the process data indicates that the process itself has made storage modifications, then roll back the process; If the associated process storage modification flag indicates that the associated process has made storage modifications, then the associated process will be rolled back. Restore all data in the process and resume the process; Find and store the next process that has a dependency on the modified process according to the stored process relationships, until all processes have been restored.
4. The fault recovery method based on an embedded operating system according to claim 1, characterized in that, The method for updating the data in the checkpoint file during system operation is as follows: Record the starting data of the checkpoint file; record the program version, the kernel version, and the number of processes; and record the corresponding position of each process in the file in the process information storage structure. Record all process data; for each process, record the corresponding process ID according to the order of the process information storage structure. If a read or write operation is performed during the process, set the storage modification flag of this process; otherwise, clear it. If a related process is read or written, set the storage modification flag of the related process; otherwise, clear it.
5. The fault recovery method based on an embedded operating system according to claim 1, characterized in that, The checkpoint time interval is: In the formula, T Chek The interval t for setting checkpoints in the system BDS It is the average time interval between system failures, t SP This is the time consumed by the checkpoint operation; the parameter σ has a range of 0 < σ ≤ 100.
6. The fault recovery method based on an embedded operating system according to claim 1, characterized in that, The storage modification flag records whether a process has made changes to memory or register storage; the associated process storage modification flag records whether other processes related to the process have made storage modifications.
7. The fault recovery method based on an embedded operating system according to claim 1, characterized in that, The target process structure records the relationship information between processes, including the creation of processes and the hierarchical relationship between processes.
8. The fault recovery method based on an embedded operating system according to claim 1, characterized in that, The process information storage structure in the initial data of the file records the location of all process IDs in the checkpoint file.
Citation Information
Patent Citations
Method for restoring application software exception in Android system
CN106959909A
Method for writing modified data from a main memory of a computer back to a database
US5933593A