Autosave: 2024-06-21 07:15:05

This commit is contained in:
thomasabishop 2024-06-21 07:15:05 +01:00
parent a730d75f72
commit cfca55cc11
3 changed files with 20 additions and 2 deletions

Binary file not shown.

View file

@ -5,7 +5,7 @@ tags: [operating-systems]
created: Friday, June 21, 2024 created: Friday, June 21, 2024
--- ---
# Processes # Processes and threads
Programs are sequences of machine instructions stored in a file. However they do Programs are sequences of machine instructions stored in a file. However they do
not work by themselves. Something needs to load the file's intructions into not work by themselves. Something needs to load the file's intructions into
@ -26,6 +26,24 @@ It is possible that a parent process will terminate before one of its child
processes. In this instance the child becomes an orphan. When this occurs in processes. In this instance the child becomes an orphan. When this occurs in
#Linux, the orphan process is adopted by `init`. #Linux, the orphan process is adopted by `init`.
Below, I have used the `pstree` utility to list all the running processes on my
machine hierarchically.
![diagram of `pstree` output](../img/ps-tree.png)
Children are represented vertically and horizontally.
```
├─terminator─┬─zsh───tmux: client
│ ├─zsh───pstree
│ └─6*[{terminator}]
```
For instance here, `terminator` is a child of `init`, as are `zsh` and `tmux`
but they are also children of `terminator`.`pstree` is a child of `zsh` and
therefore also a child (grandchild) of `terminator`.
## Related notes ## Related notes
![systemd](./systemd.md) ![systemd](./systemd.md)

View file

@ -20,7 +20,7 @@ succession at boot time it is not limited to the this stage of the lifescycle
but runs continuously in reponse to new user events. but runs continuously in reponse to new user events.
On Linux systems `systemd` is used to implement `init` and therefore `systemd` On Linux systems `systemd` is used to implement `init` and therefore `systemd`
will always be listed as the first process (PID1) will always be listed as PID1.
`systemd` is directly accessible from user space and provides a straightforward `systemd` is directly accessible from user space and provides a straightforward
way to enable/disable, start/stop system level processes way to enable/disable, start/stop system level processes