I’ve spent some time over the last few weeks reading about the various *nix init systems: venerable SysV, interim replacement Upstart, controversial monolith systemd, Apple’s proprietary launchd, and niche variants like runit and Epoch. Lots of history, lots of flame wars.
One key takeaway: socket activation is a breathtakingly elegant way to parallelize system startup. In every modern operating system, boot consists of starting hundreds of processes and waiting for them to initialize. Most depend on each other, and many init systems encode these dependencies by hand, waiting for each process to initialize completely before starting the next. Not surprisingly, this is heavyweight, slow, and a maintenance burden.
The key insight was that processes generally interact with each other over sockets, usually AF_UNIX (ie files), occasionally AF_INET and others. If a process isn’t yet listening on a socket, connecting to it will fail, so a given process can’t start until the processes it depends on are ready and listening.
Continue reading →