# Nix Services, Processes, & init System
[init - Wikipedia](https://en.wikipedia.org/wiki/Init)
[Daemon (computing) - Wikipedia](https://en.wikipedia.org/wiki/Daemon_(computing))
- Every process has a family history/is started by some other process (parent/child), except PID=1(systemd or init)
- parent PID = PPID
## Init Process
> (short for _initialization_) is the first [process](https://en.wikipedia.org/wiki/Process_(computer_science) "Process (computer science)") started during [booting](https://en.wikipedia.org/wiki/Booting "Booting") of the operating system. Init is a [daemon](https://en.wikipedia.org/wiki/Daemon_(computing) "Daemon (computing)") process that continues running until the system is shut down. It is the direct or indirect [ancestor](https://en.wikipedia.org/wiki/Parent_process "Parent process") of all other processes and automatically adopts all [orphaned processes](https://en.wikipedia.org/wiki/Orphan_process "Orphan process"). Init is started by the [kernel](https://en.wikipedia.org/wiki/Kernel_(operating_system) "Kernel (operating system)") during the [booting](https://en.wikipedia.org/wiki/Booting "Booting") process; a [kernel panic](https://en.wikipedia.org/wiki/Kernel_panic "Kernel panic") will occur if the kernel is unable to start it, or it should die for any reason. Init is typically assigned [process identifier](https://en.wikipedia.org/wiki/Process_identifier "Process identifier") 1.
## Daemons
[Daemon (computing) - Wikipedia](https://en.wikipedia.org/wiki/Daemon_(computing))
- Unix Convention: daemons end in d like systemd
## [[Systemd]]
## [[init (SysV)]]
## Systemd vs init(SysV)
- init(SysV)
- older
- Can only start processes serially, contra systemd
- systemd
- replaces init but there's still some controversy with it - big and complicated and does a lot of things
- Can start processes in parallel
- pid=1
- Raspberry Pi uses systemd
## [[Launchd]]
## [[Cron]]
## Commands
- Restart service
- Traditional method
- service myservice restart
- systemd method
- systemctl restart myservice.service
- [[top (command)]]
- [[htop (command)]]
- [[ps (command)]]
- [[fg (command)]]
- [[bg (command)]]
- [[pgrep (command)]]
- [[kill (command)]]
- [[pkill (command)]]
- [[caffeinate (command)]]
- [[Timeout (command)]]