Process group

Process group

In POSIX-conformant operating systems, a process group denotes a collection of one or more processes. Process groups are used to control the distribution of signals. A signal directed to a process group is delivered individually to all of the processes that are members of the group.

Process groups are themselves grouped into sessions. Process groups are not permitted to migrate from one session to another, and a process may only create new process groups belonging to the same session as it itself belongs to. Processes are not permitted to join process groups that are not in the same session as they themselves are.

New process images created by a call to a function of the exec family inherit the process group membership and the session membership of the old process image.

Applications

The distribution of signals to process groups forms the basis of job control employed by shell programs. The tty device driver incorporates a notion of a foreground process group, to which it sends the SIGTSTP, SIGQUIT, and SIGINT signals generated by keyboard interrupts. It also sends the SIGTTIN and SIGTTOU signals to any processes that attempt to read from (and, if appropriate flags are set for the terminal device, write to) the terminal that are "not" in the foreground process group. The shell, in turn, partitions the command pipelines that it creates into process groups, and controls what process group is the foreground process group of its controlling terminal, thus determining what processes (and thus what command pipelines) may perform I/O to and from the terminal at any given time.

When the shell forks a new child process for a command pipeline, both the parent shell process and the child process immediately attempt to make the process into the leader of the process group for the command pipeline. (They both attempt to do the same thing in order to avoid a race condition between the child becoming the process group leader, the child executing the program image of the command being executed, and the parent, or the tty device driver, attempting to send signals to the process group for job control.)

Where a textual user interface is being used on a Unix-like system, sessions are used to implement login sessions. A single process, the session leader, interacts with the controlling terminal in order to ensure that all programs are terminated when a user "hangs up" the terminal connection. (Where a session leader is absent, the processes in the terminal's foreground process group are expected to handle hangups.)

Where a graphical user interface is being used, the session concept is largely lost, and the kernel's notion of sessions largely ignored. Graphical user interfaces, such as where the X display manager is employed, use a different mechanism for implementing login sessions.

Details

The system call setsid() is used to create a new session containing a single (new) process group, with the current process as both the session leader and the process group leader of that single process group. Process groups are identified by a positive integer, the process group ID, which is the process identifier of the process that is (or was) the process group leader. Process groups need not necessarily have leaders, although they always begin with one. Sessions are identified by the process group ID of the session leader. POSIX prohibits the change of the process group ID of a session leader.

The system call setpgid() is used to set the process group ID of a process, thereby either joining the process to an existing process group, or creating a new process group within the session of the process with the process becoming the process group leader of the newly created group. POSIX prohibits the re-use of a process ID where a process group with that identifier still exists (i.e. where the leader of a process group has exited, but other processes in the group still exist). It thereby guarantees that processes may not accidentally become process group leaders.

The system call kill is capable of directing signals either to individual processes or to process groups.

References

* Single UNIX Specification, Issue 6

Further reading

* cite book
url=http://www.informit.com/title/0201702452
title=The Design and Implementation of the FreeBSD Operating System
author=Marshall Kirk McKusick and George V. Neville-Neil
year=2004-08-02
publisher=Addison Wesley
chapterurl=http://www.informit.com/articles/article.aspx?p=366888&seqNum=8
chapter=FreeBSD Process Management: Process Groups and Sessions
id=ISBN 0-201-70245-2


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Process (computing) — In computing, a process is an instance of a computer program that is being executed. It contains the program code and its current activity. Depending on the operating system (OS), a process may be made up of multiple threads of execution that… …   Wikipedia

  • Process (science) — In science, a process is every sequence of changes of a real object/body which is observable using scientific method. Therefore, all sciences analyze and model processes . Processes are always properties of dynamic systems, they are characterized …   Wikipedia

  • Group dynamics — is the study of groups, and also a general term for group processes. Relevant to the fields of psychology, sociology, and communication studies, a group is two or more individuals who are connected to each other by social relationships. [Forsyth …   Wikipedia

  • Group decision making — (also known as collaborative decision making) is a situation faced when individuals are brought together in a group to solve problems. According to the idea of synergy, decisions made collectively tend to be more effective than decisions made by… …   Wikipedia

  • Group psychotherapy — is a form of psychotherapy in which one or more therapists treat a small group of clients together as a group. The term can legitimately refer to any form of psychotherapy when delivered in a group format, including Cognitive behavioural therapy… …   Wikipedia

  • Process Oriented Psychology — (POP) refers to a body of theory and practice that encompasses a broad range of psychotherapeutic, personal growth, and group process applications. It is more commonly called Process Work in the United States, the longer name being used in Europe …   Wikipedia

  • Group 6 element — Group → 6 ↓ Period 4 24 Cr 5 …   Wikipedia

  • Group decision support systems — (GDSS) are a class of electronic meeting system, a collaboration technology designed to support meetings and group work [Dennis, A.R., George, J.F., Jessup, L.M., Nunamaker Jr., J.F., and Vogel, D.R. Information Technology to Support Electronic… …   Wikipedia

  • Group I catalytic intron — Group I catalytic introns are large self splicing ribozymes. They catalyze their own excision from mRNA, tRNA and rRNA precursors in a wide range of organisms. The core secondary structure consists of nine paired regions (P1 P9). These fold to… …   Wikipedia

  • Group technology — or GT is a manufacturing philosophy in which the parts having similarities (Geometry and/or manufacturing process) are grouped together to achieve higher level of integration between the design and manufacturing functions of a… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”