Use the C_INIT command arun with the -g option, or the function call hrfexec() to load a restartable actor from stable storage into persistent memory. Both arun and hrfexec() provide support for specifying the persistent credentials of a restartable actor when the actor is initially loaded.
For a direct actor (run with arun), the actor name is system generated, and the group ID is passed using the -g option. If the group ID is not already in use, a new group is created which contains the direct actor. If the group ID already exists, the direct actor is simply added to the corresponding restart group. If no ID is passed after -g, the actor is started in the restart group with ID 0.
A restart group can contain any number of direct actors.
For an indirect actor (run with hrfexec()), the actor name is specified using a PmmName structure (see the description of this structure in "3.3 Allocating and Retrieving a Persistent Memory Block") . An indirect actor is automatically a member of the same actor group as the actor which spawned it.
Actors created directly using actorCreate(2K) or acreate(2K) are not hot restartable and cannot use the Hot Restart Controller API.
When an actor is run as a restartable actor, the Hot Restart Controller checks whether an actor identified with the specified name is already registered. If this is not the case (as is the case for an initial load), the Hot Restart Controller first solicits the Persistent Memory Manager to allocate the persistent memory blocks which will store the actor's actor image and executing image. If successful, it registers the name of the new actor as a restartable actor, running in the specified group.
The subsequent load and start of the persistent actor is the same as for an actor run using a member of the afexec(2K) function family (see the man page for a description of this process). The difference is that the actor is loaded from its actor image (in persistent memory) and not from stable storage.
A restartable actor's name remains registered in the Hot Restart Controller for the lifetime of its actor group. The lifetime of the group may extend beyond the lifetime of the actor. It is the programmer's responsibility to ensure that no two restartable actors will attempt to register with the same name in the Hot Restart Controller.
Once a restartable actor has been registered and loaded, it runs under the control of the Hot Restart Controller. If the actor fails, the failure will provoke the restart of all the direct members of its restart group. These direct actors are then responsible for restarting any indirect actors registered in the group. To query an actor's restart group, use hrGetActorGroup(2RESTART):
#include < hr/hr.h > hrGetActorGroup(int aid)