In this article we will discuss, how to differentiate and identify each process in linux.

Process ID

Each process in Linux has a unique id and has a parent.  We can get the process id of a running process and its parent’s process id using following functions,

File to be included for them is <unistd.h>

Let’s see an example,


Process ID : 3825
Parent Process ID : 3560

To check the process id and parent process id of all running process, use following command,

Output will contains many rows with following columns i.e

varun 3223 1880 0 23:10 ? 00:00:02 /usr/lib/chromium-browser/chro
varun 3250 1880 0 23:10 ? 00:00:01 /usr/lib/chromium-browser/chro


Here PID represents process id and PPID represents Parent Process Id

What is an Orphan Process

Every process has a parent process.
If a parent process terminates then all its children process become orphan processes. As soon as a process becomes orphan, the init process becomes their parent.

Process ID of init process is 1.

Python Recommendations:

C++ & C++11 Recommendations:

If you didn't find what you were looking, then do suggest us in the comments below. We will be more than happy to add that.

Subscribe with us to join 1500+ Python & C++ developers, to get more Tips &  Tutorials like this.