Software Architecture of the Linux OS
SW Architecture
Components
Thread: execution context within a process; at least one; each thread has its own stack and CPU context; all share the same address space States
Attributes / Parameters (associated with process) affect its execution: amount of processor time it gets, the files it can access, ... :
PID, PPID, UID -> identity (copy of parent's UID) , EUID -> permissions, GID, EGID, Niceness, Control terminal (default linkages for STDIN,STDOUT,STDERR for nondaemon processes) - pseudoterminals these days (window from which you started the program)
linux: saved UID (EUID when pgm started), FSUID (=> filesystem permissions - rarely used & not portable)
Process Descriptor
changing scheduling priority: nice
Life Cycle
fork() | creates an identical copy of the original process (clone really) with distinct PID and its own accounting information | ||
=> | 0 (child) => | exec() / execve() / execv() / ... program text replaced data and stack reset new execution starts | |
=> | child's PID wait() / waitpid() / waitid() - will receive child's exit code |
||
_exit() - called when process finishes its execution, notifies the kernel that it is ready to die, provides exit code |
exception: autonomous processes ( init/systemd:PID=1, ...)
Signals (~ 30 different kinds in Linux) : process-level interrupt requests