Managing Processes CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.

Slides:



Advertisements
Similar presentations
June 1, 1999Foreground/Background Processing1 Introduction to UNIX H. Foreground/Background Processing.
Advertisements

Basic Unix system administration
Chapter 5 Controlling Processes Xiaoli Jiao 6/8/99.
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.
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.
Shells and Processes Bryce Boe 2012/08/08 CS32, Summer 2012 B.
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.
Processes & Daemons Chapter IV / Part III. Commands Internal commands: alias, cd, echo, pwd, time External commands, code is in a file: grep, ls, more.
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.
UNIX System Administration Handbook Chapter 4. Controlling Processes 3 rd Edition Evi Nemeth et al. Li Song CMSC691X Summer 2002.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Linux in More Detail Shirley Moore CPS5401 August 29,
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Chapter 4 UNIX Common Shells Commands By C. Shing ITEC Dept Radford University.
Linux+ Guide to Linux Certification, Third Edition
Guide to Linux Installation and Administration, 2e1 Chapter 10 Managing System Resources.
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.
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.
Guide To UNIX Using Linux Third Edition Chapter 8: Exploring the UNIX/Linux Utilities.
Hands On UNIX II Dorcas Muthoni. Processes A running instance of a program is called a "process" Identified by a numeric process id (pid)‏  unique while.
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.
EMT 2390L Lecture 5 Dr. Reyes Reference: The Linux Command Line, W.E. Shotts.
Silberschatz, Galvin and Gagne  Operating System Concepts Process Concept An operating system executes a variety of programs:  Batch system.
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,
1 Lecture 6 Introduction to Process Management COP 3353 Introduction to UNIX.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Linux Commands C151 Multi-User Operating Systems.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
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.
System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:
ACCESS CONTROL. Components of a Process  Address space  Set of data structures within the kernel - process’s address space map - current status - execution.
Linux Processes Last Update Copyright Kenneth M. Chipps Ph.D. 1.
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.
PROCESSES We will learn more about: ¨ Multi-user processing and multi −tasking ¨ Multi-user processing and multi −tasking ¨ Process types ¨ Process types.
Unix System Administration Controlling Processes Chapter 5.
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.
Processes Todd Kelley CST8207 – Todd Kelley1.
Guide to Parallel Operating Systems with Windows 7 and Linux Chapter 10 Operating System Management.
Linux Basics Part 1 OSU Picture © Greg Keene. Introductions Lance Albertson Greg Lund-Chaix source:
SYSTEM ADMINISTRATION PART I by İlker Korkmaz and Kaya Oğuz
Rootly Powers and Controlling Processes
Chapter 11 – Processes and Services
Processes A process is a running program.
The Linux Command Line Chapter 10
CHAPTER 8 ( , ) John Carelli, Instructor Kutztown University
CHAPTER 13 Processes.
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
Controlling Processes
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Processes – Part I.
Process Management and System Monitoring
Process Description and Control in Unix
Process Description and Control in Unix
Access Control and Audit
Lecture 6 Introduction to Process Management
Presentation transcript:

Managing Processes CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University

Section Overview UNIX Processes Running programs Monitoring processes Killing processes

References CQU System Administration Course Chapter 5

Programs & Processes Program – file which can be run Binary executables Shell scripts Process – A running program Loaded in physical memory Stored in virtual memory (swap)

Virtual Memory Extends amount of physical memory UNIX Size of swap = amount of usable memory Physical memory (RAM) mirrored in swap Linux: Memory = swap + RAM Swapping Moving pages to and from memory Page – block (unit) of RAM

Swap Allocation BSD UNIX: RAM: Swap: AT&T SVR4/Linux: RAM: Swap: Which works better when? Windows: C:\pagefile.sys (Grows as needed)

Windows pagefile.sys Settings

Wait Done Process Lifecycle NewReady Admitted SchedulerDispatches Interrupt Run Exit I/ORequest I/O Completed

Process Components Sleeping Stopped Address space map Status Owner Blocked Signals Priority Resources used Running Runable Zombie

Process Ownership Real User (User starting the process) UID: User ID Number GID: Group ID Number Effective User (Permissions for process) EUID: Effective User ID Number EGID: Effective Group ID Number

Process Lifecycle Parent process “forks” a child Process identifiers PID: Process ID Number PPID: Parent Process ID Number Child finishes Sends status message to parent Zombie – waits for parent acknowledgment Orphan – init (PID 1) becomes parent

Running a command Type in the command name Shell searched for the command If found, shell “forks” the command How is the command found? PATH environment variable which – Displays full path to command Beware of “.” in your PATH

Background Jobs Foreground process Returns control to shell after it finished Most common usage Background process Returns control to shell immediately “&” typed after command name Runs concurrently

Daemons Special programs which performs a some task without intervention Started in the background (often at system startup) Name of most ends in ‘d’ “Daemon” is actually a much older form of “demon”; daemons have no particular bias towards good or evil, but rather serve to help define a person's character or personality. ~Evi Nemeth

fg, bg, & jobs Can switch between modes Send signal to stop a process Commands fg – Run process in foreground bg – Run process in background jobs – List shell child processes

Signals Used to communicate with processes Terminal signals - Terminate process - Stop (suspend) process kill [-signal] pid Sends signal to process PID Default is to terminate the process

Common Signals #NameDescription 1HUPHangup 2INTInterrupt 3QUITQuit 9KILL 15TERMSoftware Termination STOPStop

Process Priority How much CPU time granted relative to other processes nice – Sets the priority value at start renice – Changes priority Ranges SystemRange Solaris0 to 39 RedHat-20 to 20

System Load Average number of “Runnable” processes Measure of how busy the system is Performance deteriorates at loads of 6+ Good for creating a baseline uptime – Load average (5, 10, 15 minutes)

Monitoring Processes (Linux) ps BSD – Sorts by %CPU Usage SVR4 – Sorts by PID top Full terminal screen display Sortable Can kill and renice processes

Information from ps PID USER PRI/NI - Priority/Nice level RSS/SIZE - Resident/Total Memory used STAT - Process State %CPU/%MEM - % of System CPU/Memory TIME - CPU time used Command

/proc Filesystem Pseudo filesystem Interface to memory-related kernel data structures Each PID has it’s own directory cwd – Symlink to current working directory exe – Symlink to program cmdline – command line options environ – command line environment stat – process status

Monitoring Processes (Windows) Task Manager Graphical viewer Can also sort or kill processes tasklist Command line Viewer Can view associated dll files wmic process [options] Can view, start, and kill processes Remote connection capabilities

SysInternals - Process Tools Command Line tools Pslist – display running processes Pskill – Kill processes by name or PID Psexec – Run programs remotely GUI Tools Procmon – Detailed process info RAMMap – View RAM usage VMMap – View Virtual Memory usage

Runaway Processes Can eat up your resources Lists users and PIDs accessing a resource fuser lsof Kill the process and clean up

Elevating Access Principle of Least Privilege su [-] - “Switch user” Requires user password if not run as root ‘-’ runs a subshell owned by user Microsoft runas (Automatic Popup Win7) Sudo – Run programs as superuser /etc/sudoers – who can run what visudo – Editor for /etc/sudoers sudo – Used to run commands as root Windows version available