TWI784750B - Data processing method of terminal device and data processing system of terminal device - Google Patents

Data processing method of terminal device and data processing system of terminal device Download PDF

Info

Publication number
TWI784750B
TWI784750B TW110138294A TW110138294A TWI784750B TW I784750 B TWI784750 B TW I784750B TW 110138294 A TW110138294 A TW 110138294A TW 110138294 A TW110138294 A TW 110138294A TW I784750 B TWI784750 B TW I784750B
Authority
TW
Taiwan
Prior art keywords
data
damaged
system data
terminal device
data block
Prior art date
Application number
TW110138294A
Other languages
Chinese (zh)
Other versions
TW202318197A (en
Inventor
孔建雲
張紅森
黃佑霖
Original Assignee
啟碁科技股份有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 啟碁科技股份有限公司 filed Critical 啟碁科技股份有限公司
Priority to TW110138294A priority Critical patent/TWI784750B/en
Application granted granted Critical
Publication of TWI784750B publication Critical patent/TWI784750B/en
Publication of TW202318197A publication Critical patent/TW202318197A/en

Links

Images

Landscapes

  • Communication Control (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A data processing method of a terminal device is presented, wherein the terminal device stores a first system data and a second system data which is the same as the first system data, the first system data includes a plurality of first data blocks, and the second system data includes a plurality of second data blocks, the data processing method comprises: loading the first data blocks sequentially; determining, at each time, whether the first data block is a damaged data block; recording a damage information in a storage unit when the first data block is determined as the damaged data block; determining whether the second data block of the second system data which corresponds to the damaged data block is damaged; loading the second data block when the second data block is not damaged. In addition, a data processing system of the terminal device is provided.

Description

終端裝置的資料處理方法及終端裝置的資料處理系統Data processing method of terminal device and data processing system of terminal device

本發明涉及一種終端裝置的資料處理系統及其資料處理方法,特別是一種可即時且準確檢測損壞點位置以及可切換使用中的系統資料的資料處理系統及其資料處理方法。The invention relates to a data processing system and a data processing method of a terminal device, in particular to a data processing system and a data processing method capable of real-time and accurate detection of damaged point locations and switchable system data in use.

目前市面上有越來越多的終端設備,例如刀鋒伺服器或雲端主機,都於非揮發性記憶體(例如Nor Flash或 Nand Flash)儲存有兩份完全相同的系統數據(例如BIOS或OS),其中一份系統數據作為備份之用。隨著非揮發性記憶體的讀寫次數的增加以及受到外界環境因素的影響,非揮發性記憶體上的系統數據出現異常的機率會逐漸增加,一旦非揮發性記憶體上的系統數據出現異常時,將導致終端裝置無法使用以及降低終端裝置的使用壽命,除了造成使用上的不便之外,也使得維護成本增加。At present, more and more terminal devices on the market, such as blade servers or cloud hosts, store two identical system data (such as BIOS or OS) in non-volatile memory (such as Nor Flash or Nand Flash) , one of the system data is used for backup. With the increase in the number of reads and writes of the non-volatile memory and the influence of external environmental factors, the probability of abnormal system data on the non-volatile memory will gradually increase. Once the system data on the non-volatile memory is abnormal When this happens, the terminal device will be unusable and the service life of the terminal device will be reduced. In addition to causing inconvenience in use, it will also increase maintenance costs.

本發明所要解決的技術問題在於,針對現有技術的不足提供一種終端裝置的資料處理方法及終端裝置的資料處理系統。The technical problem to be solved by the present invention is to provide a data processing method for a terminal device and a data processing system for a terminal device in view of the deficiencies in the prior art.

為了解決上述的技術問題,本發明所採用的其中一技術方案是提供一種終端裝置的資料處理方法,終端裝置儲存有完全相同的第一系統資料以及第二系統資料,其中第一系統資料包含多個第一資料塊,而第二系統資料包含多個第二資料塊,該些第一資料塊分別對應該些第二資料塊。該資料處理方法包括:依序地加載第一系統資料的該些第一資料塊;在每一次加載第一系統資料的第一資料塊時,檢測第一系統資料的第一資料塊是否損壞;當第一系統資料的第一資料塊損壞時,紀錄損壞資訊於存儲單元;檢測第二系統資料中與損壞的第一資料塊相對應的第二資料塊是否損壞;以及當第二資料塊未損壞時,加載第二資料塊。In order to solve the above technical problems, one of the technical solutions adopted by the present invention is to provide a data processing method for a terminal device. The terminal device stores identical first system data and second system data, wherein the first system data includes multiple a first data block, and the second system data includes a plurality of second data blocks, and the first data blocks correspond to the second data blocks respectively. The data processing method includes: sequentially loading the first data blocks of the first system data; each time the first data block of the first system data is loaded, detecting whether the first data block of the first system data is damaged; When the first data block of the first system data is damaged, record the damage information in the storage unit; detect whether the second data block corresponding to the damaged first data block in the second system data is damaged; and when the second data block is not damaged When damaged, load the second data block.

為了解決上述的技術問題,本發明所採用的另一技術方案是一種終端裝置的資料處理系統,其包括一記憶體及一處理器。記憶體儲存有完全相同的第一系統資料以及第二系統資料,其中第一系統資料包含多個第一資料塊,而第二系統資料包含多個第二資料塊,該些第一資料塊分別對應該些第二資料塊。處理器電性連接於記憶體,處理器用於觸發終端裝置的啟動階段,而啟動階段包含:依序地加載第一系統資料的該些第一資料塊;在每一次加載第一系統資料的第一資料塊時,檢測第一系統資料的第一資料塊是否損壞;當第一系統資料的第一資料塊損壞時,紀錄損壞資訊於存儲單元;檢測第二系統資料中與損壞的該第一資料塊相對應的第二資料塊是否損壞;以及當第二資料塊未損壞時,加載第二資料塊。In order to solve the above technical problems, another technical solution adopted by the present invention is a data processing system of a terminal device, which includes a memory and a processor. The memory stores exactly the same first system data and second system data, wherein the first system data includes a plurality of first data blocks, and the second system data includes a plurality of second data blocks, and the first data blocks are respectively Corresponding to these second data blocks. The processor is electrically connected to the memory, and the processor is used to trigger the start-up phase of the terminal device, and the start-up phase includes: sequentially loading the first data blocks of the first system data; When a data block is detected, it is detected whether the first data block of the first system data is damaged; when the first data block of the first system data is damaged, the damage information is recorded in the storage unit; the second system data and the damaged first data block are detected Whether the second data block corresponding to the data block is damaged; and when the second data block is not damaged, load the second data block.

為了解決上述的技術問題,本發明所採用的又一技術方案是一種終端裝置的資料處理方法,終端裝置儲存有完全相同的第一系統資料及第二系統資料。資料處理方法包括:觸發啟動階段的異常檢測機制;判斷被選為加載目標的第一系統資料是否成功被加載;當確認第一系統資料成功被加載,進入運行階段;觸發運行階段的資料修復機制;判斷在資料修復機制中被修復的損壞資料塊是否屬於運行中的第一系統資料;當被修復的損壞資料塊屬於運行中的第一系統資料,觸發一切換機制;以及當被修復的損壞資料塊不屬於運行中的第一系統資料,退出資料修復機制。In order to solve the above-mentioned technical problems, another technical solution adopted by the present invention is a data processing method for a terminal device, where the terminal device stores exactly the same first system data and second system data. The data processing method includes: triggering an abnormality detection mechanism in the startup phase; judging whether the first system data selected as the loading target is successfully loaded; when it is confirmed that the first system data is successfully loaded, entering the running phase; triggering the data repair mechanism in the running phase ; Judging whether the damaged data block repaired in the data repair mechanism belongs to the running first system data; when the repaired damaged data block belongs to the running first system data, a switching mechanism is triggered; and when the repaired damaged data block The data block does not belong to the running first system data, exit the data recovery mechanism.

本發明的其中一有益效果在於,經由本發明所提供的終端裝置的資料處理系統及終端裝置的資料處理方法,可準確且快速地檢測到損壞點位置,減少不必要的擦寫並節省修復時間。由於在啟動階段以及運行階段都會對第一系統資料及第二系統資料的狀態進行檢測,如此一來便能即時檢測到損壞點位置,減少異常運行的時間。資料修復機制提供了斷電保護,支持斷電續修復,且延長終端裝置的使用壽命。當終端裝置使用中的第一系統資料有異常時,在確認第二系統資料為完整後,可將使用中的第一系統資料切換為第二系統資料。同理,當終端裝置使用中的第二系統資料有異常時,在確認第一系統資料為完整後,可將使用中的第二系統資料切換為第一系統資料。如此一來,延長了系統資料在記憶體內的壽命。再者,在記憶體壽命達到極限無法修復時,在第一系統資料與第二系統資料的相對應資料塊不同時損壞的情況下,本發明的啟動階段的加載機制,依然可保證終端裝置的正常啟動和運行,終端裝置正常運行的壽命又得到了提高。One of the beneficial effects of the present invention is that, through the data processing system of the terminal device and the data processing method of the terminal device provided by the present invention, the position of the damaged point can be detected accurately and quickly, reducing unnecessary erasure and saving time for repairing . Since the state of the first system data and the second system data will be detected during the start-up phase and the running phase, the position of the damaged point can be detected in real time, and the time for abnormal operation can be reduced. The data recovery mechanism provides power-off protection, supports power-off continuous recovery, and prolongs the service life of the terminal device. When the first system information in use of the terminal device is abnormal, after confirming that the second system information is complete, the first system information in use can be switched to the second system information. Similarly, when the second system information in use of the terminal device is abnormal, after confirming that the first system information is complete, the second system information in use can be switched to the first system information. In this way, the lifetime of the system data in the memory is extended. Furthermore, when the life of the memory reaches the limit and cannot be repaired, and the corresponding data blocks of the first system data and the second system data are damaged at the same time, the loading mechanism in the startup phase of the present invention can still ensure the safety of the terminal device. Normal startup and operation, the life of terminal equipment normal operation has been improved again.

為使能更進一步瞭解本發明的特徵及技術內容,請參閱以下有關本發明的詳細說明與圖式,然而所提供的圖式僅用於提供參考與說明,並非用來對本發明加以限制。In order to further understand the features and technical content of the present invention, please refer to the following detailed description and drawings related to the present invention. However, the provided drawings are only for reference and description, and are not intended to limit the present invention.

以下是通過特定的具體實施例來說明本發明所公開有關“終端裝置的資料處理方法以及終端裝置的資料處理系統”的實施方式,本領域技術人員可由本說明書所公開的內容瞭解本發明的優點與效果。本發明可通過其他不同的具體實施例加以施行或應用,本說明書中的各項細節也可基於不同觀點與應用,在不悖離本發明的構思下進行各種修改與變更。另外,本發明的附圖僅為簡單示意說明,並非依實際尺寸的描繪,事先聲明。以下的實施方式將進一步詳細說明本發明的相關技術內容,但所公開的內容並非用以限制本發明的保護範圍。The following is a description of the implementation of the "data processing method of terminal device and data processing system of terminal device" disclosed in the present invention through specific specific embodiments. Those skilled in the art can understand the advantages of the present invention from the content disclosed in this specification with effect. The present invention can be implemented or applied through other different specific embodiments, and various modifications and changes can be made to the details in this specification based on different viewpoints and applications without departing from the concept of the present invention. In addition, the drawings of the present invention are only for simple illustration, and are not drawn according to the actual size, which is stated in advance. The following embodiments will further describe the relevant technical content of the present invention in detail, but the disclosed content is not intended to limit the protection scope of the present invention.

應當可以理解的是,雖然本文中可能會使用到“第一”、“第二”、“第三”等術語來描述各種元件或者信號,但這些元件或者信號不應受這些術語的限制。這些術語主要是用以區分一元件與另一元件,或者一信號與另一信號。另外,本文中所使用的術語“或”,應視實際情況可能包括相關聯的列出項目中的任一個或者多個的組合。It should be understood that although terms such as "first", "second", and "third" may be used herein to describe various elements or signals, these elements or signals should not be limited by these terms. These terms are mainly used to distinguish one element from another element, or one signal from another signal. In addition, the term "or" used herein may include any one or a combination of more of the associated listed items depending on the actual situation.

為了能即時且準確地檢測到損壞點位置,以減少不必要的資料擦寫以及異常運行時間,經由本發明所提供的終端裝置的資料處理方法以及終端裝置的資料處理系統,其中終端裝置儲存有第一系統資料及第二系統資料,且第一系統資料的多個第一資料塊分別對應於第二系統資料的多個第二資料塊且分別儲存於不同的記憶體位置。當終端裝置進入啟動階段並選擇對第一系統資料進行加載時,依序檢查第一系統資料的每一第一資料塊是否損壞,若檢測出第一系統資料中存在損壞的第一資料塊時,即時從第二系統資料中將對應於損壞的第一資料塊的第二資料塊進行加載,直到第一系統資料的所有第一資料塊的狀態都檢測完畢為止。當終端裝置成功完成啟動階段並進入運行階段時,持續對運行中的第一系統資料的狀態進行檢測,當檢測到運行中的第一系統資料的狀態異常時,觸發切換機制並重新啟動終端裝置。在終端裝置重啟後,第二系統資料將作為啟動階段的加載目標。In order to detect the location of the damaged point in real time and accurately, so as to reduce unnecessary data erasing and abnormal operation time, the data processing method of the terminal device and the data processing system of the terminal device provided by the present invention, wherein the terminal device stores The first system data and the second system data, and the multiple first data blocks of the first system data respectively correspond to the multiple second data blocks of the second system data and are respectively stored in different memory locations. When the terminal device enters the startup phase and chooses to load the first system data, it checks whether each first data block of the first system data is damaged in sequence, and if it is detected that there is a damaged first data block in the first system data Immediately load the second data block corresponding to the damaged first data block from the second system data until the states of all the first data blocks in the first system data are detected. When the terminal device successfully completes the start-up phase and enters the running phase, it continuously detects the state of the running first system data, and when it detects that the state of the running first system data is abnormal, triggers the switching mechanism and restarts the terminal device . After the terminal device restarts, the second system data will be used as a loading target in the startup phase.

圖1為本發明一實施例的終端裝置的資料處理系統的功能方塊圖。如圖1所示,終端裝置1包含一處理器11及一記憶體13,而記憶體13電性連接於處理器11,記憶體13為非揮發性記憶體,例如Nor Flash或Nand Flash,所以即便在斷電狀態,儲存於記憶體13內的資料也不會遺失。記憶體13設有一存儲單元131且儲存有第一系統資料A以及第二系統資料B,第一系統資料A相同於第二系統資料B。FIG. 1 is a functional block diagram of a data processing system of a terminal device according to an embodiment of the present invention. As shown in Figure 1, the terminal device 1 includes a processor 11 and a memory 13, and the memory 13 is electrically connected to the processor 11, and the memory 13 is a non-volatile memory, such as Nor Flash or Nand Flash, so Even in a power-off state, the data stored in the memory 13 will not be lost. The memory 13 is provided with a storage unit 131 and stores the first system data A and the second system data B, the first system data A and the second system data B are the same.

圖2為圖1中的系統資料以及備份系統資料儲存於記憶體的示意圖。共同參閱圖1與圖2,第一系統資料A包含多個第一資料塊A1~AN,而第二系統資料B包含多個第二資料塊B1~BN。該些第一資料塊A1~AN分別對應於該些第二資料塊B1~BN且分別儲存於記憶體13的不同記憶體位置,意即該些第一資料塊A1~AN的內容分別相同於該些第二資料塊B1~BN的內容。在本實施例中,該些第一資料塊A1~AN分別對應不同的加載順序1~N,而該些第二資料塊B1~BN分別對應不同的加載順序1~N,加載順序不以此為限,只要符合所有資料塊都需加載的原則。舉例來說,假設N=50,多個第一資料塊A1~A20分別對應加載順序1~20,多個第二資料塊B1~B20分別對應加載順序1~20,多個第一資料塊A41~A50分別對應加載順序21~30,多個第二資料塊B41~B50分別對應加載順序21~30,多個第一資料塊A21~A40分別對應加載順序31~50,而多個第二資料塊B21~B40分別對應加載順序31~50。FIG. 2 is a schematic diagram of storing system data and backup system data in memory in FIG. 1 . Referring to FIG. 1 and FIG. 2 together, the first system data A includes a plurality of first data blocks A1˜AN, and the second system data B includes a plurality of second data blocks B1˜BN. The first data blocks A1-AN respectively correspond to the second data blocks B1-BN and are respectively stored in different memory locations of the memory 13, which means that the contents of the first data blocks A1-AN are respectively the same as Contents of the second data blocks B1-BN. In this embodiment, the first data blocks A1~AN correspond to different loading sequences 1~N, and the second data blocks B1~BN respectively correspond to different loading sequences 1~N, and the loading sequence does not follow this As long as it meets the principle that all data blocks need to be loaded. For example, assuming N=50, multiple first data blocks A1~A20 correspond to loading sequences 1~20 respectively, multiple second data blocks B1~B20 respectively correspond to loading sequences 1~20, and multiple first data blocks A41 ~A50 corresponds to loading sequence 21~30 respectively, multiple second data blocks B41~B50 correspond to loading sequence 21~30 respectively, multiple first data blocks A21~A40 correspond to loading sequence 31~50 respectively, and multiple second data blocks Blocks B21~B40 correspond to loading sequences 31~50 respectively.

圖3為本發明一實施例的終端裝置的資料處理方法的流程圖。如圖3所示,在步驟S301,觸發啟動階段(亦可稱開機階段)的異常檢測機制。詳言之,終端裝置開機時,即時檢測被選為加載目標的系統資料中是否存在損壞資料塊,當發現被選為加載目標的系統資料中存在損壞資料塊時,從另一系統資料中加載對應於損壞資料塊的資料塊,例如第一系統資料被選為加載目標,檢測到第一系統資料中加載順序為3的第一資料塊已損壞時,則嘗試從第二系統資料中加載順序為3的第二資料塊進行加載。在步驟S303,判斷被選為加載目標的系統資料是否成功被加載,亦即終端裝置是否啟動成功。當確認被選為加載目標的系統資料成功被加載,表示終端裝置啟動成功,接著執行步驟S305。在步驟S305,觸發運行階段的異常檢測機制。當確認被選為加載目標的系統資料未成功被加載,接著執行步驟S307。在步驟S307,終端裝置啟動失敗。FIG. 3 is a flowchart of a data processing method of a terminal device according to an embodiment of the present invention. As shown in FIG. 3 , in step S301 , an abnormality detection mechanism in the start-up phase (also called the power-on phase) is triggered. In detail, when the terminal device is turned on, it immediately detects whether there is a damaged data block in the system data selected as the loading target, and when it is found that there is a damaged data block in the system data selected as the loading target, load it from another system data. The data block corresponding to the damaged data block, for example, the first system data is selected as the loading target, and when the first data block with the loading order of 3 in the first system data is detected to be damaged, try to load the order from the second system data The second data block for 3 is loaded. In step S303, it is judged whether the system data selected as the loading target is successfully loaded, that is, whether the terminal device is started successfully. When it is confirmed that the system information selected as the loading target is successfully loaded, it means that the terminal device is started successfully, and then step S305 is executed. In step S305, an abnormality detection mechanism in the running phase is triggered. When it is confirmed that the system data selected as the loading target has not been successfully loaded, then step S307 is executed. In step S307, the terminal device fails to start.

在步驟S305之後,接著執行步驟S309。在步驟S309,檢測運行中的系統資料的狀態是否異常。當確認運行中的系統資料(亦可稱使用中的系統資料)的狀態有異常,接著執行步驟S311。在步驟S311,觸發切換機制。當運行中的系統資料的狀態沒有異常,返回步驟S305。舉例來說,終端設備1進入運行階段後,若在第一時間點檢測到正在運行的系統資料中的資料塊的狀態異常而無法使用,則觸發切換機制。若在第一時間點沒有檢測到運行中的系統資料的狀態出現異常,則持續檢測運行中的系統資料的狀態,若在第二時間點檢測到運行中的系統資料的資料塊的狀態出現異常,則觸發切換機制。After step S305, step S309 is then executed. In step S309, it is detected whether the state of the running system data is abnormal. When it is confirmed that the state of the running system data (also referred to as the system data in use) is abnormal, then step S311 is executed. In step S311, the switching mechanism is triggered. When the status of the running system data is not abnormal, return to step S305. For example, after the terminal device 1 enters the running phase, if it detects that the status of the data block in the running system data is abnormal and cannot be used at the first point in time, the switching mechanism will be triggered. If no abnormality is detected in the state of the running system data at the first time point, the state of the running system data is continuously detected, and if an abnormal state of the data block of the running system data is detected at the second time point , the switching mechanism is triggered.

在觸發切換機制之後,接著返回步驟S301,表示終端裝置1重新開機而重新進入啟動階段。舉例來說,終端裝置第一次進入啟動階段時,第一系統資料作為加載目標,而觸發切換機制之後,終端裝置第二次進入啟動階段,此時第二系統資料作為加載目標。After the switching mechanism is triggered, then return to step S301, which means that the terminal device 1 is restarted and enters the startup phase again. For example, when the terminal device enters the startup phase for the first time, the first system data is used as the loading target, and after the switching mechanism is triggered, the terminal device enters the startup phase for the second time, and at this time the second system data is used as the loading target.

在步驟S303中,當確認被選為加載目標的系統資料成功被加載,接著執行步驟S313,在步驟S313,觸發資料修復機制。在步驟S315,判斷在資料修復機制中被修復的一個或多個損壞資料塊是否屬於運行中的系統資料。當確認被修復的一個或多個損壞資料塊屬於運行中的系統資料,執行步驟S311。當確認被修復的一個或多個損壞資料塊不屬於運行中的系統資料,執行步驟S317。在步驟S317,退出資料修復機制。舉例來說,若確認被修復的損壞資料塊屬於運行中的第一系統資料A,則觸發切換機制,接著重新啟動終端設備1且選擇第二系統資料B作為加載目標。反之,若被修復的損壞資料塊屬於第二系統資料B,而非運行中的第一系統資料A,則退出資料修復機制。此外,步驟S305與步驟S313的執行順序不作限制。In step S303, when it is confirmed that the system data selected as the loading target is successfully loaded, then step S313 is executed, and in step S313, a data recovery mechanism is triggered. In step S315, it is determined whether one or more damaged data blocks repaired in the data repair mechanism belong to running system data. When it is confirmed that the one or more damaged data blocks to be repaired belong to the running system data, step S311 is executed. When it is confirmed that the repaired one or more damaged data blocks do not belong to the running system data, step S317 is executed. In step S317, the data recovery mechanism is exited. For example, if it is confirmed that the repaired damaged data block belongs to the running first system data A, the switching mechanism is triggered, and then the terminal device 1 is restarted and the second system data B is selected as the loading target. Conversely, if the damaged data block to be repaired belongs to the second system data B instead of the running first system data A, the data repair mechanism is exited. In addition, the execution sequence of step S305 and step S313 is not limited.

圖3為本發明的資料處理方法的一實施例的整體流程,後續將針對啟動階段的異常檢測機制、運行階段的異常檢測機制、資料修復機制以及切換機制進行詳細的闡述。FIG. 3 is the overall flow of an embodiment of the data processing method of the present invention. The anomaly detection mechanism in the start-up phase, the anomaly detection mechanism in the running phase, the data restoration mechanism, and the switching mechanism will be described in detail later.

圖4為圖3的啟動階段的異常檢測機制的流程圖。如圖4所示,在步驟S401,讀取記憶體13的存儲單元131。詳言之,每一次終端裝置1進入啟動階段時,先讀取存儲單元131的資訊。在步驟S403,根據存儲單元131的資訊,選擇第一系統資料A及第二系統資料B之一作為加載目標。當確認第一系統資料A被選為加載目標時,接著執行步驟S405。在步驟S405,加載第一系統資料A中對應一加載順序的一資料塊。舉例來說,當第一系統資料A作為加載目標時,第一系統資料A的第一資料塊A1首先被加載,而第一資料塊A1對應的加載順序為1。FIG. 4 is a flow chart of the anomaly detection mechanism in the startup phase of FIG. 3 . As shown in FIG. 4 , in step S401 , the storage unit 131 of the memory 13 is read. In detail, each time the terminal device 1 enters the startup phase, it first reads the information of the storage unit 131 . In step S403, according to the information of the storage unit 131, one of the first system data A and the second system data B is selected as a loading target. When it is confirmed that the first system data A is selected as the loading target, then step S405 is executed. In step S405, a data block corresponding to a loading sequence in the first system data A is loaded. For example, when the first system data A is the loading target, the first data block A1 of the first system data A is loaded first, and the loading sequence corresponding to the first data block A1 is 1.

首先闡述第一系統資料A被選為加載目標後的步驟。Firstly, the steps after the first system data A is selected as the loading target are described.

在步驟S405後,接著執行步驟S407。在步驟S407,檢測第一系統資料A的第一資料塊的加載是否失敗。當確認第一系統資料A的第一資料塊的加載失敗時,表示欲加載的第一資料塊屬於損壞資料塊,接著執行步驟S409。在步驟S409,紀錄損壞資訊於存儲單元。反之,當確認第一系統資料A的第一資料塊的加載成功時,表示欲加載的第一資料塊未損壞,接著執行步驟S411。在步驟S411,加載順序加一,接著執行步驟S413。在步驟S413,判斷加載順序是否超過一臨界值,其中臨界值相同於第一系統資料A中的第一資料塊的總數量。當確認加載順序未超過臨界值,返回步驟S405。當確認加載順序已超過臨界值,接著執行步驟S415。在步驟S415中,終端裝置1啟動成功。After step S405, step S407 is then executed. In step S407, it is detected whether the loading of the first data block of the first system data A fails. When it is confirmed that the loading of the first data block of the first system data A fails, it means that the first data block to be loaded belongs to a damaged data block, and then step S409 is executed. In step S409, record damage information in the storage unit. On the contrary, when it is confirmed that the loading of the first data block of the first system data A is successful, it means that the first data block to be loaded is not damaged, and then step S411 is executed. In step S411, the loading sequence is increased by one, and then step S413 is executed. In step S413, it is determined whether the loading sequence exceeds a threshold value, wherein the threshold value is equal to the total number of the first data blocks in the first system data A. When it is confirmed that the loading sequence does not exceed the critical value, return to step S405. When it is confirmed that the loading sequence has exceeded the critical value, then step S415 is executed. In step S415, the terminal device 1 is started successfully.

舉例來說,當第一系統資料A中的第一資料塊A1已損壞而無法加載,將記錄損壞資訊於存儲單元131,其中損壞資訊包含第一資料塊A1為損壞資料塊的資訊及其所在的記憶體位置。For example, when the first data block A1 in the first system data A is damaged and cannot be loaded, the damage information will be recorded in the storage unit 131, wherein the damage information includes the information that the first data block A1 is a damaged data block and its location memory location.

在步驟S409之後,接著執行步驟S417。在步驟S417,檢測第二系統資料B中與第一系統資料A的損壞資料塊相對應的第二資料塊是否損壞。當確認第二資料塊未損壞時,接著執行步驟S419。在步驟S419,加載第二資料塊,接著返回步驟S411。舉例來說,當第一系統資料A的第一資料塊A1被檢測出損壞時,進一步檢測第二系統資料B的第二資料塊B1是否損壞,當確認第二資料塊B1未損壞,則加載第二資料塊B1,接著繼續檢測第一系統資料A的第一資料塊A2的加載是否失敗。After step S409, step S417 is then performed. In step S417, it is detected whether the second data block corresponding to the damaged data block of the first system data A in the second system data B is damaged. When it is confirmed that the second data block is not damaged, then step S419 is executed. In step S419, the second data block is loaded, and then returns to step S411. For example, when the first data block A1 of the first system data A is detected to be damaged, further check whether the second data block B1 of the second system data B is damaged, and when it is confirmed that the second data block B1 is not damaged, load The second data block B1 continues to detect whether the loading of the first data block A2 of the first system data A fails.

反之,當確認第二資料塊損壞時,接著執行步驟S421。在步驟S421,終端裝置1啟動失敗。On the contrary, when it is confirmed that the second data block is damaged, then step S421 is executed. In step S421, the terminal device 1 fails to start.

舉例來說,第一系統資料A中的第一資料塊的數量以及第二系統資料中的第二資料塊數量均為N個,表示臨界值為N。首先檢測加載順序為1的第一系統資料A的第一資料塊A1是否損壞,若第一資料塊A1沒有損壞,則加載第一資料塊A1。接著,將加載順序由1變為2。當加載順序為2時,檢測第一系統資料A的第一資料塊A2是否損壞,當第一系統資料A的第一資料塊A2未損壞時,加載第一系統資料A的第一資料塊A2。同理,持續增加加載順序,直到加載順序等於第一系統資料A的第一資料塊的總數量時,表示第一系統資料A的所有的第一資料塊全部檢查完畢。For example, the number of the first data blocks in the first system data A and the number of the second data blocks in the second system data are both N, indicating that the threshold value is N. Firstly, it is detected whether the first data block A1 of the first system data A whose loading sequence is 1 is damaged, and if the first data block A1 is not damaged, the first data block A1 is loaded. Next, change the load order from 1 to 2. When the loading sequence is 2, check whether the first data block A2 of the first system data A is damaged, and when the first data block A2 of the first system data A is not damaged, load the first data block A2 of the first system data A . Similarly, the loading order is continuously increased until the loading order is equal to the total number of the first data blocks of the first system data A, which means that all the first data blocks of the first system data A have been checked.

在步驟S403時,當選擇第二系統資料B時,接著執行步驟S423。在步驟S423,加載第二系統資料B中對應一加載順序的一第二資料塊。舉例來說,當第二系統資料B作為加載目標時,第二系統資料B中的第二資料塊B1首先被加載,而第二資料塊B1對應的加載順序為1。In step S403, when the second system profile B is selected, then step S423 is executed. In step S423, a second data block corresponding to a loading sequence in the second system data B is loaded. For example, when the second system data B is used as the loading target, the second data block B1 in the second system data B is loaded first, and the corresponding loading order of the second data block B1 is 1.

接著闡述將第二系統資料B被選為加載目標後的步驟。Next, the steps after the second system data B is selected as the loading target are described.

在步驟S423之後,接著步驟S425。在步驟S425,檢測第二系統資料B的第二資料塊的加載是否失敗。當確認第二資料塊無法加載時,表示第二資料塊為損壞資料塊,接著執行步驟S427。在步驟S427,紀錄損壞資訊於存儲單元131。舉例來說,當第二系統資料B的第二資料塊B1損壞時,將無法加載第二資料塊B1,接著紀錄損壞資訊於存儲單元131,其中損壞資訊包含第二資料塊B1為損壞資料塊的資訊及其對應的記憶體位置的資訊。After step S423, follow step S425. In step S425, it is detected whether the loading of the second data block of the second system data B fails. When it is confirmed that the second data block cannot be loaded, it means that the second data block is a damaged data block, and then step S427 is executed. In step S427, the damage information is recorded in the storage unit 131. For example, when the second data block B1 of the second system data B is damaged, the second data block B1 cannot be loaded, and then the damage information is recorded in the storage unit 131, wherein the damage information includes that the second data block B1 is a damaged data block and its corresponding memory location.

反之,當確認第二系統資料B的第二資料塊的加載成功時,表示欲加載的第二資料塊未損壞,接著執行步驟S429。在步驟S429,加載順序加一,接著執行步驟S431。在步驟S431,判斷加載順序是否超過一臨界值,其中臨界值相同於第二系統資料B中的第二資料塊的總數量。當確認加載順序未超過臨界值,返回步驟S423。當確認加載順序已超過臨界值,接著執行步驟S433。在步驟S433中,終端裝置1啟動成功。On the contrary, when it is confirmed that the loading of the second data block of the second system data B is successful, it means that the second data block to be loaded is not damaged, and then step S429 is executed. In step S429, the loading order is increased by one, and then step S431 is executed. In step S431, it is determined whether the loading sequence exceeds a threshold value, wherein the threshold value is equal to the total number of the second data blocks in the second system data B. When it is confirmed that the loading sequence does not exceed the critical value, return to step S423. When it is confirmed that the loading sequence has exceeded the critical value, then step S433 is executed. In step S433, the terminal device 1 is started successfully.

在步驟S427之後,接著執行步驟S435。在步驟S435,檢測第一系統資料A中與第二系統資料B的損壞資料塊相對應的第一資料塊是否損壞。當確認第一資料塊未損壞時,接著執行步驟S437。在步驟S437,加載第一資料塊,接著返回步驟S429。舉例來說,當第二系統資料B的第二資料塊B1損壞時,檢測第一系統資料A的第一資料塊A1是否損壞,當確認第一系統資料A的第一資料塊A1未損壞,則加載第一系統資料A的第一資料塊A1,接著繼續檢測第二系統資料B的第二資料塊B2的加載是否失敗。After step S427, step S435 is then performed. In step S435, it is detected whether the first data block corresponding to the damaged data block of the second system data B in the first system data A is damaged. When it is confirmed that the first data block is not damaged, then step S437 is executed. In step S437, the first data block is loaded, and then returns to step S429. For example, when the second data block B1 of the second system data B is damaged, it is detected whether the first data block A1 of the first system data A is damaged, and when it is confirmed that the first data block A1 of the first system data A is not damaged, Then load the first data block A1 of the first system data A, and then continue to detect whether the loading of the second data block B2 of the second system data B fails.

反之,當確認第一系統資料A中與第二系統資料B中的損壞資料塊相對應的第一資料塊為損壞時,接著執行步驟S439。在步驟S439,終端裝置1啟動失敗。On the contrary, when it is confirmed that the first data block in the first system data A corresponding to the damaged data block in the second system data B is damaged, then step S439 is executed. In step S439, the terminal device 1 fails to start.

綜上所述,步驟S401~S439為啟動階段的異常檢測機制。當終端裝置1在啟動階段選擇第一系統資料A作為加載目標,接著對第一系統資料A的每一第一資料塊的狀態進行異常檢測,直到每一第一資料塊的狀態都檢測完畢後,終端裝置1啟動成功。同理,當終端裝置1在啟動階段選擇第二系統資料B作為加載目標,接著對第二系統資料B的每一第二資料塊的狀態進行異常檢測,直到每一第二資料塊的狀態都檢測完畢後,終端裝置1啟動成功。To sum up, steps S401-S439 are the anomaly detection mechanism in the start-up phase. When the terminal device 1 selects the first system data A as the loading target at the start-up stage, it then performs abnormal detection on the state of each first data block of the first system data A until the state of each first data block is detected. , the terminal device 1 starts up successfully. Similarly, when the terminal device 1 selects the second system data B as the loading target during the start-up phase, then an abnormality detection is performed on the state of each second data block of the second system data B until the state of each second data block is After the detection is completed, the terminal device 1 is started successfully.

圖4的異常檢測機制可由圖1的資料處理系統1來執行。詳言之,步驟S401~S439由資料處理系統1的處理器11來執行。然而,圖4的異常檢測機制亦可由其他資料處理系統來執行,並不侷限於由圖1的資料處理系統1來執行。The anomaly detection mechanism in FIG. 4 can be implemented by the data processing system 1 in FIG. 1 . In detail, steps S401 - S439 are executed by the processor 11 of the data processing system 1 . However, the anomaly detection mechanism in FIG. 4 can also be executed by other data processing systems, and is not limited to be executed by the data processing system 1 in FIG. 1 .

當終端裝置1啟動完成後(圖4的步驟S415或步驟S433),接著終端裝置1進入運行階段且觸發運行階段的異常檢測機制。After the start-up of the terminal device 1 is completed (step S415 or step S433 in FIG. 4 ), then the terminal device 1 enters the running phase and triggers the abnormality detection mechanism of the running phase.

圖5為圖3中的運行階段的異常檢測機制的流程圖,以下根據第一系統資料A為運行中的系統資料為舉例。在圖4的步驟S415之後,接著執行步驟S501。在步驟S501,觸發運行階段的異常檢測機制。在步驟S503,檢測運行中的第一系統資料A的狀態是否異常。當確認運行中的第一系統資料A的狀態有異常時,執行步驟S505。在步驟S505,更新存儲單元131的損壞資訊。當確認運行中的第一系統資料A的狀態沒有異常時,返回步驟S501。詳言之,當運行階段時,持續檢測第一系統資料A的狀態是否異常,假設在第一時間點時,第一系統資料A的第一資料塊A2的狀態被檢測為異常。由於第一資料塊A2的異常狀態而導致無法使用,所以關於第一資料塊A2為損壞資料塊的損壞資訊紀錄於存儲單元131。舉例來說,假設在第一時間點沒有檢測到第一系統資料A的狀態出現異常,則持續檢測第一系統資料A的狀態是否異常。若在第二時間點檢測到第一系統資料A的第一資料塊A5的狀態為異常時,將關於第一資料塊A5為損壞資料塊的損壞資訊紀錄於存儲單元131。FIG. 5 is a flow chart of the anomaly detection mechanism in the running phase in FIG. 3 , and the first system data A is the running system data as an example below. After step S415 in FIG. 4 , step S501 is executed next. In step S501, an abnormality detection mechanism in the running phase is triggered. In step S503, it is detected whether the state of the running first system data A is abnormal. When it is confirmed that the state of the running first system data A is abnormal, step S505 is executed. In step S505, the damage information of the storage unit 131 is updated. When it is confirmed that the state of the running first system data A is not abnormal, return to step S501. In detail, during the running phase, it is continuously detected whether the state of the first system data A is abnormal, assuming that at the first time point, the state of the first data block A2 of the first system data A is detected as abnormal. Due to the abnormal state of the first data block A2 , it cannot be used, so the damage information about the first data block A2 being a damaged data block is recorded in the storage unit 131 . For example, assuming that no abnormal state of the first system data A is detected at the first time point, it is continuously detected whether the state of the first system data A is abnormal. If it is detected at the second time point that the state of the first data block A5 of the first system data A is abnormal, damage information about the first data block A5 being a damaged data block is recorded in the storage unit 131 .

同理,當運行中的第一系統資料A改為第二系統資料B時,主要差異在於將步驟S503中的第一系統資料A更換為第二系統資料B。Similarly, when the running first system profile A is changed to the second system profile B, the main difference is that the first system profile A in step S503 is replaced with the second system profile B.

圖5的異常檢測機制可由圖1的資料處理系統1來執行。詳言之,步驟S501~S505由資料處理系統1的處理器11來執行。然而,圖5的異常檢測機制亦可由其他資料處理系統來執行,並不侷限於由圖1的資料處理系統1來執行。The anomaly detection mechanism in FIG. 5 can be implemented by the data processing system 1 in FIG. 1 . In detail, steps S501 - S505 are executed by the processor 11 of the data processing system 1 . However, the anomaly detection mechanism in FIG. 5 can also be executed by other data processing systems, and is not limited to be executed by the data processing system 1 in FIG. 1 .

當終端裝置1啟動完成後(圖4的步驟S415或步驟S433),接著終端裝置1進入運行階段且觸發運行階段的資料修復機制。After the terminal device 1 is started (step S415 or step S433 in FIG. 4 ), then the terminal device 1 enters the running phase and triggers the data restoration mechanism in the running phase.

圖6為圖3中的運行階段的資料修復機制的流程圖。以下根據第一系統資料A為運行中的系統資料為舉例。在圖4的步驟S415之後,接著執行圖6的步驟S601。在步驟S601,讀取存儲單元131。在步驟S603,判斷損壞資料塊數量是否為零。詳言之,存儲單元131的損壞資訊除了損壞資料塊的位置之外還包含損壞資料塊數量。當確認損壞資料塊數量不為零時,執行步驟S605。在步驟S605,修復一個損壞資料塊,其中修復損壞資料塊包含複製與該損壞資料塊對應的資料塊以及將複製的資料塊取代損壞資料塊。然後於步驟S609,損壞資料塊的數量減一並將更新後的損壞資料塊數量紀錄於存儲單元131,接著返回步驟S601。FIG. 6 is a flow chart of the data restoration mechanism in the running phase in FIG. 3 . The following is an example based on the first system information A as the running system information. After step S415 in FIG. 4 , step S601 in FIG. 6 is executed. In step S601, the storage unit 131 is read. In step S603, it is judged whether the number of damaged data blocks is zero. In detail, the damage information of the storage unit 131 includes not only the location of the damaged data block but also the number of the damaged data block. When it is confirmed that the number of damaged data blocks is not zero, step S605 is executed. In step S605, repairing a damaged data block includes copying a data block corresponding to the damaged data block and replacing the damaged data block with the copied data block. Then in step S609, the number of damaged data blocks is reduced by one and the updated number of damaged data blocks is recorded in the storage unit 131, and then returns to step S601.

舉例來說,經由讀取存儲單元131,確認第一系統資料A中的二個第一資料塊A1及A5為損壞時,首先複製第二系統資料B中的第二資料塊B1且將複製的第二資料塊B1取代第一資料塊A1,接著將記錄於存儲單元131中的損壞資料塊數量減一。接著,複製第二系統資料B中的第二資料塊B5且將複製的第二資料塊B5取代第一資料塊A5,接著將記錄於存儲單元131中的損壞資料塊數量再次減一。For example, when it is confirmed that the two first data blocks A1 and A5 in the first system data A are damaged by reading the storage unit 131, first copy the second data block B1 in the second system data B and copy the copied The second data block B1 replaces the first data block A1, and then the number of damaged data blocks recorded in the storage unit 131 is reduced by one. Next, copy the second data block B5 in the second system data B and replace the first data block A5 with the copied second data block B5, and then decrease the number of damaged data blocks recorded in the storage unit 131 by one again.

當確認損壞資料塊數量為零時,執行步驟S607。在步驟S607,完成資料修復機制。在資料修復機制被完成後,接續圖3中的步驟S315。When it is confirmed that the number of damaged data blocks is zero, step S607 is executed. In step S607, the data restoration mechanism is completed. After the data recovery mechanism is completed, continue to step S315 in FIG. 3 .

圖6的資料修復機制可由圖1的資料處理系統1來執行。詳言之,步驟S601~S609由資料處理系統1的處理器11來執行。然而,圖6的資料修復機制亦可由其他資料處理系統來執行,並不侷限於由圖1的資料處理系統1來執行。The data restoration mechanism in FIG. 6 can be executed by the data processing system 1 in FIG. 1 . In detail, steps S601 - S609 are executed by the processor 11 of the data processing system 1 . However, the data restoration mechanism in FIG. 6 can also be executed by other data processing systems, and is not limited to be executed by the data processing system 1 in FIG. 1 .

圖7為圖3中的切換機制的流程圖。共同參閱圖3與圖5,在步驟S315(判斷為”是”)以及步驟S505之後,接著執行圖7的步驟S701。在步驟S701,讀取存儲單元131。詳言之,使用中的第一系統資料A的狀態以及未被使用的第二系統資料B的狀態都會被記錄於存儲單元131,藉由讀取存儲單元131,可確認第一系統資料A以及第二系統資料B的狀態。在步驟S703,判斷對應於運行中的第一系統資料A的第二系統資料B是否完整。若確認第二系統資料B為完整時,則執行步驟S705。在步驟S705,更新存儲單元131中的系統使用狀態資訊,接著返回圖4的步驟S401。詳言之,存儲單元131中除了紀錄損壞資料塊資訊之外,還記錄有系統使用狀態資訊。舉例而言,當系統使用狀態資訊紀錄為第一系統資料A時,表示終端裝置1目前運行的系統資料為第一系統資料A。反之,當系統使用狀態資訊紀錄為第二系統資料B時,表示終端裝置1目前運行中的系統資料為第二系統資料B。若確認第二系統資料B並非完整時,則執行步驟S707。在步驟S707,退出切換機制。舉例來說,第一系統資料A為運行中的系統資料,則檢測第二系統資料B的每一第二資料塊是否損壞。當確認第二系統資料B的每一第二資料塊都未損壞時,表示第二系統資料B為完整而可取代運行中的第一系統資料A,且將第二系統資料B為完整的資訊紀錄於存儲單元131,並將紀錄於存儲單元131中的系統使用狀態資訊從第一系統資料A改為第二系統資料B。接者重新啟動終端裝置1。在終端裝置1重新啟動後,讀取存儲單元131中的系統使用狀態資訊,根據系統使用狀態資訊以選擇第二系統資料B作為加載目標。反之,當檢測到第二系統資料B中的任一第二資料塊有損壞時,表示第二系統資料B並非完整而無法替代運行中的第一系統資料A,故退出切換機制,依然維持第一系統資料A作為使用中的系統資料。FIG. 7 is a flowchart of the switching mechanism in FIG. 3 . Referring to FIG. 3 and FIG. 5 together, after step S315 (determined as “Yes”) and step S505, step S701 of FIG. 7 is then executed. In step S701, the storage unit 131 is read. Specifically, the state of the first system data A in use and the state of the second system data B not in use will be recorded in the storage unit 131, and by reading the storage unit 131, the first system data A and the The status of the second system profile B. In step S703, it is determined whether the second system profile B corresponding to the running first system profile A is complete. If it is confirmed that the second system data B is complete, step S705 is executed. In step S705, update the system usage status information in the storage unit 131, and then return to step S401 in FIG. 4 . In detail, in addition to recording the damaged data block information, the storage unit 131 also records system usage status information. For example, when the system usage status information record is the first system data A, it means that the system data currently running on the terminal device 1 is the first system data A. Conversely, when the system usage status information is recorded as the second system data B, it means that the system data currently running on the terminal device 1 is the second system data B. If it is confirmed that the second system data B is not complete, step S707 is executed. In step S707, the switching mechanism is exited. For example, if the first system data A is running system data, it is detected whether each second data block of the second system data B is damaged. When it is confirmed that each second data block of the second system data B is not damaged, it means that the second system data B is complete and can replace the running first system data A, and the second system data B is complete information record in the storage unit 131, and change the system usage state information recorded in the storage unit 131 from the first system data A to the second system data B. Then restart the terminal device 1. After the terminal device 1 is restarted, the system usage status information in the storage unit 131 is read, and the second system data B is selected as the loading target according to the system usage status information. Conversely, when any second data block in the second system data B is detected to be damaged, it means that the second system data B is not complete and cannot replace the running first system data A, so the switching mechanism is exited and the first system data is still maintained. A system data A is used as the system data in use.

圖7的切換機制可由圖1的資料處理系統1來執行。詳言之,步驟S701~S707由資料處理系統1的處理器11來執行。然而,圖7的切換機制亦可由其他資料處理系統來執行,並不侷限於由圖1的資料處理系統1來執行。The switching mechanism in FIG. 7 can be implemented by the data processing system 1 in FIG. 1 . In detail, steps S701 - S707 are executed by the processor 11 of the data processing system 1 . However, the switching mechanism in FIG. 7 can also be implemented by other data processing systems, and is not limited to be implemented by the data processing system 1 in FIG. 1 .

本發明的其中一有益效果在於,經由本發明所提供的終端裝置的資料處理系統及終端裝置的資料處理方法,可準確且快速地檢測到損壞資料塊的位置,減少不必要的擦寫並節省修復時間。再者,由於在啟動階段以及運行階段都均會對第一系統資料及第二系統資料的狀態進行檢測,如此能即時檢測到損壞點,減少異常運行的時間。資料修復機制提供了斷電保護,支持斷電續修復,且延長終端裝置的使用壽命。當終端裝置使用中的系統資料有異常且確認另一未使用的系統資料為完整,可將使用中的異常系統資料切換為未使用的完整系統資料。如此一來,延長了系統資料在記憶體內的壽命。再者,在記憶體壽命達到極限無法修復時,在第一系統資料與第二系統資料的相對應資料塊不同時損壞的情況下,本發明的啟動階段的加載機制, 依然可保證終端裝置的正常啟動和運行,終端裝置正常運行的壽命又得到了提高。One of the beneficial effects of the present invention is that, through the data processing system of the terminal device and the data processing method of the terminal device provided by the present invention, the position of the damaged data block can be detected accurately and quickly, reducing unnecessary erasure and saving Repair time. Furthermore, since the states of the first system data and the second system data are detected during both the start-up phase and the running phase, damage points can be detected in real time, and the time for abnormal operation can be reduced. The data recovery mechanism provides power-off protection, supports power-off continuous recovery, and prolongs the service life of the terminal device. When the system data in use of the terminal device is abnormal and another unused system data is confirmed to be complete, the abnormal system data in use can be switched to the unused complete system data. In this way, the lifetime of the system data in the memory is extended. Furthermore, when the life of the memory reaches the limit and cannot be repaired, and the corresponding data blocks of the first system data and the second system data are damaged at the same time, the loading mechanism in the startup phase of the present invention can still ensure the terminal device Normal startup and operation, the life of terminal equipment normal operation has been improved again.

以上所公開的內容僅為本發明的優選可行實施例,並非因此侷限本發明的申請專利範圍,所以凡是運用本發明說明書及圖式內容所做的等效技術變化,均包含於本發明的申請專利範圍內。The content disclosed above is only a preferred feasible embodiment of the present invention, and does not therefore limit the scope of the patent application of the present invention. Therefore, all equivalent technical changes made by using the description and drawings of the present invention are included in the application of the present invention. within the scope of the patent.

1:終端裝置 11:處理器 13:記憶體 131:存儲單元 A:第一系統資料 A1~AN:第一資料塊 B:第二系統資料 B1~BN:第二資料塊 S301:觸發啟動階段的異常檢測機制 S303:判斷被選為加載目標的系統資料是否成功被加載 S305:觸發運行階段的異常檢測機制 S307:終端裝置啟動失敗 S309:檢測運行中的系統資料的狀態是否異常 S311:觸發切換機制 S313:觸發資料修復機制 S315:判斷在資料修復機制中被修復的一個或多個損壞資料塊是否屬於運行中的系統資料 S317:退出資料修復機制 S401:讀取存儲單元 S403:根據存儲單元的資訊,選擇第一系統資料及第二系統資料之一作為加載目標 S405:加載第一系統資料中對應一加載順序的一第一資料塊 S407:檢測第一系統資料的第一資料塊的加載是否失敗 S409:紀錄損壞資訊於存儲單元 S411:加載順序加一 S413:判斷加載順序是否超過一臨界值 S415:終端裝置啟動成功 S417:檢測第二系統資料與第一系統資料的損壞資料塊相對應的第二資料塊是否損壞 S419:加載第二資料塊 S421:終端裝置啟動失敗 S423:加載第二系統資料中對應一加載順序的一第二資料塊 S425:檢測第二系統資料的第二資料塊的加載是否失敗 S427:紀錄損壞資訊於存儲單元 S429:加載順序加一 S431:判斷加載順序是否超過一臨界值 S433:終端裝置啟動成功 S435:檢測第一系統資料中與第二系統資料的損壞資料塊相對應的第一資料塊是否損壞 S437:加載第一資料塊 S439:終端裝置啟動失敗 S501:觸發運行階段的異常檢測機制 S503:檢測運行中的第一系統資料的狀態是否異常 S505:更新存儲單元的損壞資訊 S601:讀取存儲單元 S603:判斷損壞資料塊數量是否為零 S605:修復一個損壞資料塊 S607:資料修復機制被完成 S609:損壞資料塊的數量減一並將更新後的損壞資料塊數量紀錄於存儲單元 S701:讀取存儲單元 S703:判斷對應於運行中的第一系統資料的第二系統資料是否完整 S705:更新存儲單元中的系統使用狀態資訊 S707:退出切換機制 1: terminal device 11: Processor 13: Memory 131: storage unit A: The first system information A1~AN: the first data block B: The second system information B1~BN: the second data block S301: Trigger the abnormality detection mechanism in the startup phase S303: judging whether the system data selected as the loading target is loaded successfully S305: Trigger the abnormality detection mechanism in the running phase S307: Failed to start the terminal device S309: Detect whether the state of the running system data is abnormal S311: trigger switching mechanism S313: Trigger data restoration mechanism S315: Determine whether one or more damaged data blocks repaired in the data repair mechanism belong to running system data S317: Exit the data restoration mechanism S401: read storage unit S403: Select one of the first system data and the second system data as the loading target according to the information of the storage unit S405: Load a first data block corresponding to a loading order in the first system data S407: Detect whether loading of the first data block of the first system data fails S409: Record damage information in the storage unit S411: Add one to the loading order S413: Determine whether the loading sequence exceeds a critical value S415: The terminal device starts successfully S417: Detect whether the second data block corresponding to the damaged data block of the second system data and the first system data is damaged S419: load the second data block S421: Failed to start the terminal device S423: Load a second data block corresponding to a loading order in the second system data S425: Detect whether the loading of the second data block of the second system data fails S427: Record damage information in the storage unit S429: Add one to the loading order S431: Determine whether the loading sequence exceeds a critical value S433: The terminal device starts successfully S435: Detect whether the first data block corresponding to the damaged data block of the second system data in the first system data is damaged S437: Load the first data block S439: Failed to start the terminal device S501: Trigger the anomaly detection mechanism in the running phase S503: Detect whether the state of the running first system data is abnormal S505: updating the damage information of the storage unit S601: read storage unit S603: judging whether the number of damaged data blocks is zero S605: Repair a damaged data block S607: The data recovery mechanism is completed S609: the number of damaged data blocks is reduced by one and the updated number of damaged data blocks is recorded in the storage unit S701: Read storage unit S703: judging whether the second system data corresponding to the running first system data is complete S705: Updating the system usage state information in the storage unit S707: Exit the switching mechanism

圖1為本發明一實施例的終端裝置的資料處理系統的功能方塊圖。FIG. 1 is a functional block diagram of a data processing system of a terminal device according to an embodiment of the present invention.

圖2為圖1中的系統資料以及備份系統資料儲存於記憶體的示意圖。FIG. 2 is a schematic diagram of storing system data and backup system data in memory in FIG. 1 .

圖3為本發明一實施例的終端裝置的資料處理方法的流程圖。FIG. 3 is a flowchart of a data processing method of a terminal device according to an embodiment of the present invention.

圖4為圖3中的啟動階段的異常檢測機制的流程圖。FIG. 4 is a flow chart of the anomaly detection mechanism in the start-up phase in FIG. 3 .

圖5為圖3中的運行階段的異常檢測機制的流程圖。FIG. 5 is a flow chart of the anomaly detection mechanism in the running phase in FIG. 3 .

圖6為圖3中的運行階段的資料修復機制的流程圖。FIG. 6 is a flow chart of the data restoration mechanism in the running phase in FIG. 3 .

圖7為圖3中的切換機制的流程圖。FIG. 7 is a flowchart of the switching mechanism in FIG. 3 .

S301:觸發啟動階段的異常檢測機制 S301: Trigger the abnormality detection mechanism in the startup phase

S303:判斷被選為加載目標的系統資料是否成功被加載 S303: judging whether the system data selected as the loading target is loaded successfully

S305:觸發運行階段的異常檢測機制 S305: Trigger the abnormality detection mechanism in the running phase

S307:終端裝置啟動失敗 S307: Failed to start the terminal device

S309:檢測運行中的系統資料的狀態是否異常 S309: Detect whether the state of the running system data is abnormal

S311:觸發切換機制 S311: trigger switching mechanism

S313:觸發資料修復機制 S313: Trigger data restoration mechanism

S315:判斷在資料修復機制中被修復的一個或多個損壞資料塊是否屬於運行中的系統資料 S315: Determine whether one or more damaged data blocks repaired in the data repair mechanism belong to running system data

S317:退出資料修復機制 S317: Exit the data restoration mechanism

Claims (10)

一種終端裝置的資料處理方法,該終端裝置儲存有一第一系統資料及相同於該第一系統資料的一第二系統資料,該第一系統資料包含多個第一資料塊,而該第二系統資料包含多個第二資料塊,該些第一資料塊分別對應該些第二資料塊,該資料處理方法包括:依序地加載該第一系統資料的該些第一資料塊;在每一次加載該第一系統資料的該第一資料塊時,檢測該第一系統資料的該第一資料塊是否損壞;當該第一系統資料的該第一資料塊損壞時,紀錄一損壞資訊於一存儲單元;檢測該第二系統資料中與損壞的該第一資料塊相對應的該第二資料塊是否損壞;當該第二資料塊未損壞時,加載該第二資料塊;以及在檢測完該第一系統資料的所有第一資料塊之後,觸發一資料修復機制,其中,該資料修復機制包含:讀取該存儲單元的該損壞資訊以判斷一損壞資料塊數量是否為零;當該損壞資料塊數量不為零時,修復一個或多個損壞資料塊;及每修復一個損壞資料塊之後,更新該損壞資訊;當該損壞資料塊數量為零時,判斷被修復的該損壞資料塊或該些損壞資料塊是否屬於運行中的該第一系統資料;若屬於運行中的該第一系統資料,則觸發一切換機制;當被修復的該損壞資料塊或該些損壞資料塊不屬於運行中的該第一系統資料,退出該資料修復機制。 A data processing method for a terminal device, the terminal device stores a first system data and a second system data identical to the first system data, the first system data includes a plurality of first data blocks, and the second system data The data includes a plurality of second data blocks, and the first data blocks respectively correspond to the second data blocks. The data processing method includes: sequentially loading the first data blocks of the first system data; When loading the first data block of the first system data, detect whether the first data block of the first system data is damaged; when the first data block of the first system data is damaged, record a damage information in a storage unit; detect whether the second data block corresponding to the damaged first data block in the second system data is damaged; when the second data block is not damaged, load the second data block; and after the detection After all the first data blocks of the first system data, a data repair mechanism is triggered, wherein the data repair mechanism includes: reading the damage information of the storage unit to determine whether a number of damaged data blocks is zero; when the damage When the number of data blocks is not zero, repair one or more damaged data blocks; and after each damaged data block is repaired, the damage information is updated; when the number of damaged data blocks is zero, it is judged that the damaged data block or Whether the damaged data blocks belong to the running first system data; if they belong to the running first system data, a switching mechanism is triggered; when the damaged data block or the damaged data blocks to be repaired do not belong to the running The first system data in the system exits the data recovery mechanism. 如請求項1所述之終端裝置的資料處理方法,更包括在檢測完該第一系統資料的所有第一資料塊之後,當每一次運行該 第一系統資料的該至少一第一資料塊時,觸發一異常檢測機制。 The data processing method of the terminal device as described in claim item 1 further includes after detecting all the first data blocks of the first system data, when running the When the at least one first data block of the first system data is used, an abnormality detection mechanism is triggered. 如請求項2所述之終端裝置的資料處理方法,其中該異常檢測機制包含:檢測該第一系統資料的該第一資料塊的狀態是否異常;當該第一系統資料的該第一資料塊的狀態為異常時,更新該存儲單元中的該損壞資訊;在更新該損壞資訊之後,觸發一切換機制。 The data processing method of the terminal device as described in claim 2, wherein the abnormality detection mechanism includes: detecting whether the state of the first data block of the first system data is abnormal; when the first data block of the first system data When the state of the device is abnormal, the damage information in the storage unit is updated; after the damage information is updated, a switching mechanism is triggered. 如請求項3所述之終端裝置的資料處理方法,其中該切換機制包含:檢測該第二系統資料是否完整;當該第二系統資料為完整時,更新該存儲單元中的一系統使用狀態資訊,重新啟動該終端裝置且選擇加載該第二系統資料;當該第二系統資料不完整時,退出該切換機制。 The data processing method of the terminal device as described in claim 3, wherein the switching mechanism includes: detecting whether the second system data is complete; when the second system data is complete, updating a system usage status information in the storage unit , restart the terminal device and choose to load the second system information; when the second system information is incomplete, exit the switching mechanism. 如請求項1所述之終端裝置的資料處理方法,其中修復每一損壞資料塊包含:複製與該損壞資料塊對應的該第二資料塊;以及由複製的該第二資料塊取代該損壞資料塊。 The data processing method of a terminal device as described in Claim 1, wherein repairing each damaged data block includes: copying the second data block corresponding to the damaged data block; and replacing the damaged data by the copied second data block Piece. 如請求項1所述之終端裝置的資料處理方法,更包括在觸發該切換機制之後,重新啟動該終端裝置且加載該第二系統資料。 The data processing method of the terminal device as described in Claim 1 further includes restarting the terminal device and loading the second system data after the switching mechanism is triggered. 一種終端裝置的資料處理系統,包含:一記憶體,儲存一第一系統資料以及相同於該第一系統資料的一第二系統資料,其中該第一系統資料包含多個第一資料塊,該第二系統資料包含多個第二資料塊,該些第一資料塊分別對應於該些第二資料塊;一處理器,電性連接於該記憶體,該處理器用於觸發該終端裝置的一啟動階段,而該啟動階段包含:依序地加載該第一系統資料的該些第一資料塊;在每一次加載該第一系統資料的該第一資料塊時,檢測 該第一系統資料的該第一資料塊是否損壞;當該第一系統資料的該第一資料塊損壞時,紀錄一損壞資訊於一存儲單元;檢測該第二系統資料中與損壞的該第一資料塊相對應的該第二資料塊是否損壞;以及當該第二資料塊未損壞時,加載該第二資料塊,其中,當該終端裝置進入一運行階段時,該處理器用於觸發一資料修復機制,該處理器用於根據被修復的損壞資料塊是否屬於運行中的該第一系統資料來決定是否觸發一切換機制。 A data processing system of a terminal device, comprising: a memory storing a first system data and a second system data identical to the first system data, wherein the first system data includes a plurality of first data blocks, the The second system data includes a plurality of second data blocks, the first data blocks respectively correspond to the second data blocks; a processor electrically connected to the memory, the processor is used to trigger a terminal device The startup phase, and the startup phase includes: sequentially loading the first data blocks of the first system data; each time the first data blocks of the first system data are loaded, detecting Whether the first data block of the first system data is damaged; when the first data block of the first system data is damaged, record a damage information in a storage unit; detect the second system data and the damaged first data block Whether the second data block corresponding to a data block is damaged; and when the second data block is not damaged, load the second data block, wherein, when the terminal device enters a running phase, the processor is used to trigger a A data repair mechanism, the processor is used to determine whether to trigger a switching mechanism according to whether the repaired damaged data block belongs to the running first system data. 如請求項7所述之終端裝置的資料處理系統,其中當該終端裝置進入該運行階段時,該處理器用於觸發一異常檢測機制以檢測該第一系統資料的狀態是否異常以及根據一檢查結果判斷是否觸發該切換機制。 The data processing system of the terminal device as described in claim 7, wherein when the terminal device enters the operation stage, the processor is used to trigger an abnormality detection mechanism to detect whether the state of the first system data is abnormal and according to a check result Determine whether to trigger the switching mechanism. 一種終端裝置的資料處理方法,該終端裝置儲存有一第一系統資料及相同於該第一系統資料的一第二系統資料,而該資料處理方法包括:觸發一啟動階段的一異常檢測機制;判斷被選為一加載目標的該第一系統資料是否成功被加載;當該第一系統資料成功被加載,進入一運行階段;觸發該運行階段的一資料修復機制;判斷在該資料修復機制中的被修復的一損壞資料塊是否屬於運行中的該第一系統資料;當被修復的該損壞資料塊屬於運行中的該第一系統資料,觸發一切換機制;以及當被修復的該損壞資料塊不屬於運行中的該第一系統 資料,退出該資料修復機制。 A data processing method for a terminal device, the terminal device stores a first system data and a second system data identical to the first system data, and the data processing method includes: triggering an abnormality detection mechanism in a start-up phase; judging Whether the first system data selected as a loading target is successfully loaded; when the first system data is successfully loaded, enter a running phase; trigger a data recovery mechanism in the running phase; determine the data recovery mechanism in the data recovery mechanism Whether a damaged data block to be repaired belongs to the first system data in operation; when the damaged data block to be repaired belongs to the first system data in operation, a switching mechanism is triggered; and when the damaged data block to be repaired belongs to the first system data in operation Not part of the primary system in operation data, exit the data recovery mechanism. 如請求項9所述之終端裝置的資料處理方法,更包含觸發該運行階段的一異常檢測機制;當運行中的該第一系統資料的狀態檢測為異常時,觸發該切換機制。 The data processing method of the terminal device as described in Claim 9 further includes triggering an abnormality detection mechanism in the running stage; when the state of the running first system data is detected to be abnormal, the switching mechanism is triggered.
TW110138294A 2021-10-15 2021-10-15 Data processing method of terminal device and data processing system of terminal device TWI784750B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW110138294A TWI784750B (en) 2021-10-15 2021-10-15 Data processing method of terminal device and data processing system of terminal device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW110138294A TWI784750B (en) 2021-10-15 2021-10-15 Data processing method of terminal device and data processing system of terminal device

Publications (2)

Publication Number Publication Date
TWI784750B true TWI784750B (en) 2022-11-21
TW202318197A TW202318197A (en) 2023-05-01

Family

ID=85794610

Family Applications (1)

Application Number Title Priority Date Filing Date
TW110138294A TWI784750B (en) 2021-10-15 2021-10-15 Data processing method of terminal device and data processing system of terminal device

Country Status (1)

Country Link
TW (1) TWI784750B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW201614495A (en) * 2014-10-08 2016-04-16 Farstone Technology Inc Backup method, recovery method and computer, computer program product and computer readable recording medium thereof
CN110058965A (en) * 2018-01-18 2019-07-26 伊姆西Ip控股有限责任公司 Data re-establishing method and equipment in storage system
CN110347530A (en) * 2018-04-06 2019-10-18 爱思开海力士有限公司 Data storage device and its operating method
CN111381766A (en) * 2018-12-28 2020-07-07 杭州海康威视系统技术有限公司 Method for dynamically loading disk and cloud storage system
CN111417931A (en) * 2017-11-30 2020-07-14 华睿泰科技有限责任公司 Performing backup operations using a copy
CN112764968A (en) * 2020-12-29 2021-05-07 杭州海康威视系统技术有限公司 Data processing method, device, equipment and storage medium
CN113157487A (en) * 2020-01-23 2021-07-23 华为技术有限公司 Data recovery method and apparatus thereof
CN113419897A (en) * 2021-01-19 2021-09-21 阿里巴巴集团控股有限公司 File processing method and device, electronic equipment and storage medium thereof

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW201614495A (en) * 2014-10-08 2016-04-16 Farstone Technology Inc Backup method, recovery method and computer, computer program product and computer readable recording medium thereof
CN111417931A (en) * 2017-11-30 2020-07-14 华睿泰科技有限责任公司 Performing backup operations using a copy
CN110058965A (en) * 2018-01-18 2019-07-26 伊姆西Ip控股有限责任公司 Data re-establishing method and equipment in storage system
CN110347530A (en) * 2018-04-06 2019-10-18 爱思开海力士有限公司 Data storage device and its operating method
CN111381766A (en) * 2018-12-28 2020-07-07 杭州海康威视系统技术有限公司 Method for dynamically loading disk and cloud storage system
CN113157487A (en) * 2020-01-23 2021-07-23 华为技术有限公司 Data recovery method and apparatus thereof
CN112764968A (en) * 2020-12-29 2021-05-07 杭州海康威视系统技术有限公司 Data processing method, device, equipment and storage medium
CN113419897A (en) * 2021-01-19 2021-09-21 阿里巴巴集团控股有限公司 File processing method and device, electronic equipment and storage medium thereof

Also Published As

Publication number Publication date
TW202318197A (en) 2023-05-01

Similar Documents

Publication Publication Date Title
US7197613B2 (en) Nonvolatile memory
JP5402693B2 (en) Disk array device control method and disk array device
US8312314B2 (en) Storage system and control method of storage system
JP4884885B2 (en) Storage controller and storage controller failure recovery method
US8341386B2 (en) Method for updating basic input/output system and method for repairing thereof
JP5831271B2 (en) Method and system for starting refresh operation of semiconductor nonvolatile memory device
US10713128B2 (en) Error recovery in volatile memory regions
US20100185804A1 (en) Information processing device that accesses memory, processor and memory management method
CN105122262A (en) Redundant system boot code in a secondary non-volatile memory
US9710375B2 (en) Writing an address conversion table for nonvolatile memory wear leveling
CN104077375A (en) Method for handling error catalogs of nodes in CC-NUMA system and nodes
JP7318367B2 (en) Storage control device and storage control program
JPH03224045A (en) Data holding system
CN115904231A (en) RAID card power failure processing method and related device
TWI784750B (en) Data processing method of terminal device and data processing system of terminal device
TW202209124A (en) Ssd supporting read-only mode after plp backup failure
JPH10161938A (en) Disk controller
JP6677021B2 (en) Information processing apparatus, information processing method, and program
CN116560916A (en) Disk switching method, system, device, medium and distributed storage system
JP2009104369A (en) Disk sub-system
CN115904823A (en) Data processing method and data processing system of terminal device
JP2007058873A (en) Device control device using nonvolatile memory
KR20110039416A (en) Data storage method, apparatus and system for interrupted write recovery
JP2008059007A (en) Semiconductor storage device
US11836033B2 (en) Information processing apparatus and control method for controlling information processing apparatus