Informatika Komputer    
   
Daftar Isi
(Sebelumnya) INI fileInkML (Berikutnya)

init

In Unix-based computer operating systems, init (short for initialization) is a daemon process that is the direct or indirect ancestor of all other processes. It automatically adopts all orphaned processes. Init is the first process started during booting, and is typically assigned PID number 1. It is started by the kernel using a hard-coded filename, and if the kernel is unable to start it, a kernel panic will result. Init continues running until the system is shut down.

The design of init has diverged in Unix systems such as System III and System V, from the functionality provided by the init in Research Unix and its BSD derivatives. The usage on most Linux distributions is compatible with System V, but some distributions, such as Slackware, use a BSD-style and others, such as Gentoo, have their own customized version.

Several replacement init implementations have been written which attempt to address design limitations in the standard versions. These include systemd and Upstart, the latter being used by Ubuntu[1][2] and some other Linux distributions.[3][4]

Contents

SysV-style

System V init examines the /etc/inittab file for an :initdefault: entry, which defines any default runlevel. If there is no default runlevel, then init dumps the user to a system console for manual entry of a runlevel.

Runlevels

The runlevels in System V describe certain states of a machine, characterized by the processes run. There are generally 8 runlevels. Of these eight, 3 are so-called "reserved" runlevels: these are the runlevels 0 to 6 and S or s, which are aliased to the same runlevel.

0. Halt
1. Single user mode
6. Reboot

Aside from runlevels 0, 1, and 6, every Unix and Unix-like system treats runlevels a little differently. The common denominator, the /etc/inittab file, defines what each runlevel does (if they do anything at all) in a given system.

Default runlevels

Operating SystemDefault runlevel
AIX2
Arch Linux3[5]
CentOS3 (console/server) or 5 (graphical/desktop)[6]
Debian2[7]
Gentoo Linux3[8]
HP-UX3
Mac OS X3
Mandriva Linux3 (console/server) or 5 (graphical/desktop)
Red Hat Enterprise Linux / Fedora3 (console/server) or 5 (graphical/desktop)[9]
Slackware Linux3
Solaris3[10]
SUSE Linux Enterprise/openSUSE Linux3 (console/server) or 5 (graphical/desktop)[11]
Ubuntu (Server and Desktop)2[7]

On the Linux distributions defaulting to runlevel 5 in the table above, runlevel 5 invokes a multiuser graphical environment running the X Window System, usually with a display manager. However, the Solaris operating system typically reserves runlevel 5 to shut down and automatically power off the machine.

On most systems users can check the current runlevel with either of the following commands:

$ runlevel
$ who -r

The root typically changes the current runlevel by running the telinit or init commands. The /etc/inittab file sets the default runlevel with the :initdefault: entry.

BSD-style

BSD init runs the initialization shell script located in /etc/rc, then launches getty on text-based terminals or a windowing system such as X on graphical terminals under the control of /etc/ttys. There are no runlevels; the /etc/rc file determines what programs are run by init. The advantage of this system is that it is simple and easy to edit manually. However, new software added to the system may require changes to existing files that risk producing an unbootable system. To mitigate against this, BSD variants have long supported a site-specific /etc/rc.local file that is run in a sub-shell near the end of the boot sequence.

A fully modular system was introduced with NetBSD 1.5 and ported to FreeBSD 5.0 and successors. This system executes scripts in the /etc/rc.d directory. Unlike System V's script ordering, which is derived from the filename of each script, this system uses explicit dependency tags placed within each script.[12] The order in which scripts are executed is determined by the rcorder script based on the requirements stated in these tags.

Replacements for init

Traditionally, one of the major drawbacks of init is that it starts tasks serially, waiting for each to finish loading before moving on to the next. When startup processes end up I/O blocked, this can result in long delays during boot.

Various efforts have been made to replace the traditional init daemons to address this and other design problems, including:

  • BootScripts in GoboLinux
  • DEMONS, a modification of the init start process by KahelOS, where daemons are started only when the DE (desktop environment) started.
  • eINIT, a full replacement of init designed to start processes asynchronously, but with the potential of doing it without shell-scripts
  • Initng, a full replacement of init designed to start processes asynchronously
  • Initscripts, System initialization/bootup scripts for Arch Linux
  • launchd, a replacement for init introduced in Mac OS X v10.4 (it launches SystemStarter to run old-style 'rc.local' and SystemStarter processes)
  • Mudur, an init replacement written in Python and designed to start process asynchronously in use by the Pardus Linux distribution.[13]
  • runit, a cross-platform full replacement for init with parallel starting of services
  • s6, another cross-platform full replacement for init, similar to runit.
  • Service Management Facility, a complete full replacement/redesign of init from the ground up in Solaris starting with Solaris 10
  • systemd, a full replacement for init with parallel starting of services, reduced shell overhead and other features, used by many distributions.
  • SystemStarter, a process spawner started by the BSD-style init in Mac OS X prior to Mac OS X v10.4
  • Upstart, a full replacement of init designed to start processes asynchronously initiated by Ubuntu.

References

  1. ^ "Know Thy Ubuntu". Help.ubuntu.com. 2009-08-07. Retrieved 2011-06-13. 
  2. ^ "since we have no /etc/inittab". Linuxquestions.org. 30 November 2006. Retrieved 2011-06-13. 
  3. ^ "Upstart Plans to Ease Linux Management — Streamlining the init Processes". Reports. LinuxPlanet. 2007-03-08. Retrieved 2011-06-13. 
  4. ^ Remnant, Scott James (2006-08-26). "Upstart in Universe". Netsplit.com. Retrieved 2011-06-13. 
  5. ^ "Runlevels". ArchWiki. Retrieved 22 September 2012. 
  6. ^ "SysV Init Runlevels". Retrieved 22 September 2012. 
  7. ^ a b "Debian and Ubuntu Linux Run Levels". Debianadmin.com. 2009-04-02. Retrieved 2011-06-13. 
  8. ^ "Initscripts". Gentoo Linux Documentation. Gentoo.org. 2011-03-02. Retrieved 2011-06-13. 
  9. ^ "SysV Init Runlevels". Retrieved 22 September 2012. 
  10. ^ "Oracle Documentation". Docs.sun.com. 2010-09-07. Retrieved 2011-06-13. 
  11. ^ [1][dead link]
  12. ^ Andrew Smallshaw (7 December 2009). "Unix and Linux startup scripts, Part 2". 
  13. ^ Gürer Özen, Görkem Çetin. "Speeding Up Linux: One Step Further With Pardus Pardus". Pardus.org.tr. Retrieved 2011-06-13. 

External links

(Sebelumnya) INI fileInkML (Berikutnya)