Introduction about NVRAM
- Non-volatile byte-adressable memory
- Faster and more durable than flash
- Higher capacity, cheaper, and less energy consumption than DRAM
- Comparison between different kinds of storage medium.
Types | Latency |
---|---|
DRAM | 0.01us |
NVRAM | 0.05~0.1us |
Flash | 100us |
Disk | 10000us |
NVRAM and DRAM hybrid memory system
- Combine advantages of NVRAM and DRAM
- Using DRAM as Cache to accelerate memory access
- Using NVRAM to persistent data
Some challenges about using NVM
- NVRAM may have inconsistent states if stores are reordered
- Compiler-Level Reordering, CPU Out-Of-Order Execution
- Volatile CPU caches hold data that is not on NVRAM
- Incomplete updates need to be rolled back (restoring/recovering)
- NVRAM memory has to be dynamically managed (reducing writes)
- Pointers to NVRAM objects need to be valid after a restart (How to recover meta-data of allocation)
NVM_malloc
How to get memory from system
- Using
mmap
to get memory region from application’s virtual memory - Instead of creating one giant file, multiple files are mapped into contiguous, anonymous mmap space
- All translations are done by the MMU without kernel involvement or other software overhead (Bypass feature)
- Using
Two-step allocation
- Reserve Data -> (Prepare Data) -> Activate Memory
- Reserve: Get resource from heap memory region for using, recovered as “Free”
- Activate Memory: Establish links from other objects, recovered as “In use”
Faster execution
- Making DRAM as Cache to storing meta-data (VHeader: A volatile copy)
- Reserve step can be executed in DRAM
- 64 B (cacheline-sized) headers ensure atomic flushes to NVRAM
DRAM. | NVRAM
VHeader. <--|--> Header --> Block
|