Brief information on Unix jobs


Before you begin, some information on running background jobs seems appropriate. The ability to run background jobs is one of the best features of the Unix operating system. This feature allows you to run a program in the background, logout, take a nap, come back later, login to another machine and check the results. In the meantime, someone else could be using the machine for some other purpose.

 The new user on the SGI's usually runs a job at the prompt, and then waits for it to be completed before running something else. Did you notice that when you run a program, you can't type anything else in that window? Well, here's an easy way out of that. Actually there are at least two ways to run background jobs. Here are some examples of both followed by an explanation.

 % xterm

 This command will open an xterm window. Notice that you cannot use the old window until you shut down the new window. Now try this instead

% xterm &

Notice how the use of the '&' symbol allowed you to open another window and also use the first window at the same time. What if you forgot to type the '&' initially? Is it possible to still run the new window as a separate process? The answer is yes! Just hit ctrl-z (hold down the ctrl and z keys at the same time). This suspends the job. You can now put the job in the background by typing 'bg'.
 
 

% xterm
ctrl z
Suspended
% bg
[1]    xterm &
This is very useful when you want to run your fortran program interactively for a while and then run it in the background. To bring a job back to the foreground use the fg command. You can have any number of jobs in the background. Take a look at the section on Compiling, Linking and Executing for more information.

Back to the main menu


James Weighton and R. G. Hindman