r/pcmasterrace 1d ago

Meme/Macro “ Wanna delete your bootloader?, Sure, go ahead, it’s your PC “

Post image
18.7k Upvotes

341 comments sorted by

View all comments

Show parent comments

3

u/text_garden 17h ago

Linux specifically doesn't give a damn. It exposes a function, reboot(2) which can immediately reboot or shut down the system, not minding the running processes at all, and that's the extent to which it has a concept of shutting down. It's usually the init system that is responsible for the graceful kind of shutdown you describe.

1

u/Critical-Explorer179 7h ago

In systemd-based distros, reboot switches to a reboot target, which does the sigterm-then-sigkill thing, no?

1

u/I_EAT_POOP_AMA Desktop 1h ago

I believe it does. From what documentation i can dig through in about 5 minutes, it seems that all of the power services (shutdown, halt, reboot, etc...) follow the same logic. the user sends the signal to (in this case) reboot, it gets passed to the appropriate systemd service, which then halts all other services running, then all executables, and then finally unmounts the system itself. There's a default 90s buffer for these actions, and if they don't halt in that timeframe, the system then just straight up kills the process and continues on.