Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
elearning:workbooks:redhat:rh124en:l109 [2024/11/12 09:59] adminelearning:workbooks:redhat:rh124en:l109 [2024/11/27 08:50] (Version actuelle) admin
Ligne 9: Ligne 9:
 =====Contents===== =====Contents=====
  
-* **RH12410 - Process Management**+  * **RH12410 - Process Management**
     * Contents     * Contents
     * Presentation     * Presentation
     * Process Types     * Process Types
-    * Process commands +    * Lab #1 - Process commands 
-      * The ps command +      * 1.1 - The ps command 
-      * The pgrep command +      * 1.2 - The pgrep command 
-      * The pstree command +      * 1.3 - The pstree command 
-      * The top command +      * 1.4 - The top command 
-      * The fg, bg and jobs commands +      * 1.5 - The fg, bg and jobs commands 
-      * The wait command +      * 1.6 - The wait command 
-      * The nice command +      * 1.7 - The nice command 
-      * The renice command +      * 1.8 - The renice command 
-      * The nohup command +      * 1.9 - The nohup command 
-      * The kill command +      * 1.10 - The kill command 
-      * The pkill command+      * 1.11 - The pkill command
  
 =====Présentation===== =====Présentation=====
Ligne 39: Ligne 39:
   * A list of open files..   * A list of open files..
  
-This information is stored in the **/proc** directory. The /proc directory contains virtual files and directories. The contents of these files are created dynamically during consultation. Only root can view all the information in the /proc directory.  +This information is stored in the **/proc** directory:
- +
-Enter the following command:+
  
 <code> <code>
Ligne 115: Ligne 113:
 </code> </code>
  
-<WRAP center round important>+<WRAP center round important 60%>
 **Important** - Note that the content of the files is of little or of no direct use to a System Administrator. **Important** - Note that the content of the files is of little or of no direct use to a System Administrator.
 </WRAP> </WRAP>
Ligne 127: Ligne 125:
   * **daemon** - processes that do not have a parent terminal.   * **daemon** - processes that do not have a parent terminal.
  
-A process can be in one of nine states or //process states// :+A process can be in one of nine //process states// :
  
   * //user mode// - the process is executing in user mode,   * //user mode// - the process is executing in user mode,
Ligne 143: Ligne 141:
 ====1.1 - The ps command====  ====1.1 - The ps command==== 
  
-This command displays the user'processes attached to the terminal:+The output from this command shows the processes attached to the current terminal:
  
 <code> <code>
Ligne 155: Ligne 153:
 </code> </code>
  
-For more details, use the **-l** option:+You can get more details by using the **-l** switch:
  
 <code> <code>
Ligne 167: Ligne 165:
 Note in this output : Note in this output :
  
-^ F | Process flags. The value 4 indicates that the process is using root privileges. +^ F | Process flag. The value of means the process is using root privileges. | 
-^ S | Process state S (sleeping), R (In run queue), Z (zombie), N (low priority), D (uninterruptible sleep), T (Traced) | ^ UID Number of the process+^ S | The process state S (sleeping), R (In run queue), Z (zombie), N (low priority), D (uninterruptible sleep), T (Traced) | 
-^ UID User ID +^ UID | User ID of the user who has stated the process | 
-^ PID | Unique Process Number +^ PID | Process ID 
-^ PPID | PID of parent process +^ PPID | Parent PID | 
-^ C | Process priority factor |+^ C | Prority factor |
 ^ PRI | Process priority | ^ PRI | Process priority |
-^ NI | The value of nice | +^ NI | Process nice value 
-^ ADDR | Process memory address |+^ ADDR | Memory address |
 ^ SZ | Virtual memory usage | ^ SZ | Virtual memory usage |
 ^ WCHAN | Name of the kernel function in which the process is asleep | ^ WCHAN | Name of the kernel function in which the process is asleep |
-^ TTY | Name of the terminal from which the process was started | ^ TIME +^ TTY | Name of the terminal in which the process was started | 
-^ TIME | Runtime of the process +^ TIME | Processing time 
-^ CMD | Command executed |+^ CMD | The command that generated the process |
  
-To view the process table, use the ps command with the l and x options - the command displays all the processes with a long display :+ 
 +To view the process table, use the ps command with the l and x switches:
  
 <code> <code>
Ligne 247: Ligne 246:
 This output contains some additional information: This output contains some additional information:
  
-^ VSZ | The same as SZ in the example above RSS +^ VSZ | The same thing as SZ in the previous example | 
-^ RSS | The memory used in kilobytes by the process | +^ RSS | Memory in KB used by the process | 
-^ STAT | The same as S in the example above.+^ STAT | The same thing as S in the previous example  |
  
- +Using the a, u and x switches you obtain the following output:
-With options a,u and x the command displays the following result:+
  
 <code> <code>
Ligne 317: Ligne 315:
 This output contains some additional information: This output contains some additional information:
  
-^ USER | The user of the process | +^ USER | The user associated with the process | 
-^ %CPU | Microprocessor resources used by the process | +^ %CPU | % of the processor ressources used by the process | 
-^ %MEM | RAM resources used by the process |+^ %MEM | % of the memory ressources used by the process |
  
 The command line switches for this command are : The command line switches for this command are :
Ligne 527: Ligne 525:
 ====1.3 - The pstree command====  ====1.3 - The pstree command==== 
  
-This command displays processes in a tree structure, showing parent processes as children:+This command displays processes in a tree structure:
  
 <code> <code>
Ligne 645: Ligne 643:
 ====1.4 - The top command==== ====1.4 - The top command====
  
-This command shows the processes in memory :+**top** shows a continuous real time list of running processes:
  
 <code> <code>
Ligne 708: Ligne 706:
 ...                                                                          ...                                                                         
 </code> </code>
 +
 To display the **top** command help, press **h** : To display the **top** command help, press **h** :
  
Ligne 737: Ligne 736:
 </code> </code>
  
-<WRAP center round important> +<WRAP center round important 60%
-**Important** - To return to the previous display, press **q** or **echap**.+**Important** - To return to the previous display, press **q** or **escape**.
 </WRAP> </WRAP>
  
-At launch, the list refresh time is 3 seconds. To change this to 1 second, press **s** then 1 and confirm:+When launched top'refresh rate is 3 seconds. To change this to 1 second, use the **s** key:
  
 <code> <code>
Ligne 816: Ligne 815:
 </code> </code>
  
-If you do not want to see zombie processes or waiting processes, press i :+To see the zombie and waiting processes, use the **i** key:
  
 <code> <code>
Ligne 844: Ligne 843:
 ====1.5 - The fg, bg and jobs commands==== ====1.5 - The fg, bg and jobs commands====
  
-Normally these commands run in the foreground. You can also run processes in the background. If you are running a command in the background, you must add **(space)&** to the end of the command:+Normally commands are executed in the foreground of a terminalHowever you can also execute a command in what is known as the background by adding **(space)&** to the end of the command:
  
 <file> <file>
Ligne 850: Ligne 849:
 </file> </file>
  
-<WRAP center round important> +<WRAP center round important 60%
-**Important** - Note that a background process is said to be **asynchronous** because it continues independently of its parent, which is the shell. In the foreground the process is said to be **synchronous**.+**Important** - Note that a background process is said to be **asynchronous** because it continues independently of its parent, which is the shell. The foreground the process is said to be **synchronous**.
 </WRAP> </WRAP>
  
-Linux numbers all processes that are placed in background tasks. This is called a **task number**.+Linux identifies processes sent to the back ground by **job numbers**.
  
-The **jobs** command is used to find out about background processes:+The **jobs** command shows a list of all the current jobs associated with the current terminal:
  
 <code> <code>
Ligne 866: Ligne 865:
 </code> </code>
  
-<WRAP center round important> +<WRAP center round important 60%
-**Important** - Note that the job number is enclosed in [square brackets] whereas the PID is not. The **+** sign after job number [1] indicates that the job is the last to be handled.+**Important** - The job number is between square brackets whilst the PID is not. The **+** sign indicates that this is the last job to have been modified.
 </WRAP> </WRAP>
  
 If you wish to send a process into the background to free up the shell for other commands, you must first suspend the process in question. Normally we suspend a process using the key combination <key>Ctrl</key><key>Z</key>. If you wish to send a process into the background to free up the shell for other commands, you must first suspend the process in question. Normally we suspend a process using the key combination <key>Ctrl</key><key>Z</key>.
  
-For example, press :+For example:
  
 <code> <code>
Ligne 880: Ligne 879:
 </code> </code>
  
-Once suspended, use the command **bg** (background) followed by **%** and the task number to send the process to the background:+Once suspended, use the **bg** (background) command followed by **%** and the job number to send the process to the background:
  
 <code> <code>
Ligne 891: Ligne 890:
 </code> </code>
  
-<WRAP center round important> +<WRAP center round important 60%
-**Important** - Note that when the process goes into the backgroundit resumes execution as normal. The **-** character following the task number [1] indicates that the task is the penultimate to have been handled.+**Important** - Note that when the process is sent to the background it resumes normal execution. The **-** character which follows the [1] indicates that this is that last but one job to have been modified.
 </WRAP> </WRAP>
  
-To bring the process back to the foreground, the process concerned must be interrupted again. However, this time we cannot use the <key>Ctrl</key><key>Z</key> commandWe therefore need to send a **signal** to the process using the **kill** command with the **-stop** operator.+To bring the job back to the foreground you cannot suspend it by using the <key>Ctrl</key><key>Z</key> keysIn this case you will have to send a signal to the process. Signals are sent to processes by using the **kill** command:
  
 <code> <code>
Ligne 911: Ligne 910:
 </code> </code>
  
-<WRAP center round important> +<WRAP center round important 60%
-**Important** - Note the use of <key>Ctrl</key><key>c</key> to kill the foreground process.+**Important** - Note that we have used the <key>Ctrl</key><key>c</key> keys to kill the process once in the foreground.
 </WRAP> </WRAP>
  
Ligne 944: Ligne 943:
 ====1.6 - The wait command====  ====1.6 - The wait command==== 
  
-This command is used to give an asynchronous process the same behaviour as a synchronous process. It is used to wait until a background process has finished:+The **wait** command makes an asynchronous process react like a synchronous process:
  
 <code> <code>
Ligne 957: Ligne 956:
 </code> </code>
  
-<WRAP center round important>+<WRAP center round important 60%>
 **Important** - Note that using <key>Ctrl</key><key>c</key> kills the process generated by the **wait** command and not the process generated by the **sleep** command. **Important** - Note that using <key>Ctrl</key><key>c</key> kills the process generated by the **wait** command and not the process generated by the **sleep** command.
 </WRAP> </WRAP>
Ligne 963: Ligne 962:
 ====1.7 - The nice command==== ====1.7 - The nice command====
  
-This command displays or modifies the priority of a process. The default priority for nice is 10. The highest priority nice value is -20. The lowest priority nice value is 19 :+This command is used to change the process priority. The default nice value when a process is started is **10**. The highest value of nice is **-20**, whilst the lowest value is **19**:
  
 <code> <code>
Ligne 986: Ligne 985:
 </code> </code>
  
-As you can seethe 6th column contains the nice value which applies to the priority in column 5+As you can see the 6th column contains the nice value that is applied to the 5th column. 
  
-<WRAP center round important> +<WRAP center round important 60%
-**Important** - Note that only root can start processes with negative value.+**Important** - Note that only root can give a process a value between 0 and -20.
 </WRAP> </WRAP>
  
Ligne 1017: Ligne 1016:
 ====1.8 - The renice command==== ====1.8 - The renice command====
  
-This command changes the priority of a process that is already running. The priority value can only be changed by the process owner or root.+This command is used to change the process priority of an already running processOnly the process owner and root can renice a process:
  
 <code> <code>
Ligne 1049: Ligne 1048:
 </code> </code>
  
-<WRAP center round important> +<WRAP center round important 60%
-**Important** -Note that only root can decrement the priority value with the renice command.+**Important** -Note that only root can decrease the priority value with the renice command.
 </WRAP> </WRAP>
  
Ligne 1079: Ligne 1078:
 ====1.9 - The nohup command==== ====1.9 - The nohup command====
  
-This command allows a process to continue execution after disconnection. A child process dies when the parent process dies or terminates. As a connection is a process, when you disconnect, your processes terminate. To avoid remaining connected after launching a long process, use the nohup command:+This command allows a process to continue after closing the terminal in which is was launched. A child process dies when the parent process dies or terminates. As a connection is a process, when you disconnect, your processes terminate. To avoid remaining connected after launching a long process, use the nohup command:
  
 <file> <file>
Ligne 1111: Ligne 1110:
 </code> </code>
  
-====.10 - The kill==== command+====1.10 - The kill command====
  
 The kill command sends signals to processes. The list of possible signals can be displayed using the **-l** option: The kill command sends signals to processes. The list of possible signals can be displayed using the **-l** option:
Ligne 1132: Ligne 1131:
 </code> </code>
  
-<WRAP centre round important>+<WRAP center round important 60%>
 **Important** - You will notice that each signal has a number. These signal numbers are used instead of options. For example, **-19** instead of the **-stop** option. **Important** - You will notice that each signal has a number. These signal numbers are used instead of options. For example, **-19** instead of the **-stop** option.
 </WRAP> </WRAP>
  
-Some of the most useful signal numbers are :+The most usefull signals are as follows:
  
-Number ^ Description ^ +Numéro ^ Description ^ 
-| -1 | The Hang Up signal is sent to all the children of a process when it terminates. +| -1 | Hang Up is sent to all the child processus of the PID specified 
-| -2 | Process interrupt - equivalent to <key>C</key><key>c</key>+| -2 | Equivalent to the <key>C</key><key>c</key> key combination 
-| -3 | The same as -2 but with the generation of a debug file | +| -3 | The same signal as -2 but it generates de debug file | 
-| -9 | The signal that kills a process suddenly +| -9 | A brutal way of killing a process | 
-| -15 | The signal sent by default by the **kill** command. Process terminates normally |+| -15 | The correct way of killing a process |
  
 The command line switches for this command are : The command line switches for this command are :
Menu