- •Management processes
- •1 Purpose of
- •2 Key provisions
- •2.1 Process control: general
- •2.2 Kill command
- •2.3 Priorities processes. Nice command
- •2.4 Ps command
- •2.7 Program cron
- •3 Control questions
- •4 Homework
- •5 Laboratory assignment
- •2.5 Nohup command
- •2.6 At command
- •6 Requirements for the content of the protocol
- •Readdress of input/output, conveyor
- •1 Purpose of
- •2 Key provisions
- •2.1 Standard streams
- •2.2 Pereadrssatsiya standard input / output
- •2.3 Variable noclobber
- •2.4 Device /dev/null
- •2.5 Redirecting stdin using exec
- •3 Key Questions
- •4 Homework
- •5 Laboratory assignment
- •6 Requirements for the content of the protocol
2.2 Kill command
For process control system provides a team kill.
The format of the command: kill <-signal> pid, where <signal> - a number or symbolic name sent by the process signal. Kill command is most often used for terminating the process. The most commonly used signals:
9 (KILL) - assured destruction process;
15 (TERM) - completion of the program;
1 (HUP) - all clear signal. Many system processes upon receipt of this signal re-read its configuration files. It is recommended to give the signal before sending a HUP signal kill.
Sometimes, though rarely, processes fall into such a state that they can not "kill" even issuing the command kill-9pid.
In this case, the most effective way to "kill" the process - the command reboot.
2.3 Priorities processes. Nice command
On the priority of the process depends on how much CPU time it receives. Choosing to perform the process, the kernel is a process with the highest "domestic priority." Just change the value of domestic priority is impossible, but you can influence it by changing the so-called nice-value.
For this purpose, the command nice is used. The format of this command:
nice <The relative priority of the process - parent> <command>. The relative priority of a FreeBSD system is in the range from -20 to +20.
It is important to remember: The lower the nice - the higher the priority of the process.
Example:
# nice -10 / usr / local / mygame
If the user does not take special measures, the new process inherits the priority of its parent. You can increase the value of nice (i.e. lower priority), but can not reduce it, even for the return process to the priority obtained at "birth".
A privileged user can change the priorities of the processes as you wish, up to the fact that all processes will not work because of one single.
In the system, FreeBSD is the command renice, through which you can change the priority already running process. Its format is:
renice <priority> [-p pid] [-g <group>] [-u <user>]
Example:
# renice +1 -p 989 -u daemon root -p 32
The sample is reduced by 1 priority processes with PID numbers 989 and 32, as well as all processes owned by daemon and root. The current process control, commands ps and top.
2.4 Ps command
For the current control of processes in the system, the command ps.
If she entered without options, it will show only your own user processes and the processes of exchange with the terminal. The team has options:
a - gives information on all user processes;
s - shows the values of environment variables;
h- for output to PAGER (more or less) displays the title of listing;
m - sort output by memory usage;
r - sorts the output by use of CPU time;
x - output is not associated with the terminals (ie, appear as such, and a daemon process).
Dial command
# ps -ax
Let's look at listing (shown here for brevity, only one line header and only a portion of the fields):
USER PID STAT START TIME COMMAND
bob 1167 R + 5:57 PM 0:00.04 ps-ax
USER - name of the owner of the
PID - process ID
STAT - the current status of the process
R = workable, or ready to do,
T = suspended
I = inactive (BSD), an intermediate state (System V),
S = (waiting> 20 sec)
Z = zombie process
Additional Flags:
W = process svopirovan
+ = Process priority mode, the terminal
START - start time of
TIME - CPU time consumed by the process
COMMAND - command name and arguments. The output of this command is similar to that command ps.
