sign in
Home | Updates | Pages | Users | Admin | Help

erlangstudy4

Erlang Study – System Principles

Restarting and Stopping the System

The module init contains function for restarting, rebooting and stopping the runtime system.
init:restart()
init:reboot()
init:stop()

Boot Scripts

The runtime system is started using a boot script. The boot script contains instructions on which code to load and which processes and applications to start. A boot script file has the extension .script . The runtime system uses a binary version of the script. This binary boot script file has the extension .boot . Which boot script to use is specified by the command line flag -boot . The extension .boot should be omitted. Example, using the boot script start_all.boot :
% erl -boot start_all

If no boot script is specified, it defaults to ROOT/bin/start .

Default Boot Scripts

Erlang/OTP comes with two boot scripts:

  • start_clean.boot – Loads the code for and starts the applications Kernel and STDLIB.
  • start_sasl.boot – Loads the code for and starts the applications Kernel, STDLIB and SASL.

A copy of the selected boot script is placed in the ROOT/bin directory, named start.boot .

Code Loading Strategy

The runtime system can be started in either embedded or interactive mode. Which one is decided by the command line flag -mode .
% erl -mode embedded
Default mode is interactive .
  • In embedded mode, all code is loaded during system start-up according to the boot script.
  • In interactive mode , code is dynamically loaded when first referenced . When a call to a function in a module is made, and the module is not loaded, the code server searches the code path and loads the module into the system.
Initially, the code path consists of the current working directory and all object code directories under ROOT/lib, where ROOT is the installation directory of Erlang/OTP. The code path can be extended by using the command line flags -pa Directories_ and -pz Directories . These will add Directories to the head or end of the code path, respectively. Example:
% erl -pa /home/erl/mycode

Powered by JunebugWiki v0.0.31 Page last edited by stoyan on February 01, 2007 05:02 PM (diff)
Version 2 (current) «olderversions