Linux+ Unit 11

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Linux+ Unit 11 as PDF for free.

More details

  • Words: 1,291
  • Pages: 45
Course ILT

Managing system processes Unit objectives  Categorize the different types of processes, view processes using utilities, and illustrate the difference between 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 by using the at daemon, and schedule repetitive commands by using the cron daemon

Course ILT

Topic A  Topic A: Starting, viewing, and killing processes  Topic B: Foreground and background processes  Topic C: Process priorities and scheduling

Programs and processes Course ILT

 Program – An executable file – May be executed to create a process

 Process – An instance of a executing program

Linux processes Course ILT

 User process – Process begun by a user that runs on a terminal

 Daemon process – System process that is not associated with a terminal

continued

Linux processes, continued Course ILT

 Process ID (PID) – Unique identifier assigned to every process

 Child processes – Refers to a process that was started by another process (parent process)

 Parent processes – Process that has started other processes (child processes)

 Parent Process ID (PPID) – The PID of the parent process that created the current process

Course ILT

Parent and child processes

Course ILT

Process genealogy

Course ILT

Activity A-1

Discussing processes

Course ILT

The ps command  Most versatile and common utility that can view processes  Without arguments, displays processes running in the current shell

Course ILT

Process states Process state

Description

S

If a process is not being run on the processor at the current time, then you’ll see an S (sleeping) in the process state column.

R

Process is currently running on the processor.

T

Process has stopped or is being traced by another process.

Z

This indicates a zombie process.

Process states Course ILT

 Zombie process – Process that has finished executing, but whose parent has not yet released its PID – Also known as defunct processes

Process priority and nice value Course ILT

 Process priority (PRI) – Number assigned to a process, used to determine how many time slices on the processor it will receive

 Nice value (NI) – Value that indirectly represents the priority of a process  The higher the value, the lower the priority

Course ILT

Options of the ps command

Course ILT

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

top command, continued Course ILT

 Rogue processes – 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

Course ILT

Activity A-2

Using the ps command to view processes

Sending signals to processes Course ILT

 Kill signal – Type of signal sent to a process by the kill command – Different kill signals affect processes in different ways

 kill command – Command that kills all instances of a process by command name

Course ILT

Common administrative kill signals

Trapping and killall Course ILT

 Trapping – The process of ignoring a kill signal

 killall command – The command that kills all instances of a process by command name

Course ILT

Activity A-3

Using the kill command to terminate processes

Course ILT

Topic B  Topic A: Starting, viewing, and killing processes  Topic B: Foreground and background processes  Topic C: Process priorities and scheduling

Course ILT

Process execution  The three main types of Linux commands that you may execute – Binary programs – Shell functions – Shell scripts

Course ILT

Forking  The act of creating a new BASH shell child process from a parent  Carried out by the fork function in the Linux kernel

Course ILT

Process forking

Background and foreground processes

Course ILT

 Foreground processes – Process for which the BASH shell that executed it must wait for its termination

 Background processes – Process that does not require the BASH shell to wait for its termination – Upon execution, the user receives the BASH shell prompt immediately

Background processes Course ILT

 jobs command – Command used to see the list of background processes running in the current shell

Background processes Course ILT

 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

Course ILT

Activity B-1

Running a process in the background

Course ILT

Topic C  Topic A: Starting, viewing, and killing processes  Topic B: Foreground and background processes  Topic C: Process priorities and scheduling

Process priorities Course ILT

 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 will execute – Time slices are usually measured in milliseconds

Course ILT

The nice value scale

Course ILT

The nice value and command  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 will receive time slices

 nice command – The command used to change the priority of a process as it is started

The renice command Course ILT

 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 by using renice

Course ILT

Activity C-1

Experimenting with scheduling priority

Scheduling commands Course ILT

 The at daemon (atd) – System daemon that executes tasks at a future time – Configured with the at command

 The cron daemon (crond) – System daemon that executes tasks repetitively in the future – Configured using cron tables

Course ILT

Common at commands

Course ILT

Scheduling commands with atd  /etc/at.allow – A file listing all users who can use the at command

 /etc/at.deny – A file listing all the users who cannot access the at command

crond scheduling commands Course ILT

 cron tables – A 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

Course ILT

User cron table format

Course ILT

User cron table entry

Location of cron tables Course ILT

 /var/spool/cron – Stores user cron tables

 /etc/cron.d – Contains additional system cron tables

 /etc/crontab – Default system cron table

User cron tables Course ILT

 /etc/cron.allow – File listing all users who can use the cron command

 /etc/cron.deny – File listing all users who cannot access the cron command

 crontab command – Command used to view and edit user cron tables

Course ILT

The system cron table  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

Course ILT

Activity C-2

Using at and crontab utilities to schedule processes

Course ILT

Unit summary  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 and created and manipulated background processes  Used utilities to modify the priority of a process and schedule commands

Related Documents

Linux+ Unit 11
November 2019 8
Unit 11
June 2020 10
Unit 11
May 2020 12
Unit 11
May 2020 14
Unit 11
November 2019 11
Linux+ Unit 05
November 2019 15