320
The algorithm also tries to spread the lanes evenly across interleaved DIMMs. As long as
there are fewer active threads than lanes, no thread will ever share a lane. When a thread
attempts to start a transaction, it will try to acquire its primary lane spinlock, and if it is
unsuccessful, it will try to acquire the next lane in the array.
The final lane scheduling algorithm decision took a considerable amount of research
into various lane scheduling approaches. Compared to the naive implementation,
the current implementation has vastly improved performance, especially in heavily
multithreaded workloads.
Ensuring Power-Fail Atomicity: Redo and Undo
Logging
The two fundamental concepts libpmemobj uses to ensure power-fail safety are redo
and undo logging. Redo logs are used to ensure atomicity of memory allocations, while
undo logs are used to implement transactional snapshots. Before we discuss the many
different possible implementation approaches, this section describes the basic ideas.
Transaction Redo Logging
Redo logging is a method by which a group of memory modifications that need to be
done atomically are stored in a log and deferred until all modifications in the group are
persistently stored. Once completed, the log is marked as complete, and the memory
modifications are processed (applied); the log can then be discarded. If the processing is
interrupted before it finishes, the logging is repeated until successful. Figure 16-4 shows
the four phases of transaction redo logging.
Figure 16-4. The phases of a transaction redo log
Chapter 16 pMDK Internals: IMportant algorIthMs anD Data struCtures
Précédent

- 344/457

Suivant