As stated in Chapter 1, Introduction, the hot restart feature implements persistent memory as a portion of physical memory (RAM) on the target device. Although the persistent memory bank does not itself use virtual memory or swapping, hot restart is compatible with all three of the main memory models: flat, protected, and virtual.
The size of the persistent memory bank is defined in bytes by a system
tunable parameter, pmm.rambankSize
. The value of
this parameter is static: its value cannot be modified while the system is
running. In addition, because the RAM persistent memory bank does not use
virtual memory or swapping, objects in persistent memory are locked in memory
until they are freed. For these two reasons, it is important to make sure
that pmm.rambankSize
is set to a value realistic
for the amount of data likely to be stored in persistent memory at any one
time.
A portion of space reserved for an object in the persistent memory bank is termed a persistent memory block. A block is a contiguous set of memory pages, which means that the size of a block is always a multiple of the page size. Use vmPageSize(2K) to find out the page size for your platform.
For each running restartable actor, the system stores the following data in persistent memory:
The text and initialized data which were loaded into memory from stable storage. This is known as the actor image. The actor image occupies a single block of persistent memory.
The executed text, initialized data and BSS (data initialized to zero), from which the actor is running. This is known as the actor's executing image. The executing image occupies two blocks of persistent memory: one block for the text and one block for the data. The heap and stack for the executing actor are stored in non-persistent memory.
The persistent memory blocks used to store the actor image and executing image will only be freed when the actor's group terminates cleanly (note that this may be some time after the actor itself has terminated). The actor can also allocate its own blocks of persistent memory to store run-time data while it is executing.
Although it can be difficult to predict the likely required value of pmm.rambankSize
early in the development cycle, the following
rule of thumb, derived from the statements above, may be of use to developers
at the system design stage:
Restartable
actors occupy an absolute minimum of twice their size in persistent memory.
This minimum will accommodate the actor's actor image and executing image
(although it does not allow for rounding up of memory block sizes to the nearest
page). The actor may also allocate additional portions of memory. pmm.rambankSize
should therefore be greater than twice the combined
size of the restartable actors expected to run simultaneously on a system.
Sharing persistent memory blocks between user actors, or between user and supervisor actors is not supported. Persistent memory blocks can only be shared between supervisor actors.
The default value of the pmm.rambankSize
tunable
parameter is 1024*1024 bytes, that is, one megabyte.