When you launch a program in background in xterm, with myprog &
, the program will be killed when you close xterm without the command exit. Creating a new session may solve this pb (the process was a child process of xterm, and when you create a new session he is not a child process of xterm. you can close xterm without exit, the program will still be running).
man 2 setsid
gives:
setsid() creates a new session if the calling process is not a process group leader.
The calling process is the leader of the new session, the process group leader of the new
process group, and has no controlling terminal.
The process group ID and session ID of the calling process are set to the PID of
the calling process.
The calling process will be the only process in this new process group and in
this new session.
The example I gave you with xterm is justified by has no controlling terminal
.