sign in
Home | Updates | Pages | Users | Admin | Help
Comparing version 2 and version 1 back

h1. Erlang Study - System Principles

* Origin: "Getting Started With Erlang":http://erlang.org/doc/doc-5.5.3/doc/getting_started/part_frame.html
* See also: 
** [[erlangstudy|Erlang Study - Sequential Programming (part1)]]
** [[erlangstudy2|Erlang Study - Concurrent Programming (part2)]]
** [[erlangstudy3|Erlang Study - Robustness (part3)]]

h2. Restarting and Stopping the System

The module _init_ contains function for restarting, rebooting and stopping the runtime system.

init:restart()
init:reboot()
init:stop()
h2. 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_ . h3. 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_ . h2. 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