Job control (Unix)

Job control (Unix)

On operating systems that support executing multiple processes in parallel or in series (batch processing), job control refers to the orchestration of multiple batch jobs.

Unix shell

When using Unix or related operating systems via a terminal, a user will initially only have a single process running, their login shell. Most tasks (directory listing, editing files, etc.) can easily be accomplished by letting the program take control of the terminal and returning control to the shell when the program exits; however, sometimes the user will wish to carry out a task in the background while using the terminal for another purpose. Job control is a facility developed to make this possible, by allowing the user to start programs in the background, send programs into the background, bring background programs into the foreground, and start and stop running programs. Processes under the influence of a job control facility are referred to as jobs.

History

Job control was first implemented in the C shell, making use of features of the 4.1BSD kernel. The facility was then incorporated into the Bourne shell, and exists in most modern Unix shells.

Implementation

* Typically, the shell keeps a list of jobs in a job table. A job consists of all the members of a pipeline; thus all the processes constituting the job will be in the same process group.
* A program can be started as a background task by appending & [This section uses Bash syntax; other shells offer similar functionality under other names.] to the command line; its output is directed to the terminal (potentially interleaved with other programs' output) but it cannot read from the terminal input.
* A task running in the foreground can be stopped by typing the suspend character (Ctrl+Z); this sends SIGTSTP to the process group and returns control to the shell.
* A stopped job can be resumed as a background job with the bg builtin or as the foreground job with fg; in either case the shell redirects I/O appropriately and sends SIGCONT to the process.
* jobs will list the background jobs existing in the job table, along with their job number and job state (stopped or running).
* The kill builtin (not /bin/kill) can signal jobs by job ID as well as by process ID: jobs specified by a job ID should be killed by prefixing "%" [Code applicable for bash, and bash-compatible shells] . Kill can send any signal to a job, however if the intent is to rid the system of the processes the signals SIGKILL and SIGTERM (the default), are probably the most applicable.
* disown can be used to remove jobs from the job table, converting them from jobs into daemons so that they continue executing when the user logs out.

Job ID

A job ID is a token used to identify jobs to shell builtins. Job IDs begin with the % character; %n identifies job "n", while %% identifies the current job. Other job IDs are specified by POSIX. [IEEE Std 1003.1-2001, [http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_203 Section 3.203, Job Control Job ID] ]

References

ee also

* Job control

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

External links

* [http://cnswww.cns.cwru.edu/~chet/bash/bashref.html#SEC87 Job control in Bash]


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Job control — in computing refers to the control of multiple tasks or Jobs on a computer system, ensuring that they each have access to adequate resources to perform correctly, that competition for limited resources does not cause a deadlock where two or more… …   Wikipedia

  • Job Control Language — (Language de Contrôle des Tâches), couramment appelé JCL désigne certains langages de scripts, en particulier sur les systèmes d exploitation mainframe d IBM, dont le rôle est d exécuter un batch. Il existe deux langages JCL d IBM, l un utilisé… …   Wikipédia en Français

  • Unix — (officially trademarked as UNIX, sometimes also written as Unix with small caps) is a computer operating system originally developed in 1969 by a group of AT T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Douglas McIlroy, and… …   Wikipedia

  • Unix System Services — (USS) ist eine Komponente des z/OS. USS ist eine vollwertige, zertifizierte Unix Implementierung (XPG4 UNIX 95). Es handelt sich um das erste Unix 95, welches nicht aus dem AT T / SCO Sourcecode abgeleitet wurde. Durch die Integration in z/OS… …   Deutsch Wikipedia

  • Unix-Shell — Die Unix Shell oder kurz Shell (en. Hülle, Schale) bezeichnet die traditionelle Benutzerschnittstelle unter Unix oder unixoiden Computer Betriebssystemen. Der Benutzer kann in einer Eingabezeile Kommandos eintippen, die der Computer dann sogleich …   Deutsch Wikipedia

  • Unix shell —    In Unix, a program that acts as a user interface, interpreting commands typed at the keyboard and passing them on to the operating system.    The shell sets up standard input, standard output, and standard error, lets you customize your Unix… …   Dictionary of networking

  • Job (EDV) — In der Datenverarbeitung bezeichnet Job einen einzelnen, geschlossen vom Betriebssystem im Hintergrund auszuführenden Auftrag. Ein Job entsprach früher einer Verarbeitung, die durch einen einzelnen Lochkartenstapel gesteuert wurde.… …   Deutsch Wikipedia

  • Job scheduler — This article is about a class of software. For the mathematical problem in Computer Science, see Job Shop Scheduling. For other uses, see Scheduling (disambiguation). A job scheduler is a software application that is in charge of unattended… …   Wikipedia

  • Unix philosophy — The Unix philosophy is a set of cultural norms and philosophical approaches to developing software based on the experience of leading developers of the Unix operating system.McIlroy: A Quarter Century of UnixDoug McIlroy, the inventor of Unix… …   Wikipedia

  • Bg (Unix) — bg is a Unix command to run a job(process) asynchronously in the background. bg identifies jobs using the job id. bg will also resume a suspended job. [http://pwet.fr/man/linux/commandes/posix/bg bg man page] ] bg is a required to be included in… …   Wikipedia

Share the article and excerpts

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