Daemon Management

Panther relies on the services of a large number of system daemons for its operation, and every network service you enable adds to the count of potential background processes. While it would be easiest to simply have all the daemons launch at startup, it’s much more efficient to do this for just the handful that require it and launch the other daemons only as needed. To coordinate this complex task, Panther uses three mechanisms: bootstrap daemons , StartupItems, and xinetd.

Bootstrap Daemons

Introduced with Panther, the register_mach_bootstrap_servers tool, provides a way to have system daemons launch on demand (that is, not until they receive their first service request). In fact, this method will eventually take the place of the StartupItems (see the following section) as Mac OS X evolves in future releases.

This tool assembles a list of daemons by reading each file in /etc/mach_init.d/ (for system daemons to be run as root) and /etc/mach_init_per_user.d/ (for user daemons to be run under normal user accounts). It then registers each daemon in the list and the service it provides with the mach_init daemon, itself launched by the Mach kernel early in the startup.

Once a daemon is registered, mach_init waits for requests from other processes for the services the daemon provides, launching (or relaunching) the daemon only when it detects a request. Such daemons, available to the system so early in the startup process, are known as bootstrap daemons. For now, only ...

Get Mac OS X Panther in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.