init (1)
Process (Root Process)syslogd (2781)
: Manages system logs.cupsd (3043)
: Handles printing services.smbd (2978)
: Provides Samba service for file sharing.sshd (20484)
: Manages SSH connections, spawning sshd (678)
for active sessions. SSH connections create child sshd
processes, leading to shell sessions.bash (1835)
Processsshd (678)
, indicating a user login via SSH.bash
:
vi (1892)
: User opened the vi
editor.firefox (1903)
: User launched the Firefox browser.pstree (2001)
: User inspected the process tree.Voluntary Termination
exit(0);
Forced Termination
By another process using a signal:
kill(pid, SIGKILL); // Forcefully terminate process
By the OS due to illegal operations (e.g., segmentation fault).
By itself using abort()
(forces the calling process, parent or child, to terminate abnormally):
abort(); // Immediately terminates the process that calls it
Zombie Process Handling
A zombie process is a terminated child that hasn’t been reaped by wait()
.
To clean up zombies, the parent should call:
wait(NULL); // Collects child's exit status