previous | start | next

Sessions, Process Groups, Processes, Threads

A Linux session contains one or more process groups.

A process group contains one or more processes.

A process contains one or more threads.

A session has a numeric identifier - the session id. This is typically the process id of the shell process. This process is called the session leader. All processes created by the session leader or its descendants are members of the session and will have the same session id.

A process group has an identifier - the process group id. All descendents of a process are in normally the same process group. However, a process can create a new process group for itself. The new process group would still be in the same session. This "first" process in a process group is called the process group leader and the process group id is just the pid of the group leader.

A process has at least one thread - the initial thread. The intial thread begins executing the main function and can create additional threads. All these threads have the same process id, but each thread gets its own thread id.



previous | start | next