US 11,989,090 B2
Method and system for ensuring failure atomicity in non-volatile memory
Wei Tong, Hubei (CN); Dan Feng, Hubei (CN); Jingning Liu, Hubei (CN); Xueliang Wei, Hubei (CN); and Weilin Zhu, Hubei (CN)
Assigned to HUAZHONG UNIVERSITY OF SCIENCE AND TECHNOLOGY, Hubei (CN)
Appl. No. 17/763,926
Filed by HUAZHONG UNIVERSITY OF SCIENCE AND TECHNOLOGY, Hubei (CN)
PCT Filed Jun. 16, 2020, PCT No. PCT/CN2020/096295
§ 371(c)(1), (2) Date Mar. 25, 2022,
PCT Pub. No. WO2021/227188, PCT Pub. Date Nov. 18, 2021.
Claims priority of application No. 202010407572.7 (CN), filed on May 14, 2020.
Prior Publication US 2022/0334918 A1, Oct. 20, 2022
Int. Cl. G06F 16/00 (2019.01); G06F 9/46 (2006.01); G06F 11/07 (2006.01); G06F 11/10 (2006.01); G06F 11/14 (2006.01)
CPC G06F 11/1064 (2013.01) [G06F 9/466 (2013.01); G06F 11/0772 (2013.01); G06F 11/0778 (2013.01); G06F 11/1471 (2013.01)] 8 Claims
OG exemplary drawing
 
1. A method for ensuring failure atomicity in a non-volatile memory, the method comprising:
executing transactions encapsulated by one or more operations that need to ensure the failure atomicity in accordance with the following steps:
(S1) executing operations in a current transaction in sequence, for each write operation in the current transaction, if the oldest value of its corresponding data has not been saved into a log of the non-volatile memory, then creating an UndoRedo log entry for it, and if the oldest value of its corresponding data has been saved into the log of the non-volatile memory, then creating a Redo log entry for it;
wherein while log entries are created, the log entries are managed by using corresponding log management strategies according to types of log entries;
(S2) after all operations in the current transaction are executed, committing the current transaction; and
(S3) completing the execution of the current transaction;
wherein information recorded in the UndoRedo log entries comprises: transaction number, write operation address, and oldest value and new value of corresponding data;
information recorded in the Redo log entries comprises: transaction number, write operation address, and new value of corresponding data; and the oldest value of data is a value of the data when the current transaction just starts to be executed, and the new value of data is a value of the data after the execution of a corresponding write operation is completed;
wherein an active log cache and a lazy log cache are added in a processor of the non-volatile memory; and
the log management strategies comprise: active write-back strategies and lazy write-back strategies; and in the step (S1), an active write-back strategy is used to manage the UndoRedo log entries, and a lazy write-back strategy is used to manage the Redo log entries;
wherein using the active write-back strategy to manage the UndoRedo log entries comprises: after an UndoRedo log entry is created, it being first cached in the active log cache, and then written back to the non-volatile memory after a preset time interval; and the time interval is less than the time required for the data to be written from a first-level cache of the processor back to the non-volatile memory; and
using the lazy write-back strategy to manage the Redo log entries comprises: after a Redo log entry is created, it being first cached in the first-level cache of the processor, and when a cache line where the Redo log entry is located is evicted or updated by other transactions, the Redo log entry being cached in the lazy log cache; and when the lazy log cache is full, the Redo log entry in the lazy log cache being written back to the non-volatile memory; and log entries with the same transaction number and write operation address will be merged by the lazy write-back strategy during managing the Redo log entries.