CN102890647A - Method and device for storing and updating data - Google Patents

Method and device for storing and updating data Download PDF

Info

Publication number
CN102890647A
CN102890647A CN2012102304430A CN201210230443A CN102890647A CN 102890647 A CN102890647 A CN 102890647A CN 2012102304430 A CN2012102304430 A CN 2012102304430A CN 201210230443 A CN201210230443 A CN 201210230443A CN 102890647 A CN102890647 A CN 102890647A
Authority
CN
China
Prior art keywords
data
memory block
memory
storage
update
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.)
Granted
Application number
CN2012102304430A
Other languages
Chinese (zh)
Other versions
CN102890647B (en
Inventor
李松涛
徐越
李林
陈永坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZHANGZHOU CANNET ELECTRICAL APPLIANCE CO Ltd
Original Assignee
ZHANGZHOU CANNET ELECTRICAL APPLIANCE CO Ltd
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 ZHANGZHOU CANNET ELECTRICAL APPLIANCE CO Ltd filed Critical ZHANGZHOU CANNET ELECTRICAL APPLIANCE CO Ltd
Priority to CN201210230443.0A priority Critical patent/CN102890647B/en
Publication of CN102890647A publication Critical patent/CN102890647A/en
Application granted granted Critical
Publication of CN102890647B publication Critical patent/CN102890647B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The invention discloses a method and a device for storing and updating data. The method comprises the steps of: planning three storage areas with the same size and respectively storing the same data before updating; sequentially interrupting data updating of an accident in the process of updating data of three storage areas, electrifying the three storage areas again, sequentially reading the data stored in the storage area S1 and a storage area S2, if the data of the storage area S1 is the same as that of the storage area S2, judging the data of the storage area S1 to be valid data (VD), carrying out consistency updating on the data in the storage area S3, or else, regarding the data in the storage area S3 as the valid data (VD), and carrying out consistency updating on the data in the storage area S1 and the storage area S2. By adopting the scheme, the redundancy data backup of the three storage areas is utilized, and the phenomenon of data loss is not generated even if the accident (for example power failure or resetting) appears in an operating process by simply judging and identifying the validity of the data.

Description

A kind of data storage and update method and device
Technical field
The present invention relates to a kind of disposal route and device of computer data, particularly a kind of data storage and update method and device.
Background technology
Computer system is owing to the complicacy of its system, and some do not allow to lose for the very crucial core data of system, and are all the more so for embedded system.Losing of these core datas is fatal to the destruction of system.
At present, for the storage mode of system data, generally be that following several situation is arranged: one, carry out disposable storage to data; Its two, data are carried out secondary storage and are compared; Its three, increase complicated checking algorithm and error correction algorithm.For front dual mode, such as fortuitous events such as suddenly power down in operating process, the storage data flaw occurs and can't differentiate recovery for some.For the third mode, when the complicated checking algorithm of operation and error correction algorithm, need to take system a large amount of operation time, reduce the data effective processing capacity of computer system and hardware thereof.
Summary of the invention
Be to solve the technical matters that exists in the prior art, the invention provides and a kind ofly have no progeny in the Data Update under fortuitous event occurring, re-powering can be fast and the storage and update method and the device that reliably data are upgraded.
The present invention solves the problems of the technologies described above, the technical scheme that adopts is: a kind of data storage and update method are provided, may further comprise the steps, step 10, identical data before the memory block of three formed objects of planning and the difference storage update, three memory blocks are memory block S1, memory block S2 and memory block S3 successively; Step 20 is carried out the event that meets accident in the process of Data Update to three memory blocks successively, causes Data Update to be interrupted; Step 30, again three memory blocks are powered on, read successively the data of storage in memory block S1 and the memory block S2, if the data of memory block S1 are identical with the data of memory block S2, then take the data of memory block S1 as valid data VD, and the data in the S3 of memory block are carried out consistent update, otherwise take the data of memory block S3 as valid data VD, and the data in memory block S1, the memory block S2 are carried out consistent update.
As preferred version of the present invention, described step 30 is further comprising the steps, and step 31 powers on to three memory blocks, and reads respectively the interior data D1 of memory block S1 and the data D2 in the S2 of memory block; Step 32 is carried out relatively data D1 and data D2, if data D1 is identical with data D2, then enters step 33, otherwise skips to step 36; Step 33 reads the data D3 in the S3 of memory block, and judges that whether data D3 is identical with data D2, if identical, then skips to step 35; If different, then enter step 34; Step 34 is updated to memory block S3 with data D1; Step 35, return data D1 finishes as valid data VD; Step 36 reads the data D3 in the S3 of memory block, and judges that whether data D3 is identical with data D2, if identical, then skips to step 38, otherwise enters step 37; Step 37 is updated to memory block S2 with data D3; Step 38 is updated to memory block S1 with data D3; Step 39, return data D3 finishes as valid data VD.
The present invention solves the problems of the technologies described above, and the technical scheme that adopts is: a kind of data storage and updating device are provided, comprise memory block S1, memory block S2, the memory block S3 of three formed objects, and the data that store these three memory blocks are identical; Because having to upgrade, unscheduled event do not finish above-mentioned three memory blocks being carried out in the data updating process; Again after three memory blocks being powered on, read successively the data of storage in memory block S1 and the memory block S2, if the data of memory block S1 are identical with the data of memory block S2, then take the data of memory block S1 as valid data VD, and the data in the S3 of memory block are carried out consistent update, otherwise take the data of memory block S3 as valid data VD, and the data in memory block S1, the memory block S2 are carried out consistent update.
Technical scheme of the present invention is with respect to prior art, the beneficial effect of obtaining; Data storage of the present invention and update method and device, utilize the redundant copies of data of three memory blocks, by the validity of simple judgement recognition data, even the phenomenon of obliterated data also can not appear in the event that meets accident in operating process (such as power down or reset).Adopt such scheme, not only guaranteed the safety of data, and its computing is also very simple, does not need to take a large amount of CPU (controller) resource.
Description of drawings
Accompanying drawing described herein is used to provide a further understanding of the present invention, consists of a part of the present invention, and illustrative examples of the present invention and explanation thereof are used for explaining the present invention, do not consist of improper restriction of the present invention.In the accompanying drawings:
Fig. 1 is data storage of the present invention and update method process flow diagram;
Fig. 2 is the local process flow diagram of data storage of the present invention and update method;
Fig. 3 is data storage of the present invention and update method procedure chart;
Fig. 4 is data storage of the present invention and updating device block diagram.
Embodiment
In order to make technical matters to be solved by this invention, technical scheme and beneficial effect clearer, clear, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, is not intended to limit the present invention.
Such as Fig. 1, shown in Figure 3, data storage of the present invention and update method is characterized in that, may further comprise the steps 10 to step 30.Wherein,
Step 10, the identical data before the memory block of three formed objects of planning and the difference storage update, three memory blocks are memory block S1, memory block S2 and memory block S3 successively.The memory block can as required, be opened up at primary memory, supplementary storage, cache memory.Data can be system core data, also can be other data higher to security level required.
Step 20 is carried out the event that meets accident in the process of Data Update to three memory blocks successively, causes Data Update to be interrupted.Unscheduled event can be such as power down or the reason such as reset, and can occur by any time point in data updating process.
Step 30, again three memory blocks are powered on, read successively the data of storage in memory block S1 and the memory block S2, if the data of memory block S1 are identical with the data of memory block S2, then take the data of memory block S1 as valid data VD, and the data in the S3 of memory block are carried out consistent update, otherwise take the data of memory block S3 as valid data VD, and the data in memory block S1, the memory block S2 are carried out consistent update.
For step 30, may further include following steps, as shown in Figure 2,
Step 31 powers on to three memory blocks, and reads respectively the interior data D1 of memory block S1 and the data D2 in the S2 of memory block;
Step 32 is carried out relatively data D1 and data D2, if data D1 is identical with data D2, then enters step 33, otherwise skips to step 36;
Step 33 reads the data D3 in the S3 of memory block, and judges that whether data D3 is identical with data D2, if identical, then skips to step 35; If different, then enter step 34;
Step 34 is updated to memory block S3 with data D1;
Step 35, return data D1 finishes as valid data VD;
Step 36 reads the data D3 in the S3 of memory block, and judges that whether data D3 is identical with data D2, if identical, then skips to step 38, otherwise enters step 37;
Step 37 is updated to memory block S2 with data D3;
Step 38 is updated to memory block S1 with data D3;
Step 39, return data D3 finishes as valid data VD.
As shown in Figure 3, specifically, namely be,
The data that X-store the memory block before writing;
The data that store the memory block in Y-ablation process;
Z-the write data that store the memory block when finishing.
Sequence number 1: event meets accident before renewal.Data D3 in the data D2 in the data D1 in the S1 of memory block, memory block S2, memory block S3 is all raw data X, since D1=D2=D3=X, therefore, after re-powering, data in memory block S2, the memory block S3 still are X, return as valid data VD with the data X in the S1 of memory block.
Sequence number 2, event meets accident when writing memory block S1.This moment is because the data D1 in the S1 of memory block changes D1=Y, and D2=D3=X.Do not finish because the data D1 in the S1 of memory block upgrades, data have lost integrality.Therefore, after re-powering, with the data D3 in the S3 of memory block the data Y in the S1 of memory block is updated to X, returns as valid data VD with the data X in the S3 of memory block.
Sequence number 3, event meets accident when just in time writing memory block S1.The interior data D1 of memory block S1 this moment changes D1=Z.Although the data D1 in the memory block upgrades and finishes at this moment, data have integrality, and the difficult judgement of computing machine or judgement need to the more hardware costs of cost.At this moment, processing mode such as sequence number 2, namely be, with the data D3 in the S3 of memory block the data Y in the S1 of memory block is updated to X, return as valid data VD with the data X in the S3 of memory block.
Sequence number 4, event meets accident when writing memory block S2.At this moment, the data D1 in the S1 of memory block upgrades and finishes D1=Z; And the data D2 in the S2 of memory block does not have renewal to finish, and loses the integrality of data, D2=Y; Data D3 in the S3 of memory block still is raw data X.At this moment, the data with in the data X in the S3 of memory block successively updated stored district S2 and the memory block S1 make D3=D2=D1=X, and return as valid data VD with the data X in the S3 of memory block.
Sequence number 5, event meets accident when just in time writing memory block S2.The relation of data D2 in data D1, the memory block S2 in the S1 of memory block is at this moment: D1=D2=Z.At this moment, the data with in the data Z updated stored district S3 in the S1 of memory block make D1=D2=D3=Z, and return as valid data VD with the data Z in the S1 of memory block.
Sequence number 6, event meets accident when writing memory block S3.At this moment, the data relationship in memory block S1, memory block S2, the memory block S3 is: D1=D2=Z, D3=Y.At this moment, the data with in the data Z updated stored district S3 in the S1 of memory block make D1=D2=D3=Z, and return as valid data VD with the data Z in the S1 of memory block.
Sequence number 7, event meets accident when just in time writing memory block S3.At this moment, the data relationship in memory block S1, memory block S2, the memory block S3 is: D1=D2=D3=Z.At this moment, return as valid data VD with the data Z in the S1 of memory block.
As shown in Figure 4, the present invention also provides a kind of data storage and updating device for solving the technical matters that exists in the prior art, comprise memory block S1, memory block S2, the memory block S3 of three formed objects, and the data that store these three memory blocks is identical.The data interaction of three memory blocks needs controller (CPU) to control.Above-mentioned three memory blocks are being carried out upgrading interruption because of unscheduled event in the data updating process; Again after three memory blocks being powered on, read successively the data of storage in memory block S1 and the memory block S2, if the data of memory block S1 are identical with the data of memory block S2, then take the data of memory block S1 as valid data VD, and the data in the S3 of memory block are carried out consistent update, otherwise take the data of memory block S3 as valid data VD, and the data in memory block S1, the memory block S2 are carried out consistent update.Memory block S1, memory block S2, memory block S3 are to the processing procedure of data, and be identical with described data storage and update method, this tired stating.
Above-mentioned explanation illustrates and has described the preferred embodiments of the present invention, as previously mentioned, be to be understood that the present invention is not limited to the disclosed form of this paper, should not regard the eliminating to other embodiment as, and can be used for various other combinations, modification and environment, and can in invention contemplated scope described herein, change by technology or the knowledge of above-mentioned instruction or association area.And the change that those skilled in the art carry out and variation do not break away from the spirit and scope of the present invention, then all should be in the protection domain of claims of the present invention.

Claims (3)

1. a data storage and update method is characterized in that, may further comprise the steps,
Step 10, the identical data before the memory block of three formed objects of planning and the difference storage update, three memory blocks are memory block S1, memory block S2 and memory block S3 successively;
Step 20 is carried out the event that meets accident in the process of Data Update to three memory blocks successively, causes Data Update to be interrupted;
Step 30, again three memory blocks are powered on, read successively the data of storage in memory block S1 and the memory block S2, if the data of memory block S1 are identical with the data of memory block S2, then take the data of memory block S1 as valid data VD, and the data in the S3 of memory block are carried out consistent update, otherwise take the data of memory block S3 as valid data VD, and the data in memory block S1, the memory block S2 are carried out consistent update.
2. data storage according to claim 1 and update method is characterized in that, described step 30 is further comprising the steps,
Step 31 powers on to three memory blocks, and reads respectively the interior data D1 of memory block S1 and the data D2 in the S2 of memory block;
Step 32 is carried out relatively data D1 and data D2, if data D1 is identical with data D2, then enters step 33, otherwise skips to step 36;
Step 33 reads the data D3 in the S3 of memory block, and judges that whether data D3 is identical with data D2, if identical, then skips to step 35; If different, then enter step 34;
Step 34 is updated to memory block S3 with data D1;
Step 35, return data D1 finishes as valid data VD;
Step 36 reads the data D3 in the S3 of memory block, and judges that whether data D3 is identical with data D2, if identical, then skips to step 38, otherwise enters step 37;
Step 37 is updated to memory block S2 with data D3;
Step 38 is updated to memory block S1 with data D3;
Step 39, return data D3 finishes as valid data VD.
3. a data storage and updating device is characterized in that, comprise memory block S1, memory block S2, the memory block S3 of three formed objects, and the data that store these three memory blocks are identical; Because having to upgrade, unscheduled event do not finish above-mentioned three memory blocks being carried out in the data updating process; Again after three memory blocks being powered on, read successively the data of storage in memory block S1 and the memory block S2, if the data of memory block S1 are identical with the data of memory block S2, then take the data of memory block S1 as valid data VD, and the data in the S3 of memory block are carried out consistent update, otherwise take the data of memory block S3 as valid data VD, and the data in memory block S1, the memory block S2 are carried out consistent update.
CN201210230443.0A 2012-07-04 2012-07-04 Method and device for storing and updating data Active CN102890647B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210230443.0A CN102890647B (en) 2012-07-04 2012-07-04 Method and device for storing and updating data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210230443.0A CN102890647B (en) 2012-07-04 2012-07-04 Method and device for storing and updating data

Publications (2)

Publication Number Publication Date
CN102890647A true CN102890647A (en) 2013-01-23
CN102890647B CN102890647B (en) 2015-04-22

Family

ID=47534155

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210230443.0A Active CN102890647B (en) 2012-07-04 2012-07-04 Method and device for storing and updating data

Country Status (1)

Country Link
CN (1) CN102890647B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103295632A (en) * 2013-05-28 2013-09-11 中国电子科技集团公司第十研究所 Method for preventing accidental power failure from causing linear accumulated data mutation
CN103389919A (en) * 2013-07-30 2013-11-13 浙江中控技术股份有限公司 Data processing method and device based on redundant equipment system
CN105448339A (en) * 2015-12-07 2016-03-30 中国电子科技集团公司第十研究所 Prevention method for linear accumulation data mutation of accidental power failure of nonvolatile memory
CN106383775A (en) * 2015-08-18 2017-02-08 上海景格科技股份有限公司 Equipment usage time recording method and device thereof
CN108153486A (en) * 2017-11-27 2018-06-12 深圳市有方科技股份有限公司 The running parameter guard method of embedded system and relevant device
CN108278745A (en) * 2018-01-22 2018-07-13 珠海格力电器股份有限公司 Air-conditioning and its multi-party backup method of unit parameter and device
CN110347430A (en) * 2019-07-12 2019-10-18 四川虹美智能科技有限公司 A kind of parameter of electric machine read method, apparatus and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050091280A1 (en) * 2003-10-23 2005-04-28 Marco Winter Method and apparatus for recording data and recovering recorded data
US20050144407A1 (en) * 2003-12-31 2005-06-30 Colgrove John A. Coordinated storage management operations in replication environment
CN101470666A (en) * 2007-12-24 2009-07-01 比亚迪股份有限公司 Data memory method
CN101694636A (en) * 2009-10-21 2010-04-14 上海坚芯电子科技有限公司 Updating backup system and method for data of nonvolatile data memory
CN102087623A (en) * 2010-12-02 2011-06-08 东方口岸科技有限公司 Data protection method during power-fail of special USB (Universal Serial Bus) storage equipment in data updating

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050091280A1 (en) * 2003-10-23 2005-04-28 Marco Winter Method and apparatus for recording data and recovering recorded data
US20050144407A1 (en) * 2003-12-31 2005-06-30 Colgrove John A. Coordinated storage management operations in replication environment
CN101470666A (en) * 2007-12-24 2009-07-01 比亚迪股份有限公司 Data memory method
CN101694636A (en) * 2009-10-21 2010-04-14 上海坚芯电子科技有限公司 Updating backup system and method for data of nonvolatile data memory
CN102087623A (en) * 2010-12-02 2011-06-08 东方口岸科技有限公司 Data protection method during power-fail of special USB (Universal Serial Bus) storage equipment in data updating

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103295632A (en) * 2013-05-28 2013-09-11 中国电子科技集团公司第十研究所 Method for preventing accidental power failure from causing linear accumulated data mutation
CN103389919A (en) * 2013-07-30 2013-11-13 浙江中控技术股份有限公司 Data processing method and device based on redundant equipment system
CN103389919B (en) * 2013-07-30 2016-09-14 浙江中控技术股份有限公司 A kind of data processing method based on redundant equipment system and device
CN106383775A (en) * 2015-08-18 2017-02-08 上海景格科技股份有限公司 Equipment usage time recording method and device thereof
CN106383775B (en) * 2015-08-18 2019-03-08 上海景格科技股份有限公司 Equipment uses time recording method and its device
CN105448339A (en) * 2015-12-07 2016-03-30 中国电子科技集团公司第十研究所 Prevention method for linear accumulation data mutation of accidental power failure of nonvolatile memory
CN108153486A (en) * 2017-11-27 2018-06-12 深圳市有方科技股份有限公司 The running parameter guard method of embedded system and relevant device
CN108278745A (en) * 2018-01-22 2018-07-13 珠海格力电器股份有限公司 Air-conditioning and its multi-party backup method of unit parameter and device
CN110347430A (en) * 2019-07-12 2019-10-18 四川虹美智能科技有限公司 A kind of parameter of electric machine read method, apparatus and system

Also Published As

Publication number Publication date
CN102890647B (en) 2015-04-22

Similar Documents

Publication Publication Date Title
CN102890647A (en) Method and device for storing and updating data
US10642596B2 (en) Embedded device and program updating method
CN101903866B (en) Method and system for storage of data in non-volatile media
CN101840380B (en) Apparatus and method to protect metadata against unexpected power down
CN101241464B (en) Method for checking stack frame destruction
US20120198149A1 (en) Efficiently synchronizing with separated disk caches
CN102999431A (en) Weave sequence counter for non-volatile memory systems
EP2329366B1 (en) Performing a pre-update on a non volatile memory
KR101651204B1 (en) Apparatus and Method for synchronization of snapshot image
CN104050094A (en) System, method and computer-readable medium for managing a cache store to achieve improved cache ramp-up across system reboots
CN103154893A (en) Multicore processor system, method of monitoring control, and monitoring control program
CN104102535B (en) Process migration method and transportable operating system
CN100576190C (en) Use and substitute computer implemented method and the device that the page pool managing DMA writes page fault
CN102411523A (en) Method and device for storing file backups and backup method for file systems
KR102590180B1 (en) Apparatus and method for managing qualification metadata
CN106133704A (en) Memory failure partition method and device
CN106227620B (en) Recoverable Flash data storage method
CN102934089A (en) Error detection for files
CN108228091B (en) Configuration data partition storage method and system and configuration data verification method and system
CN106502718A (en) The upgrade method of program and device, controller
CN102597972A (en) Virtual computer system, area management method, and program
CN101515259B (en) Inserted device configuring data protecting method
CN101923500A (en) Backup and update method and device of bootstrap program in embedded equipment
CN110046065A (en) A kind of storage array method for reconstructing, device, equipment and storage medium
CN102855162B (en) A kind of data-updating method, data update system and memorizer

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Method and device for storing and updating data

Effective date of registration: 20161212

Granted publication date: 20150422

Pledgee: China Merchants Bank Limited by Share Ltd Zhangzhou branch

Pledgor: Zhangzhou Cannet Electrical Appliance Co., Ltd.

Registration number: 2016350000143

PLDC Enforcement, change and cancellation of contracts on pledge of patent right or utility model
PC01 Cancellation of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right

Date of cancellation: 20220610

Granted publication date: 20150422

Pledgee: China Merchants Bank Limited by Share Ltd. Zhangzhou branch

Pledgor: ZHANGZHOU CANNET ELECTRICAL APPLIANCE Co.,Ltd.

Registration number: 2016350000143