Two examples have been designed to illustrate the use of the hot restart API and are provided with the Sun Embedded WorkShop software. The examples are as follows:
helloRestart
: a basic illustration
of persistent memory programming using the 'hello world' process. This example
is discussed in"The "hello world" Restartable process". helloRestart
can be compiled as either a supervisor or a user process.
restartSpawn
: this example illustrates
how a hot-restartable process can be spawned from a process. This example
is further discussed in "The restartSpawn Example". Both the processes
in the restartSpawn
example are supervisor processes.
To compile the examples, ensure that the examples directory is included in your system image build configuration. Binaries for all examples are provided in build_dir/build-EXAMPLES after the building of the examples directory.
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 process 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 process binary is stored. The -g 0 option runs the hello world restartable process as a member of a restart group with ID 0.