Files
oldlinux-files/docs/Install-Guide/install-guide-2.2.2/node134.html
2024-02-19 00:23:35 -05:00

72 lines
4.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
<!Converted with LaTeX2HTML 95.1 (Fri Jan 20 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
<HEAD>
<TITLE>3.11.2 Foreground and background</TITLE>
</HEAD>
<BODY>
<meta name="description" value="3.11.2 Foreground and background">
<meta name="keywords" value="gs">
<meta name="resource-type" value="document">
<meta name="distribution" value="global">
<P>
<BR> <HR><A NAME=tex2html3450 HREF="node135.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3448 HREF="node132.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3442 HREF="node133.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3452 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3453 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html3451 HREF="node135.html">3.11.3 Backgrounding and killing </A>
<B>Up:</B> <A NAME=tex2html3449 HREF="node132.html">3.11 Job Control</A>
<B> Previous:</B> <A NAME=tex2html3443 HREF="node133.html">3.11.1 Jobs and processes</A>
<BR> <HR> <P>
<H2><A NAME=SECTION005112000000000000000>3.11.2 Foreground and background</A></H2>
<P>
<A NAME=3409>&#160;</A>
<A NAME=3410>&#160;</A>
<A NAME=3411>&#160;</A>
<A NAME=3412>&#160;</A>
<A NAME=3413>&#160;</A>
<A NAME=3414>&#160;</A>
Jobs can either be in the <b>foreground</b> or in the <b>background</b>.
There can only be one job in the foreground at any one time. The foreground
job is the job which you interact with---it receives input from the keyboard
and sends output to your screen. (Unless, of course, you have redirected
input or output, as described in Section <A HREF="node119.html#secplumbing">3.8</A>). On the other
hand, jobs in the background do not receive input from the terminal---in
general, they run along quietly without need for interaction.
<P>
Some jobs take a long time to finish, and don't do anything
interesting while they are running. Compiling programs is one such
job, as is compressing a large file. There's no reason why you
should sit around being bored while these jobs complete their tasks;
you can just run them in the background. While the jobs are running
in the background, you are free to run other programs.
<P>
<A NAME=3418>&#160;</A>
Jobs may also be <b>suspended</b>. A suspended job is a job that
is not currently running, but is temporarily stopped. After you
suspend a job, you can tell the job to continue, in the foreground
or the background as needed. Resuming a suspended job will not change
the state of the job in any way---the job will continue to run where
it left off.
<P>
<A NAME=3420>&#160;</A>
<A NAME=3421>&#160;</A>
Note that suspending a job is not equal to <em>interrupting</em>
a job. When you interrupt a running process (by hitting your interrupt
key, which is usually <IMG BORDER=0 ALIGN=BOTTOM ALT="" SRC="img190.gif">)<A NAME=tex2html640 HREF="footnode.html#3568"><IMG ALIGN=BOTTOM ALT="gif" SRC="foot_motif.gif"></A>,
it kills the process, for good.
Once the job is killed, there's no hope of resuming it; you'll have
to re-run the command. Also note that some programs trap the interrupt,
so that hitting <IMG BORDER=0 ALIGN=BOTTOM ALT="" SRC="img192.gif"> won't immediately kill the job. This is to
allow the program to perform any necessary cleanup operations before exiting.
In fact, some programs simply don't allow you to kill
them with an interrupt at all.
<P>
<BR> <HR><A NAME=tex2html3450 HREF="node135.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3448 HREF="node132.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3442 HREF="node133.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3452 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3453 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html3451 HREF="node135.html">3.11.3 Backgrounding and killing </A>
<B>Up:</B> <A NAME=tex2html3449 HREF="node132.html">3.11 Job Control</A>
<B> Previous:</B> <A NAME=tex2html3443 HREF="node133.html">3.11.1 Jobs and processes</A>
<BR> <HR> <P>
<BR> <HR>
<P><ADDRESS>
<I>Matt Welsh <BR>
mdw@sunsite.unc.edu</I>
</ADDRESS>
</BODY>