20
document
1
describes optimized flush as optionally supported by the platform,
depending on the hardware and operating system support. Despite the CPU support,
it is essential for applications to use only optimized flushes when the operating system
indicates that it is safe to use. The operating system may require the control point
provided by calls like msync() when, for example, there are changes to file system
metadata that need to be written as part of the msync() operation.
To better understand instruction ordering, consider a very simple linked list
example. Our pseudocode described in the following has three simple steps to add a new
node into an existing list that already contains two nodes. These steps are depicted in
Figure 2-3.
1. Create the new node (Node 2).
2. Update the node pointer (next pointer) to point to the last node in
the list (Node 2 → Node 1).
3. Update the head pointer to point at the new node (Head → Node 2).
Figure 2-3 (Step 3) shows that the head pointer was updated in the CPU cached version,
but the Node 2 to Node 1 pointer has not yet been updated in persistent memory. This
is because the hardware can choose which cache lines to commit and the order may not
match the source code flow. If the system or application were to crash at this point, the
persistent memory state would be inconsistent, and the data structure would no longer
be usable.
1
SNIA NVM programming model spec: https://www.snia.org/tech_activities/standards/
curr_standards/npm
Chapter 2 persistent MeMory arChiteCture
document
1
describes optimized flush as optionally supported by the platform,
depending on the hardware and operating system support. Despite the CPU support,
it is essential for applications to use only optimized flushes when the operating system
indicates that it is safe to use. The operating system may require the control point
provided by calls like msync() when, for example, there are changes to file system
metadata that need to be written as part of the msync() operation.
To better understand instruction ordering, consider a very simple linked list
example. Our pseudocode described in the following has three simple steps to add a new
node into an existing list that already contains two nodes. These steps are depicted in
Figure 2-3.
1. Create the new node (Node 2).
2. Update the node pointer (next pointer) to point to the last node in
the list (Node 2 → Node 1).
3. Update the head pointer to point at the new node (Head → Node 2).
Figure 2-3 (Step 3) shows that the head pointer was updated in the CPU cached version,
but the Node 2 to Node 1 pointer has not yet been updated in persistent memory. This
is because the hardware can choose which cache lines to commit and the order may not
match the source code flow. If the system or application were to crash at this point, the
persistent memory state would be inconsistent, and the data structure would no longer
be usable.
1
SNIA NVM programming model spec: https://www.snia.org/tech_activities/standards/
curr_standards/npm
Chapter 2 persistent MeMory arChiteCture
