A free Basic UNIX-training with muLinux
Notes: This Text is roughly translated (German to English) by a translating program. Sorry, but I have not time for the translation. Maybe you can do this.
Process Management
Under DOS the user can execute a program only in each case. Necessary, but
time-consuming functions, e.g. a printing, or a formatting of diskettes, leave
the user to wait, until the process is terminated. Under Windows can be executed
already more than one program at the same time. Unix was however always a
multi-user and a multitasking system.
Multi-user means that several users can operate at the same time on
the same computer. This necessarily different humans do not have to be. Humans
can log in also several times. This is possible with Linux over the virtual
consoles. Additional users can log in also over a network.
Multitasking means however that a user can execute several programs at
the same time. One can at the same time format e.g. a longer text printouts and
a diskette.
A process is a program with its remark environment, in the execution.
This program can be an application program or a not program visible for the user
(English daemon). Each process operates in a separate, virtual address area,
then no process can disturb another unknowingly knowingly (e.g. by viruses) or.
Individual process successively that is permitted access to the CCU (processor).
How long and in which order this occurs, by the process scheduler (English
schedule) is determined. If a program " does not hang " can it, as
with some primitive operation systems, which paralyze whole computer.
All processes are administered over the central process table. The processes
are to each process a unique number (process number, PID) in a hierarchical
order, there and the number of the parents process (producer process) with
itself leads. Similarly as with the rights of access with files applies to the
task management and the memory management: A process can be influenced only of
its user.
Display All Current Processes with ps
Every now and then necessarily the outline of current processes is to be had.
The instruction ps a list displays in the memory process present.
/# ps
PID TTY STAT TIME: COMMAND
...
/#
Each process, so each current program, is thus represented with a line.
With the names of most processes we will not be able to begin up to now yet much.
PID
Each process receives a unique number (Process Identifier) when
starting, via which it can be also addressed.
Thus e.g. each process with the instruction leaves itself kill PID terminated (see below).
For each process a sublist becomes in virtual file system /proc created.
This can also ls /proc are controlled.
TTY
TTY shows the number of the terminal or the virtual console, at which the
process was started. Some processes are started however by the system and are
assigned therefore no console. This specification does not seem to function with
muLinux.
STAT
Here the status of the process is symbolized.
- D not interruptible sleep.
- R running
- S sleeping. The process waits for possibly something. Usually the processes oscillate between running and sleep back and forth.
- T interrupted process
- Z Zombie. That is a terminated process, which was not removed yet from the process table.
TIME:
The really used computing time in minutes and seconds.
COMMAND
The name program during the process.
Commands in the background &
If an instruction is to be shifted immediately after the start into the
background, then the actual instruction line the Ampersan character must & follow.
By this character the instruction in the background operates and
announces its PID only briefly. This is meaningful with longer program runs, if
no user inputs are more necessary.
/# find / -user craxi -print &
This instruction with a line is acknowledged. For example:
[3] 12304
The number in square brackets indicates, wievielt jobs now in the background runs.
The second number is the PID.
It pay attention that jobs, which operate in the background write further on
the display, and the work in the foreground substantially to disturb can. One
knows however the possibility of the data bypass by means of > use,
around the output into a file write. Error messages can be rerouted with > 2.
/# find / -user craxi -print 2> /dev/null > a/gefunden.txt &
Kill Processes with kill
Every now and then it occurs that a program cannot be terminated or we to know
like we it to terminate being able. Here the instruction helps kill.
Since we do not want to shoot wildly any programs here, we start
only times a program for shooting. As example we use the pocket calculator bc
.
/# bc
Now we change to the second virtual console with [Alt] [F2].
There we log ourselves as root.
Around the instruction kill to apply we need the process number (PID).
We determine these also ps:
/# ps
...
>
Whom the output is too long, the output can on the processes also also with
the following version "bc" filter:
/# ps | grep "bc"
26845 ? s 0:0 (bc) mawk - f / usr/bin/bc
The first number is the process number. This surely deviates with on your display.
Use the number with you one displays. Additionally further lines appear
also " grep " and " sed ". Those are the
processes for the even used grep - instruction. These lines are
uninteresting. Now we want the process with the pocket calculator bc terminate:
/# kill -9 26845
The option -9 caused that the process in any case is terminated.
If this option is omitted, the program has to store still the possibility if necessary data.
If we change back now to the original console, we see the following output:
/# ps
...
> Killed
/#
The process with the pocket calculator was thus terminated.
Naturally one can terminate only own processes.
An exception forms here again the superuser.
Robert.Warnke@giso.de (copyleft) Robert Warnke, Berlin (Germany) - You can write me in English. | http://rowa.giso.de
|