82 lines
4.6 KiB
HTML
82 lines
4.6 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.1 Jobs and processes</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value="3.11.1 Jobs and processes">
|
|
<meta name="keywords" value="gs">
|
|
<meta name="resource-type" value="document">
|
|
<meta name="distribution" value="global">
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html3438 HREF="node134.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3436 HREF="node132.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3430 HREF="node132.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3440 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3441 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html3439 HREF="node134.html">3.11.2 Foreground and background</A>
|
|
<B>Up:</B> <A NAME=tex2html3437 HREF="node132.html">3.11 Job Control</A>
|
|
<B> Previous:</B> <A NAME=tex2html3431 HREF="node132.html">3.11 Job Control</A>
|
|
<BR> <HR> <P>
|
|
<H2><A NAME=SECTION005111000000000000000>3.11.1 Jobs and processes</A></H2>
|
|
<P>
|
|
<A NAME=secprocess> </A><A NAME=secprocesses> </A>
|
|
<P>
|
|
<A NAME=3378> </A>
|
|
<b>Job control</b> is a feature provided by many shells (Bash and Tcsh
|
|
included) which allows you to control multiple running commands, or
|
|
<b>jobs</b>, at once. Before we can delve much further, we need to talk
|
|
about <b>processes</b>.
|
|
<P>
|
|
<A NAME=3382> </A>
|
|
<A NAME=3565> </A>
|
|
<A NAME=3566> </A>
|
|
Every time you run a program, you start what is known as a
|
|
<em>process</em>---which is just a fancy name for a running program.
|
|
The command <tt>ps</tt> displays a list
|
|
of currently running processes. Here's an example:
|
|
<P><TT> /home/larry# <em>ps</em>
|
|
<PRE> PID TT STAT TIME COMMAND
|
|
24 3 S 0:03 (bash)
|
|
161 3 R 0:00 ps
|
|
</PRE>
|
|
/home/larry#
|
|
<P></TT>
|
|
<A NAME=3390> </A>
|
|
The <tt>PID</tt> listed in the first column is the <b>process ID</b>,
|
|
a unique number given to every running process. The last column,
|
|
<tt>COMMAND</tt>, is the name of the running command. Here, we're only looking
|
|
at the processes which Larry is currently running<A NAME=tex2html629 HREF="footnode.html#3567"><IMG ALIGN=BOTTOM ALT="gif" SRC="foot_motif.gif"></A>. These are <tt>bash</tt>
|
|
(Larry's shell), and the <tt>ps</tt> command itself. As you can see,
|
|
<tt>bash</tt> is running concurrently with the <tt>ps</tt> command.
|
|
<tt>bash</tt> executed <tt>ps</tt> when Larry typed the command. After
|
|
<tt>ps</tt> is finished running (after the table of processes is displayed),
|
|
control is returned to the <tt>bash</tt> process, which displays the
|
|
prompt, ready for another command.
|
|
<P>
|
|
<A NAME=3403> </A>
|
|
A running process is known as a <em>job</em> to the shell. The terms
|
|
<em>process</em> and <em>job</em> are interchangeable. However, a process
|
|
is usually referred to as a ``job'' when used in conjunction with <b>
|
|
job control</b>---a feature of the shell which allows you to switch between
|
|
several independent jobs.
|
|
<P>
|
|
In most cases users are only running a single job at a time---that
|
|
being whatever command they last typed to the shell. However, using job
|
|
control, you can run several jobs at once, switching between them as
|
|
needed. How might this be useful? Let's say that you're editing
|
|
a text file and need to suddenly interrupt your editing and do something
|
|
else. With job control, you can temporarily suspend the editor,
|
|
and back at the shell prompt start to work on something else. When you're
|
|
done, you can start the editor back up, and be back where you
|
|
started, as if you never left the editor. This is just one example. There
|
|
are many practical uses for job control.
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html3438 HREF="node134.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3436 HREF="node132.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3430 HREF="node132.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3440 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3441 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html3439 HREF="node134.html">3.11.2 Foreground and background</A>
|
|
<B>Up:</B> <A NAME=tex2html3437 HREF="node132.html">3.11 Job Control</A>
|
|
<B> Previous:</B> <A NAME=tex2html3431 HREF="node132.html">3.11 Job Control</A>
|
|
<BR> <HR> <P>
|
|
<BR> <HR>
|
|
<P><ADDRESS>
|
|
<I>Matt Welsh <BR>
|
|
mdw@sunsite.unc.edu</I>
|
|
</ADDRESS>
|
|
</BODY>
|