Job Control

If a long process is started (for example, compiling a large program) this is normally started as a foreground process. The process can however, be moved to the background to enable you to move on to another task while the compilation is being completed. Jobs can be started as background jobs by ending the command with an & character. For example

% cc freda.c &
[1] 30657

The shell responds with the job number and process id of the process. The C shell provides further job control features. The commands fg and bg move a job to the foreground or background, <Ctrl/z> will temporarily suspend a foreground job and return to a shell prompt. There are other job control commands but they are less important.

These three features, being able to move a job to the background, bring it to the foreground and being able to suspend a job, taken together provide a powerful job control system.

% cc freda.c
<Ctrl/z>
% bg
%

Any foreground process, for example an edit, can be interrupted to temporarily do something else.

% emacs freda.c
<Ctrl/z>
% man cc
% fg

The fg command will return control to the emacs editor.

Jobs can be placed in a file as a batch of instructions. Depending on the system and system policy these batch jobs can often be sent to different queues for processing. For example, jobs that require lots of processing time could be sent to run in an overnight queue to help the efficiency of the system.

For more information on job queues on OUCS Unix systems, type help for the online help menu system. Use the arrow keys to select the Getting Started on linux.ox.ac.uk (if on the linux.ox.ac.uk machine) menu option and then scroll down to select Running Batch Jobs.

Help: for more information see csh(1). Once in the manual pages type /Job Control to search forward through the screens. See also qsub(1) for queue submission.