I tried man(3) setsid, but explains how to use it, I do not understand when setid is useful?
man(3) setsid
A session is a set of processes that use a management terminal. setid is useful when you want to start a new session because you started connecting to a new terminal β for example, when you started a shell inside a terminal emulator β or you need a daemon (which you donβt want to be associated with a control terminal).
The best explanation I know about this aspect is in RWStevens advanced Unix programming.
Why do we need to group processes? , , . : SIGCHLD , , . . , () pid, , . , . . , , pids, . pid, , , , .
Why do we need to group processes?
, , , :
screen: , . , "fg", , .
nohup: , . "" , .
setsid: , , , . .
, pid , :
http://go2linux.garron.me/linux/2010/12/setsid-how-execute-commands-after-you-exit-shell-prompt-866/
This is useful as part of daemon , i.e. disconnecting a process from terminal management. See also daemon(3).
daemon(3)