Managing system processes
Download
1 / 50

Managing system processes - PowerPoint PPT Presentation


  • 157 Views
  • Uploaded on

Managing system processes. Unit objectives Categorize the various types of processes, view processes using utilities, and illustrate the differences between various kill signals Describe how binary programs and shell scripts are executed, create and manipulate background processes

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Managing system processes' - ban


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Managing system processes
Managing system processes

Unit objectives

  • Categorize the various types of processes, view processes using utilities, and illustrate the differences between various kill signals

  • Describe how binary programs and shell scripts are executed, create and manipulate background processes

  • Use utilities to modify the priority of a process, schedule commands using the at daemon, and schedule repetitive commands using the cron daemon.


Topic a starting viewing and killing processes
Topic A: Starting, viewing and killing processes


Linux processes
Linux processes

  • Program

    • Executable file

    • May be executed to create a process

  • Process

    • Instance of an executing program


User and daemon processes
User and daemon processes

  • User process

    • Process begun by a user that runs on a terminal

  • Daemon process

    • System process that isn’t associated with a terminal


Processes
Processes

  • Process ID (PID)

    • Unique identifier assigned to every process

  • Child process

    • Process that was started by another process (parent process)

  • Parent process

    • Process that has started other processes (child processes)

  • Parent Process ID (PPID)

    • PID of the parent process that created the current process



Processes1
Processes

  • PID not sequential

    • Randomized

  • Can have multiple children

  • Only One parent

  • PID1 PPID 0

    • Kernel/ init daemon

  • Can trace everything back to kernel



Viewing process
Viewing Process

  • PS Command

    • Most versatile and common utility that can view processes

    • Without arguments, displays processes running in the current shell

  • ps –f

    • Full output

    • Includes UID and PPID as well at start time and CPU usage


Viewing process1
Viewing Process

  • ps –e or ps -ef

    • Entire list across all terminals and include daemon processes

  • Usually pipe this command to a filter like grep


Viewing process2
Viewing Process

  • ps –l

  • Gives more information, including process flah and process state



Zombie process
Zombie process

  • Process that has finished executing, but whose parent hasn’t yet released its PID

  • Also known as a defunct process


Process priority and nice value
Process priority and nice value

  • Process priority (PRI)

    • Number assigned to a process, used to determine how many time slices on the processor it receives

      • 0 High Priority

      • 127 low priority

  • Nice value (NI)

    • Value that indirectly represents the priority of a process

      • The higher the value, the lower the priority


Process priority and nice value1
Process priority and nice value

  • Berkeley style options

    • a- list processes across terminals

    • x- list processes not on a terminal



Top command
top command

  • Most common command used to display processes aside from ps

  • Display organized by processor time

    • Processes that use the most processor time are listed at the top of the screen

continued


Rogue process
Rogue process

  • Process that has become faulty and consumes more system resources than it should

  • Can be used to change the priority of processes or kill them


Pstree command
Pstree command

  • Show processes as a tree

    • Shows from a specified PID


Killing processes
Killing Processes

  • Kill signal

    • Type of signal sent to a process by the kill command

    • Various kill signals affect processes in various ways

  • kill command

    • Command that kills all instances of a process by command name

    • -l switch shows different kill commands

    • Default is kill -15 (SIGTERM)



Killing processes1
Killing Processes

  • pgrep

    • Grep for processes

      • Find procceses with a particular name or user

  • kkill

    • Kills processes in argument list without outputting details


Trapping and killall
Trapping and killall

  • Trapping

    • Process can ignore a kill signal

      • Use SIGKILL to get around it

  • killall command

    • Command that kills all instances of a process by command name

    • Kills multiple copies of a process with same name

  • Can also kill using the k key in top


An administrator types the command ps xl and the following is a portion of the output obtained:

F UID PID PPID NI VSZ RSS WCHAN TTY TIME COMMAND

4 0 1707 1706 15 2304 830 wait4 tty1 0:00 ­bash

4 0 1708 1706 15 4804 420 wait4 tty1 0:00 awk

4 0 1701 1707 15 4304 820 wait4 tty1 0:00 nmap

4 0 1836 1713 15 4405 941 wait4 tty1 0:00 vi

4 0 1921 1707 15 7205 820 wait4 tty1 0:00 xterm

Which process number should be killed to stop the nmap And xterm processes?

A. 15

B. 820

C. 1707

D. 1921


An administrator types the command ps xl and the following is a portion of the output obtained:

F UID PID PPID NI VSZ RSS WCHAN TTY TIME COMMAND

4 0 1707 1706 15 2304 830 wait4 tty1 0:00 ­bash

4 0 1708 1706 15 4804 420 wait4 tty1 0:00 awk

4 0 1701 1707 15 4304 820 wait4 tty1 0:00 nmap

4 0 1836 1713 15 4405 941 wait4 tty1 0:00 vi

4 0 1921 1707 15 7205 820 wait4 tty1 0:00 xterm

Which process number should be killed to stop the nmap And xterm processes?

A. 15

B. 820

C. 1707

D. 1921

Answer: C


The following is the output from a ps command: is a portion of the output obtained:

PID TTY TIME CMD

1054 pts/1 00:00:00 bash

6894 pts/1 00:00:00 nmap

7123 pts/1 00:00:00 ps

The nmap process has been taking up too much processing power. What command can be used to run nmap with less resources?

A. bg nmap

B. stop | back 6894

C. CTRL­Q, bk nmap:6894

D. Kill 6894 : nice ­n19 nmap <arguments>


The following is the output from a ps command: is a portion of the output obtained:

PID TTY TIME CMD

1054 pts/1 00:00:00 bash

6894 pts/1 00:00:00 nmap

7123 pts/1 00:00:00 ps

The nmap process has been taking up too much processing power. What command can be used to run nmap with less resources?

A. bg nmap

B. stop | back 6894

C. CTRL­Q, bk nmap:6894

D. Kill 6894 : nice ­n19 nmap <arguments>

Answer: D.


The system administrator notices that the system is running slow. What should be done to find the processes that are using the most resources?

A. Use the command "renice" to show the processes with the highest priority.

B. Use the command "ps a" to list the top five processes with the highest priority.

C. Use the command "jobs" to give a constantly updated list of CPU­intensive processes.

D. Use the command "top" to give a real­time updated list of processes ranked by CPU usage.


The system administrator notices that the system is running slow. What should be done to find the processes that are using the most resources?

A. Use the command "renice" to show the processes with the highest priority.

B. Use the command "ps a" to list the top five processes with the highest priority.

C. Use the command "jobs" to give a constantly updated list of CPU­intensive processes.

D. Use the command "top" to give a real­time updated list of processes ranked by CPU usage.

Answer: D.


Topic b foreground and background processes
Topic B: slow. What should be done to find the processes that are using the most resources? Foreground and background processes


Process execution
Process execution slow. What should be done to find the processes that are using the most resources?

  • The three main types of Linux commands that you may execute:

    • Binary programs

    • Shell functions

    • Shell scripts


Forking
Forking slow. What should be done to find the processes that are using the most resources?

  • Act of creating a new BASH shell child process from a parent

  • Carried out by the fork function in the Linux kernel


Process forking
Process forking slow. What should be done to find the processes that are using the most resources?


Background and foreground processes
Background and foreground processes slow. What should be done to find the processes that are using the most resources?

  • Foreground process

    • Process for which the BASH shell that executed it must wait for its termination

  • Background process

    • Process that doesn’t require the BASH shell to wait for its termination

    • Upon execution, the user receives the BASH shell prompt immediately


Background processes
Background processes slow. What should be done to find the processes that are using the most resources?

  • jobs command

    • Command used to see the list of background processes running in the current shell

  • foreground (fg) command

    • Command used to run a background process in the foreground

  • background (bg) command

    • Command used to run a foreground process in the background


Topic c process priorities and scheduling
Topic C: slow. What should be done to find the processes that are using the most resources? Process priorities and scheduling


Process priorities
Process priorities slow. What should be done to find the processes that are using the most resources?

  • Time slice

    • Amount of time a process is given on a CPU in a multiprocessing operating system

    • The more time slices a process has, the more time it has to execute on the CPU and the faster it executes

    • Time slices are usually measured in milliseconds


The nice value scale
The nice value scale slow. What should be done to find the processes that are using the most resources?


The nice value and command
The nice value and command slow. What should be done to find the processes that are using the most resources?

  • Processes are started with a nice value of 0 by default

    • On some systems, background processes are given a nice value of 4 by default to lower the chance they receive time slices

  • nice command

    • Command used to change the priority of a process as it’s started


The renice command
The renice command slow. What should be done to find the processes that are using the most resources?

  • renice command

    • Used to alter the nice value of a process currently running

  • As with the nice command, only the root user may change the nice value to a negative value using renice


Scheduling commands
Scheduling commands slow. What should be done to find the processes that are using the most resources?

  • at daemon (atd)

    • System daemon that executes tasks at a future time

    • Configured with the at command

  • cron daemon (crond)

    • System daemon that executes tasks repetitively in the future

    • Configured using cron tables


Common at commands
Common at commands slow. What should be done to find the processes that are using the most resources?


Scheduling commands with atd
Scheduling commands with atd slow. What should be done to find the processes that are using the most resources?

  • /etc/at.allow

    • A file listing all users who can use the at command

  • /etc/at.deny

    • A file listing all the users who can’t access the at command


Crond scheduling commands
crond scheduling commands slow. What should be done to find the processes that are using the most resources?

  • Cron table

    • File specifying tasks to be run by the cron daemon

    • User cron tables and system cron tables

    • Six fields separated by space or tab characters


User cron table format
User cron table format slow. What should be done to find the processes that are using the most resources?


User cron table entry
User cron table entry slow. What should be done to find the processes that are using the most resources?


Location of cron tables
Location of cron tables slow. What should be done to find the processes that are using the most resources?

  • /var/spool/cron

    • Stores user cron tables

  • /etc/cron.d

    • Contains additional system cron tables

  • /etc/crontab

    • Default system cron table


User cron tables
User cron tables slow. What should be done to find the processes that are using the most resources?

  • /etc/cron.allow

    • File listing all users who can use the cron command

  • /etc/cron.deny

    • File listing all users who can’t access the cron command

  • crontab command

    • Command used to view and edit user cron tables


The system cron table
The system cron table slow. What should be done to find the processes that are using the most resources?

  • Systems are scheduled to run commands during non-business hours

  • Commands may perform system maintenance, back up data, or run CPU-intensive programs

  • Most commands are scheduled by the cron daemon from entries in the system cron table /etc/crontable


Chapter summary
Chapter summary slow. What should be done to find the processes that are using the most resources?

  • Categorized different types of processes, viewed processes by using utilities, and learned the difference between kill signals

  • Described how binary programs and shell scripts are executed, created and manipulated as background processes

  • Used utilities to modify the priority of a process and schedule commands


ad