what is Unix session? Explain with an example ?

Unix session : Unix process ID have a session ID and are part of a process group which can be changed / query with functions such as set -id()/getpgrp().

Section is a collection of process groups which are either attached to a single terminal device known as the controlling terminal or not at attached to any terminal.
Session are used for job control : one of the process group is the session is the foreground process and can be sent signals by terminal control characters. Section with the controlling terminal as a corresponding to login on the terminal.

Example : if we run some app from the shell the shell creates a new process group for it and make that the foreground process group of the section.
If we press ^2some apps process group is signaled to stop it and the shell process group is to switch to be foreground process group again then e.g. bg%1 food starts some apps process group again but keep it running in the background.



You may like these posts