Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

init

From Wikipedia, the free encyclopedia
UNIX system component
This article is about the Unix process. For other uses, seeINIT (disambiguation).
This articlerelies excessively onreferences toprimary sources. Please improve this article by addingsecondary or tertiary sources.
Find sources: "Init" – news ·newspapers ·books ·scholar ·JSTOR
(December 2020) (Learn how and when to remove this message)
Version 7 Unix:/etc listing, showinginit andrc
Version 7 Unix: contents of an/etc/rcBourne shell script

InUnix-based computeroperating systems,init (short forinitialization) is the firstprocess started duringbooting of the operating system. Init is adaemon process that continues running until the system is shut down. It is the direct or indirectancestor of all other processes and automatically adopts allorphaned processes. Init is started by thekernel during thebooting process; akernel panic will occur if the kernel is unable to start it, or it should die for any reason. Init is typically assignedprocess identifier 1.

In Unix systems such asSystem III andSystem V, the design of init has diverged from the functionality provided by the init inResearch Unix and itsBSD derivatives. Up until the early 2010s,[1][failed verification] mostLinux distributions employed a traditional init that was somewhat compatible with System V, while some distributions such asSlackware use BSD-style startup scripts, and other distributions such asGentoo have their own customized versions.

Since then, several additional init implementations have been created, attempting to address design limitations in the traditional versions. These includelaunchd, theService Management Facility,systemd,Runit andOpenRC.

Research Unix-style/BSD-style

[edit]

Research Unix init runs the initializationshell script located at/etc/rc,[2] then launchesgetty on terminals under the control of/etc/ttys.[3] 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.

BSD init was, prior to 4.3BSD, the same as Research UNIX's init;[4][5] in4.3BSD, it added support for running awindowing system such asX on graphical terminals under the control of/etc/ttys.[6][7] To remove the requirement to edit/etc/rc, 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 withNetBSD 1.5 and ported toFreeBSD 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.[8] The order in which scripts are executed is determined by thercorder utility based on the requirements stated in these tags.

SysV-style

[edit]
sysv-rc-conf, aTUI utility that selects which SysV-style init scripts will be run in each runlevel

When compared to its predecessors, AT&T'sUNIX System III introduced a new style of system startup configuration,[9] which survived (with modifications) intoUNIX System V and is therefore called the "SysV-style init".

At any moment, a running System V is in one of the predetermined number of states, calledrunlevels. At least one runlevel is the normal operating state of the system; typically, other runlevels represent single-user mode (used for repairing a faulty system), system shutdown, and various other states. Switching from one runlevel to another causes a per-runlevel set of scripts to be run, which typically mount filesystems, start or stopdaemons, start or stop theX Window System, shutdown the machine, etc.

Runlevels

[edit]
Further information:Runlevel

Therunlevels in System V describe certain states of a machine, characterized by the processes and daemons running in each of them. In general, there are seven runlevels, out of which three runlevels are considered "standard", as they are essential to the operation of a system:

  1. Turn off
  2. Single-user mode (also known asS ors)
  3. Reboot

Aside from these standard ones, Unix and Unix-like systems treat runlevels somewhat differently. The common denominator, the/etc/inittab file, defines what each configured runlevel does in a given system.

Default runlevels

[edit]
Operating systemDefault runlevel
AIX5
antiX2
Gentoo Linux3[10]
HP-UX3 (console/server/multiuser) or 4 (graphical)
Linux From Scratch3
Slackware Linux3
Solaris /illumos3[11]
UNIX System V Releases 3.x, 4.x2
UnixWare 7.x3

On Linux distributions defaulting to runlevel 10 in the table on the right, runlevel 10 invokes a multiuser graphical environment running theX Window System, usually with adisplay manager likeGDM orKDM. However, theSolaris andillumos operating systems typically reserve runlevel 10 to shut down and automatically power off the machine.

On most systems, all users can check the current runlevel with either therunlevel orwho -r command.[12] Theroot user typically changes the current runlevel by running thetelinit orinit commands. The/etc/inittab file sets the default runlevel with the:initdefault: entry.

On Unix systems, changing the runlevel is achieved by starting only the missing services (as each level defines only those that are started / stopped).[citation needed] For example, changing a system from runlevel 3 to 4 might only start the local X server. Going back to runlevel 3, it would be stopped again.

Other implementations

[edit]

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 upInput/output (I/O) blocked, this can result in long delays during boot. Speeding up I/O, e.g. by using SSDs, may shorten the delays but it does not address the root cause.

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

  • BootScripts inGoboLinux
  • busybox-init, suited toembedded operating systems, used byAlpine Linux (before being replaced withOpenRC),SliTaz 5 (Rolling),Tiny Core Linux, andVMware ESXi, and used byOpenWrt before it was replaced withprocd
  • Dinit, a service manager and init system.[13]
  • Epoch, a single-threaded Linux init system focused on simplicity and service management[14]
  • ginitd, a software package that consists of an init system and a service management system[15]
  • Initng, a full replacement of init designed to start processes asynchronously
  • launchd, a replacement for init inDarwin/macOS/iOS/tvOS starting withMac OS X v10.4 (it launches SystemStarter to run old-style 'rc.local' and SystemStarter processes)
  • OpenRC, a process spawner that utilizes system-provided init, while providing process isolation, parallelized startup, and service dependency; used byAlpine Linux,Gentoo and its derivatives, and available as an option inDevuan andArtix Linux.
  • runit, a cross-platform full replacement for init with parallel starting of services, used by default inVoid Linux[16]
  • SunService Management Facility (SMF), a complete replacement/redesign of init from the ground up inillumos/Solaris starting with Solaris 10, but launched as the only service by the original System V-style init
  • Shepherd, theGNU service and daemon manager which provides asynchronous, dependency-based initialisation; written inGuile Scheme and meant to be interactively hackable during normal system operation[17]
  • s6, a software suite that includes an init system.[18][19]
  • systemd, a software suite, full replacement for init in Linux that includes an init daemon, with concurrent starting of services, service manager, and other features. Used byDebian (replaces SysV init) andUbuntu, among other popular Linux distributions.
  • SystemStarter, a process spawner started by the BSD-style init inMac OS X prior to Mac OS X v10.4
  • Upstart, a full replacement of init designed to start processes asynchronously. Initiated byUbuntu and used by them until 2014. It was also used in Fedora 9,[20][21] Red Hat Enterprise Linux 6[22] andGoogle'sChromeOS.[23]

As of February 2019[update], systemd has beenadopted by most major Linux distributions.[24]

See also

[edit]

References

[edit]
  1. ^"Lennart Poettering on systemd's Tumultuous Ascendancy".The New Stack. 2018-11-08.Archived from the original on 2018-11-08. Retrieved2024-01-30.
  2. ^init(8) – Version 7 Unix Programmer'sManual
  3. ^ttys(5) – Version 7 Unix Programmer'sManual
  4. ^init(8) – 4.2BSD System Manager'sManual
  5. ^ttys(5) – 4.2BSD File FormatsManual
  6. ^init(8) – 4.3BSD System Manager'sManual
  7. ^ttys(5) – 4.3BSD File FormatsManual
  8. ^Andrew Smallshaw (7 December 2009)."Unix and Linux startup scripts, Part 2".Archived from the original on 18 December 2009. Retrieved6 June 2011.
  9. ^"init(8)".minnie.tuhs.org.Archived from the original on 2021-07-27. Retrieved2015-09-12.
  10. ^"Initscripts".Gentoo Linux Documentation. Gentoo.org. 2014-12-13.Archived from the original on 2020-12-03. Retrieved2020-12-08.
  11. ^"Run Levels".Oracle Solaris Administration: Common Tasks.Oracle.Archived from the original on 2016-04-10. Retrieved2017-11-14.
  12. ^"UNIX man pages : runlevel (8)". Unixhelp.ed.ac.uk. 1997-05-27. Archived fromthe original on 2014-07-14. Retrieved2014-07-12.
  13. ^"GitHub - davmac314/dinit: Service monitoring / "init" system".GitHub.Archived from the original on 2021-12-12. Retrieved2021-12-12.
  14. ^"Epoch Init System Homepage".Archived from the original on 2014-08-02. Retrieved2014-07-31.
  15. ^Wood-Mattheusson, S. M. (2024-12-16)."ginitd: det effektivaste init-systemet".
  16. ^"Void Linux main page".Archived from the original on 2020-08-29. Retrieved2020-08-31.
  17. ^"The Shepherd - GNU Project". Free Software Foundation, Inc.Archived from the original on 2016-02-12. Retrieved2016-01-16.
  18. ^"s6: why another supervision suite".Archived from the original on 2021-09-13. Retrieved2021-09-13.
  19. ^"s6 init system". Archived fromthe original on 2021-09-13.
  20. ^Fedora 14 Accepted Features, 2010-07-13,archived from the original on 2022-03-27, retrieved2010-07-13
  21. ^"Fedora defers systemd to F15". Linux Weekly News. 2010-09-14.Archived from the original on 2010-09-19. Retrieved2010-09-17.
  22. ^"Deployment".Red Hat Enterprise Linux 6: Technical Notes.Red Hat.Archived from the original on 2018-08-29. Retrieved2013-12-31.
  23. ^Software Architecture: Chromium OS design documents,archived from the original on 9 April 2022, retrieved25 January 2014
  24. ^SeeSystemd#Adoption

External links

[edit]
Portable implementations
Operating-system-specific
Process supervision tools
Retrieved from "https://en.wikipedia.org/w/index.php?title=Init&oldid=1279403717"
Category:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp