Two examples which are designed to illustrate the use of the hot restart API are provided with the Sun Embedded WorkShop(TM) product. These examples are as follows:
helloRestart
: a very simple illustration
of persistent memory programming using a 'hello world' actor. This example
is discussed in Chapter 3, Programming With Persistent
Memory. helloRestart
can be compiled as either a supervisor or a user actor.
restartSpawn
: an example
which illustrates how a hot-restartable actor can be spawned from an actor.
This example is introduced in Chapter 4, Programming With Restartable
Actors.
Both of the actors in the restartSpawn
example are
supervisor actors.
To compile the examples, make sure that the examples directory is included in your system image build configuration. Binaries for all of the examples are provided in build_dir/build-EXAMPLES once the examples directory has been built.
To run the examples, first copy them to a directory which is mounted on the target, or use the make root command to build a root directory to mount.
Use the C_INIT command arun with the -g option to run a restartable actor from the command line. For example, to run the 'hello world' restart example:
$ rsh target arun -g 0 example_directory/HR_hello_u |
where target is the target name, and example_directory is the directory mounted on the target machine where the restartable hello world actor binary is stored. The -g 0 option runs the hello world restartable actor as a member of a restart group with ID 0.