Skip to content

Instantly share code, notes, and snippets.

@arsv
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arsv/9313807 to your computer and use it in GitHub Desktop.
Save arsv/9313807 to your computer and use it in GitHub Desktop.
Init implementations comparison chart
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
V I D ru mi ni sl sd
---- Parent ----------------------------------------------------------
Supervision S e S E S S 1 S
Description L LF FH D D D - LF
Control P FP D FC B B - S
Named children n + + + + + - +
System states R R T R - - - R
Dependencies - - D D S S - -
s-type children + p + p + + - +
w-type children + + ? + + + x +
Proc per child 1 1 1 2 1 1 1 1
List running entries - - C F F F - C
utmp/wtmp + + + + - - - -
Power modes W W B - - - - R
Sleep modes c c R c - - - R
---- Child -----------------------------------------------------------
Set uid/gid - - B - - B - -
Set ulimits - - B - - - - -
Set cgroups - - B - - - - -
Redir to log file - - -? C C C - -
Redir to syslog - - - - - - - -
----------------------------------------------------------------------
Init implementations (columns)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
V = sysvinit
I = RH-style initscripts / sysvinit
D = systemd
R = runit
M = minit
sl = suckless init
sd = sdinit
ni = ninit
Parent level
~~~~~~~~~~~~
Things associated with the top-level init process itself.
Child supervision
S = supervising init, keep a record for each running child
E = keeps child pid externally (.pid file or similar)
e = external pid for services, internal record for anything else
- = spawn-and-forget
1 = spawns one child, waits
Child description
L = one line per process (inittab or similar)
F = one file per process
D = one directory per process
H = hard-coded in companion utilities (systemd only)
- = hard-coded only
Control and communication
P = pipe
B = double pipe (bi-directional communication via pipes)
S = socket
D = dbus
M = shmem
h = external scripts
F = files (which control utility creates/removes or modifies)
C = controllable per-child supervisors (runit)
- = non controllable at runtime
All inits react to signals, so signals are not mentioned
Named children
Is it possible to kill/restart a child by name, or some equivalent of a name?
+ = yes
- = no
n = children names are not used for control
System states, or runlevels support
R = runlevels, sysv-style
T = targets, systemd-style
- = single system state
Inter-process dependencies
- = no dependencies
S = delay startup until all dependencies are up
D = delay startup and/or kill of dependencies go down
Supported children types
w-type means wait
s-type means service / respawn
+ = supported
- = not supported
x = single fixed child
p = non-controlled services (initscripts with .pid files)
Handling boot:
s = dedicated script
r = runlevel or target
Processes per child
How many processes does init spawn to run a single child?
(this is the minimum process count of course)
(does not include exec-without-fork wrappers)
1 = the child itself
2 = additional per-child monitor process (runit)
utmp/wtmp support
Does this init update utmp and/or wtmp entries?
Note most of the work with utmp and wtmp is done in login,
init only logs current runlevel there.
- = no
+ = yes for all children
List running entries
C = by querying init via its control channel
F = by reading some files
- = not supported
Power modes
How does this init handle main/on-battery switching?
B = target (runlevel), built-in detection
R = runlevel, external detection
W = script (wait-type entry) only, external detection
Sleep modes
c = so dedicated support, can be implemented via normal configuration
R = system state (runlevel / target)
Child level
~~~~~~~~~~~
When spawning a child, what can this init do in the child process?
Note that pretty much any init can spawn intermediate process (su, nice, cgexec, maybe just a shell script)
to set child properties. Because of this, the only thing that matters is whether it will be done inside init
or not. Options here:
B = built-in
C = companion utility
- = none, relies on external utilities
x = not applicable / impossible even with external tools
Set uid/gid
Set ulimits
Set cgroups
Exec with shell
X = any command is executed via sh -c
E = explicit only, sh -c "command"
H = shorthand, something shorter that sh -c to invoke shell
A = auto, depending on command contents (a-la sysvinit)
- = not available / not applicable
Redirect output to a log file
a shorthand for "process > logfile" or some equivalent
Redirect output to syslog
typically requires a companion process to accomplish
C = companion utility, one additional process per child
A = companion utility, one process for all children (demux)
B = init process acts as demux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment