Parent process id is ppid
We know that every process has a process id. This is usually referred as
pid. In *nix world every process has a parent process. And in ruby the way to get the “process id” of the parent process is through
Let’s see it in action. Time to fire up irb.
Now keep the irb session open and go to anther terminal tab. In this new tab execute
pstree -p 83132
pstree is not available then you can easily install it using
brew install pstree.
As you can see from the output the process id 83132 is at the very bottom of the tree. The parent process id is 82455 which belongs to “bash shell”.
In irb session when we did
Process.ppid then we got the same value 82455.