What is a PID in Linux?
A unique non-repeating integer assigned to every running program.
What is the purpose of PID?
Used to allocate CPU time, memory pages, file-descriptor tables, and scheduling priorities.
What is PPID?
Parent Process ID that identifies the process which spawned the current process.
Why is PPID important?
Enables tracing of process lineage and understanding of process trees.
How can you view PIDs?
Using commands like ps aux, ps -eo pid,stat,cmd, top, htop.
How to access live kernel statistics for a PID?
cat /proc/<PID>/</PID>
How to send a signal to a process?
kill -9 <PID> or use SIGKILL for forceful termination.</PID>
How to change process priority?
renice -n 10 -p <PID></PID>
How to trace system calls of a process?
strace -p <PID></PID>
What is PID 1?
systemd, the first process started and never exited.
What happens if PID 1 is terminated?
The system crashes.
Do PIDs recycle?
Yes, after a process ends.
What should you confirm before sending commands to a PID?
Confirm the current PID.
How to view process hierarchy?
ps -e –forest -o pid,ppid,cmd or pstree -p.
What happens if you stop a parent process?
It affects all its child processes.
How to kill a parent process and its children?
kill <PPID>, pkill -P <PPID> <signal>, or systemctl kill --kill-who=all <service>.service.</service></signal></PPID></PPID>
What are orphaned processes?
Processes whose parent has terminated; they are adopted by PID 1.
What are zombie processes?
Defunct processes not reaped by parent.
What does reaping mean?
Parent performs a wait operation to free child’s resources and remove its entry from the process table.