What are session leaders, as in
ps -d which selects all processes except session leaders?
In Linux, every process has several IDs associated with it, including:
Sessions and process groups are just ways to treat a number of related processes as a unit. All the members of a process group always belong to the same session, but a session may have multiple process groups.
Normally, a shell will be a session leader, and every pipeline executed by that shell will be a process group. This is to make it easy to kill the children of a shell when it exits. (See exit(3) for the gory details.)
I don't think there is a special term for a member of a session or process group that isn't the leader.
A session leader is a process where session id == process id. This sounds contrived, but the session id is inherited by child processes. Some operations within UNIX/Linux operate on process sessions, for example, negating the process id when sending to the kill system call or command. The most common use for this is when logging out of a shell. The OS will send
Most of the processes called from the window manager/graphical environment have the same session id as one of the startup programs. This allows the OS to perform the same
I thought I knew the answer to this, but I wrote a C program to figure this out.
I compiled it with
I was kind of surprised by what Linux (2.6.39) gave back. I also found the section 7 man page, "credentials".
My advice is to do