Linux+ Guide to Linux Certification, Second Edition

Slides:



Advertisements
Similar presentations
Job and Process Management
Advertisements

June 1, 1999Foreground/Background Processing1 Introduction to UNIX H. Foreground/Background Processing.
Using tcpdump. tcpdump is a powerful tool that allows us to sniff network packets and make some statistical analysis out of those dumps. tcpdump operates.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process The Process A process is.
Essential System Administration 3rd Edition Chapter 2 The Unix Way(Cont.) University Of Palestine.
Introduction to Unix – CS 21 Lecture 10. Lecture Overview Midterm questions Jobs and processes description The foreground and background Controlling jobs.
Lesson 10-Controlling User Processes. Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.
Chapter 13 Processes. What is a process? A process is a program in execution A process is created whenever an external command is executed Whenever the.
Process Management We studied process management in chapter 4 – Here, we examine managing processes from a user’s and system administrator’s perspective.
CS 497C – Introduction to UNIX Lecture 26: - The Process Chin-Chih Chang
Controlling Processes & Periodic Processes WeeSan Lee
Linux+ Guide to Linux Certification, Second Edition
Process Process: the UNIX abstraction of a stand-along computer that manages resources (memory, CPU, I/O resources) comprising a running program. Processes.
Now, return to the Unix Unix shells: Subshells--- Variable---1. Local 2. Environmental.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
More Shell Basics CS465 - Unix. Unix shells User’s default shell - specified in /etc/passwd file To show which shell you are currently using: $ echo $SHELL.
CS 497C – Introduction to UNIX Lecture 27: - The Process Chin-Chih Chang
Guide To UNIX Using Linux Third Edition
5 UNIX Processes. Introduction  Processes  How to list them  How to terminate them  Process priorities  Scheduling jobs  Signals.
UNIX Processes. The UNIX Process A process is an instance of a program in execution. Created by another parent process as its child. One process can be.
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Processes Objectives –to become familiar with Unix processes Contents –processes & daemons –Nice levels –User limits –System resources –signals –batch.
Linux Operations and Administration
Managing Processes CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
Chapter 4 UNIX Common Shells Commands By C. Shing ITEC Dept Radford University.
The process concept (section 3.1, 3.3 and demos)  Process: An entity capable of requesting and using computer resources (memory, CPU cycles, files, etc).
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification Chapter Eight Working with the BASH Shell.
Process Control. Module 11 Process Control ♦ Introduction ► A process is a running occurrence of a program, including all variables and other conditions.
SUSE Linux Enterprise Server Administration (Course 3037) Chapter 6 Manage Linux Processes and Services.
Va-scanCopyright 2002, Marchany Unit 7 – Solaris Process Control Randy Marchany VA Tech Computing Center.
Managing processes and services. 1. How Linux handles processes 2. Managing running processes 3. Scheduling processes.
Linux+ Guide to Linux Certification, Second Edition Chapter 10 Managing Linux Processes.
RH030 Linux Computing Essentials
Lecture – Performance Performance management on UNIX.
The kernel considers each program running on your system to be a process A process lives as it executes, with a lifetime that may be short or long A process.
Agenda  Working with Processes: Purpose Running Programs within same process (execl, execlp, execle, execv, execvp, execve) “Spawning” other process (fork,
Scis.regis.edu ● CS 468: Advanced UNIX Class 4 Dr. Jesús Borrego Regis University 1.
Guide to Linux Installation and Administration, 2e1 Chapter 11 Using Advanced Administration Techniques.
Linux+ Guide to Linux Certification Chapter Eleven Managing Linux Processes.
Processes Dr. Yingwu Zhu. Process Concept Process – a program in execution – What is not a process? -- program on a disk - a process is an active object,
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
1 Lecture 6 Introduction to Process Management COP 3353 Introduction to UNIX.
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 9 Working.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop VI Scheduling & Process Management Professional.
Linux+ Guide to Linux Certification, Second Edition
CSC414 “Introduction to UNIX/ Linux” Lecture 3
Agenda Managing Processes (Jobs) Command Grouping Running jobs in background (bg) Bringing jobs to foreground (fg), Background job status (jobs) Suspending.
Unix System Administration Controlling Processes Chapter 5.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
An Introduction to processes R Bigelow. A Unix Process A process in Unix is simple a program The Unix system is made up of a group of processes all interacting.
1 COP 4343 Unix System Administration Unit 8: – at – cron.
Processes Todd Kelley CST8207 – Todd Kelley1.
Chapter 6: Managing Processes
Chapter 13 Processes.
Chapter 11 – Processes and Services
System Administration
SUSE Linux Enterprise Desktop Administration
The Linux Command Line Chapter 10
CHAPTER 8 ( , ) John Carelli, Instructor Kutztown University
CHAPTER 13 Processes.
CSC 140: Introduction to IT
Linux Shell Script Programming
Controlling Processes
Lab 6: Process Management
Lecture 6 Introduction to Process Management
LPI Linux Certification
Presentation transcript:

Linux+ Guide to Linux Certification, Second Edition Chapter 10 Managing Linux Processes

Linux+ Guide to Linux Certification, 2e 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+ Guide to Linux Certification, 2e

Objectives (continued) Create and manipulate background processes Use standard Linux utilities to modify the priority of a process Schedule commands to execute in the future using the at daemon Schedule commands to execute repetitively using the cron daemon Linux+ Guide to Linux Certification, 2e

Linux+ Guide to Linux Certification, 2e 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+ Guide to Linux Certification, 2e

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+ Guide to Linux Certification, 2e

Linux Processes (continued) Figure 10-1: Parent and child processes Linux+ Guide to Linux Certification, 2e

Linux Processes (continued) Figure 10-2: Process genealogy Linux+ Guide to Linux Certification, 2e

Linux+ Guide to Linux Certification, 2e 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 Linux+ Guide to Linux Certification, 2e

Viewing Processes (continued) Process state: Current processor state of process Most processes sleeping (S) or running (R) Zombie process: Process finished, but parent has not released PID Defunct process Process state is Z Linux+ Guide to Linux Certification, 2e

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 Linux+ Guide to Linux Certification, 2e

Viewing Processes (continued) Table 10-1: Common options to the ps command Linux+ Guide to Linux Certification, 2e

Viewing Processes (continued) top command: Displays interactive screen listing processes Organized by processor time Processes using most processor time listed first Rogue process: Faulty process Consumes excessive system resources top command can be used to change PRI or kill processes Linux+ Guide to Linux Certification, 2e

Linux+ Guide to Linux Certification, 2e 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 Linux+ Guide to Linux Certification, 2e

Killing Processes (continued) Table 10-2: Common administrative kill signals Linux+ Guide to Linux Certification, 2e

Killing Processes (continued) Trapping: Ignore a kill signal Kill signals sent to processes having children Parent process terminates all child processes before terminating itself Often necessary to kill parent process in order to kill zombie processes Linux+ Guide to Linux Certification, 2e

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 Linux+ Guide to Linux Certification, 2e

Linux+ Guide to Linux Certification, 2e Process Execution Three main types of executable commands Binary programs Shell scripts Shell functions Linux+ Guide to Linux Certification, 2e

Process Execution (continued) Forking: Act of creating new BASH shell child process from a parent Fork function in BASH shell Subshell executes program or shell script using exec function Original shell waits for subshell to complete When done, subshell kills itself Control returns to original shell Linux+ Guide to Linux Certification, 2e

Process Execution (continued) Figure 10-3: Process forking Linux+ Guide to Linux Certification, 2e

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 Linux+ Guide to Linux Certification, 2e

Running Processes in the Background (continued) jobs command: Lists background processes running in current shell foreground (fg) command: Run a background process in foreground Foreground process may be paused with ctrl Z background (bg) command: Run a foreground process in background Linux+ Guide to Linux Certification, 2e

Running Processes in the Background (continued) Jobs command marks two most recent background processes Commands operate on most recent process, by default Linux+ Guide to Linux Certification, 2e

Linux+ Guide to Linux Certification, 2e Process Priorities Time slice: Amount of time a process is given on a CPU More time slices mean more execution time on CPU Executes faster Usually measured in milliseconds Linux+ Guide to Linux Certification, 2e

Process Priorities (continued) PRI dictates number of time slices a process gets Cannot change PRI value directly Set NI to indirectly affect priority Processes start with NI of 0 nice command: Change a process’s priority as it starts Linux+ Guide to Linux Certification, 2e

Process Priorities (continued) Figure 10-4: The nice value scale Linux+ Guide to Linux Certification, 2e

Process Priorities (continued) renice command: Alter NI of a process after it is running Only root user may change NI to a negative value May also change NI of running processes using top utility Linux+ Guide to Linux Certification, 2e

Linux+ Guide to Linux Certification, 2e Scheduling Commands at daemon (atd): System daemon that executes tasks at a future time cron daemon (crond): System daemon that executes tasks repetitively in the future Linux+ Guide to Linux Certification, 2e

Scheduling Commands with atd at command: Schedule commands and tasks to run at a preset time –l option: View a list of scheduled jobs Regular users see only their own jobs –c option: View system environment at scheduling time –d option: Delete a job –f option: Run scheduled jobs from shell script Linux+ Guide to Linux Certification, 2e

Scheduling Commands with atd (continued) atq command: Alternative method to view scheduled jobs at daemon uses current shell’s environment for execution Shell environment and scheduled commands stored in /var/spool/at If stdout of scheduled command has not been redirected to file, mailed to user Linux+ Guide to Linux Certification, 2e

Scheduling Commands with atd (continued) Table 10-3: Common at commands Linux+ Guide to Linux Certification, 2e

Scheduling Commands with atd (continued) /etc/at.allow: File listing all users able to use at command /etc/at.deny: File listing all the users not able to use at command On Fedora Linux systems, no /etc/at.allow file exists Empty by default All users allowed to use at daemon Linux+ Guide to Linux Certification, 2e

Scheduling Commands with crond Cron tables: Files specifying tasks for cron daemon to run Specify when commands should be executed User and system cron tables Six fields separated by space or tab characters Linux+ Guide to Linux Certification, 2e

Scheduling Commands with crond (continued) Figure 10-5: User cron table format Linux+ Guide to Linux Certification, 2e

Scheduling Commands with crond (continued) Figure 10-6: Sample user cron table entry Linux+ Guide to Linux Certification, 2e

Scheduling Commands with crond (continued) /var/spool/cron: Stores user cron tables /etc/crontab: Contains default system cron table /etc/cron.d: Contains additional system cron tables Linux+ Guide to Linux Certification, 2e

Linux+ Guide to Linux Certification, 2e User Cron Tables /etc/cron.allow: Lists users able to use cron command /etc/cron.deny: Lists users not able to access cron command Linux+ Guide to Linux Certification, 2e

User Cron Tables (continued) crontab command: View and edit user cron tables –e option: Edit cron tables in vi editor –l option: List a user cron table –r option: Remove all scheduled jobs Linux+ Guide to Linux Certification, 2e

Linux+ Guide to Linux Certification, 2e The System Cron Table System maintenance, backups, and CPU-intensive tasks often scheduled for non-business hours Often scheduled by cron daemon Entries in system cron table (/etc/crontable) Linux+ Guide to Linux Certification, 2e

The System Cron Table (continued) Initial section of cron table specifies execution environment Remainder similar to user cron table entries Sixth field specifies who to run command as Remaining fields represent command to run run-parts command: Execute all files in a directory Linux+ Guide to Linux Certification, 2e