[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2 The FreeM Daemon

The FreeM daemon manages shared resources for a given FreeM environment. These include the lock table, job table, inter-process communication, and concurrency control for transaction processing. Unlike some M implementations, the FreeM daemon does not function as a write daemon for global storage.

One daemon process is required per FreeM environment, and can be started as follows:

$ freem --daemon [--nofork] [--environment=<environment-name>] [--user=<username>] \
        [--group=<group-name>] [--pidfile=<pid-file>] [--shmsize=<bytes>]

If the daemon is started with ‘--nofork’, it will run in the foreground and its output will be reflected on the terminal. Otherwise, the daemon will run as a child process in the background and immediately return terminal control to the shell. The latter option is recommended in most cases.

The ‘--environment’ option will start the daemon for the specified environment-name. The default environment, if unspecified, is called DEFAULT. If using an environment other than DEFAULT, interpreter processes that wish to also connect to the same environment must also use the ‘--environment’ option when starting, and libfreem clients must also pass the environment name as the first argument to the freem_init() function. Environments allow you to run multiple, isolated instances of FreeM on the same machine, whose globals and routines are distinct and unique.

The ‘--user’ and ‘--group’ options are only valid when the FreeM daemon is started by the superuser, and will cause the daemon to reduce its runtime privileges to those of the specified user and group, and run as that user and/or group. We recommend creating a freem user and group and running the FreeM daemon with --user=freem --group=freem.

The ‘--pidfile’ option specifies the file in which the FreeM daemon will store its own PID. If running as the superuser, the FreeM daemon will store the PID file in /var/run/freem.pid. Otherwise, the PID file will be stored as .freem.pid in the home directory of the user account which owns the FreeM daemon process.

The ‘--shmsize’ option specifies the size in bytes of the FreeM shared memory segment. The default is 4194304 bytes. Increasing the size of the FreeM shared memory segment will, at the cost of increased memory usage, increase the number of concurrent jobs and lock table entries available to the environment; decreasing the size of the segment will have the expected opposite effect. Note that you must also pass ‘--shmsize’ with the same number of bytes to any interpreter process to be used with an environment whose daemon uses a non-default shared memory segment size.

Attempting to start a FreeM interpreter process without a daemon running with the same environment name will result in an error.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on March 27, 2025 using texi2html 5.0.