A process has a process id and a group id.
If a process is a group leader then all its children and their children get the same group id.
In this case the group id is the process id of the group leader.
So potentially, all processes created by the shell to run programs are in the same group with the shell as the group leader.
The shell creates a process, and records it as a 'job'. But that process might create its own children.
We want all the processes in a job to be in the same group with the group leader being the process created by the shell.
We do NOT want the shell to be in the same group.
The following function puts the calling process into a new process group with the calling process as the group leader:
int setpgrp()
It returns 0 for success and -1 on error.