Download Managing Linux Processes: Understanding Types, Viewing, and Killing Processes and more Slides Advanced Operating Systems in PDF only on Docsity!
Chapter 10
Managing Linux Processes
Objectives
- Categorize the different types of processes on a Linux system
- View processes using standard Linux utilities
- Illustrate the difference between common kill signals
- Describe how binary programs and shell scripts are executed
Linux Processes
- Program: Structured set of commands stored in an executable file - Executed to create a process
- Process: Program running in memory and on CPU
- User process: Process begun by user on a terminal
- Daemon process: System process
- Not associated with a terminal
Linux Processes (continued)
- Process ID (PID): Unique identifier assigned to a process
- Child process: Process started by another process (parent process)
- Parent process: Process that has started other processes (child processes)
- Parent Process ID (PPID): Parent process’s PID
Linux Processes (continued)
Figure 10-2: Process genealogy
Viewing Processes
- ps command: View processes
- Most common process viewing utility
- No arguments: Lists all processes running in current shell - PID, terminal, command that started process, CPU time
- – f (full) option: More complete information
- User identifier (UID), PPID, start time, CPU utilization
Viewing Processes (continued)
- Process priority (PRI): Determines how many processor time slices process will receive - Higher value means lower priority
- Nice value (NI): Indirectly represents priority
- Higher value means lower priority
Viewing Processes (continued)
Table 10-1: Common options to the ps command
Killing Processes
- kill signal: Sent to a process by kill command
- 64 types of kill signals
- Affect processes in different ways
- kill command: Kills all instances of a process by command name - To kill a process, give kill signal and PID - If no kill signal given, SIGTERM assumed
Killing Processes (continued)
Table 10-2: Common administrative kill signals
Killing Processes (continued)
- killall command: Kills all instances of a process by command name - Uses process name instead of PID
- Can use top command to kill processes
Process Execution
- Three main types of executable commands
- Binary programs
- Shell scripts
- Shell functions
Process Execution (continued)
Figure 10-3: Process forking
Running Processes in the Background
- Foreground processes: BASH shell must wait for termination
- Background processes: BASH shell does not wait for termination - & metacharacter - Upon execution, user receives BASH shell prompt immediately