Patent ID: 8266391

Claim:
A method for writing data of an atomic transaction to a memory device, the method comprising: (a) determining that the memory device is in a secure session and in response: (a1) determining whether a designated area in a first memory of the memory device for the secure session is full, wherein the designated area of the first memory is a reserved memory area used only for writing data of an atomic transaction; (a2) when the designated area is not full, writing the data of the atomic transaction to the first memory in the memory device, but otherwise returning an error status and refraining from writing the data of the atomic transaction to the first memory; (b) determining whether all of the data of the atomic transaction was written to the first memory; (c) only when it is determined that all of the data of the atomic transaction was written to the first memory: (c1) reading the data of the atomic transaction from the first memory; and (c2) writing the data of the atomic transaction read from the first memory to a second memory in the memory device; (c3) after a power loss, determining whether all of the data of the atomic transaction read from the first memory was written to the second memory; and (c4) when all of the data of the atomic transaction read from the first memory was not written to the second memory, repeating (c1) and (c2); and (d) when all of the data of the atomic transaction was not written to the first memory, discarding any data written to the first memory; wherein the first and second memories are non-volatile memories.