Linux Processes Last Update 2012.08.24 1.3.0 Copyright 2000-2012 Kenneth M. Chipps Ph.D. www.chipps.com 1.

Slides:



Advertisements
Similar presentations
Shell Script Assignment 1.
Advertisements

Microsoft Virtualization Last Update Copyright 2011 Kenneth M. Chipps Ph.D.
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.
Lesson 10-Controlling User Processes. Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
CS 497C – Introduction to UNIX Lecture 26: - The Process Chin-Chih Chang
Controlling Processes & Periodic Processes WeeSan Lee
Operating Systems Recitation 5, April 21-22, 2002 slide 13 updated April 28 th.
Linux+ Guide to Linux Certification, Second Edition
Processes & Daemons Chapter IV / Part III. Commands Internal commands: alias, cd, echo, pwd, time External commands, code is in a file: grep, ls, more.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 16AP. 1Winter Quarter UNIX Process Management.
Static Routing Last Update Copyright Kenneth M. Chipps Ph.D.
Capturing Wireless Frames With A NIC Last Update Copyright 2012 Kenneth M. Chipps Ph.D.
Hjemmeeksamen 1 INF3190. Oppgave Develop a monitoring/administration tool which allows an administrator to use a client to monitor all processes running.
UNIX System Administration Handbook Chapter 4. Controlling Processes 3 rd Edition Evi Nemeth et al. Li Song CMSC691X Summer 2002.
Linux Filesystem Management
Slow Web Site Problem Analysis Last Update Copyright 2013 Kenneth M. Chipps Ph.D. 1.
Offline Performance Monitoring for Linux Abhishek Shukla.
Linux Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Chapter 8. Disks and Filesystems. Ordinary Files u What is a file? –a container for ordered data –persistent (stays around) and accessible by name u Unix.
Today’s Topics Introducing process: the basic mechanism for concurrent programming –Process management related system calls Process creation Process termination.
Managing Processes CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
Linux+ Guide to Linux Certification, Third Edition
Packet Over SONET Interface Last Update Copyright 2011 Kenneth M. Chipps Ph.D. 1.
Guide to Linux Installation and Administration, 2e1 Chapter 10 Managing System Resources.
Chapter Eight Exploring the UNIX Utilities. 2 Lesson A Using the UNIX Utilities.
Guide to Linux Installation and Administration, 2e1 Chapter 7 The Role of the System Administrator.
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.
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.
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.
Linux+ Guide to Linux Certification Chapter Eleven Managing Linux Processes.
Lab 3 + Using the Terminal 1. "Under Linux there are GUIs (graphical user interfaces). where you can point and click and drag, and hopefully get work.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Linux Commands C151 Multi-User Operating Systems.
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.
– Introduction to the Shell 1/21/2016 Introduction to the Shell – Session Introduction to the Shell – Session 3 · Job control · Start,
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop VI Scheduling & Process Management Professional.
ACCESS CONTROL. Components of a Process  Address space  Set of data structures within the kernel - process’s address space map - current status - execution.
Linux Stuff Last Update Copyright 2014 Kenneth M. Chipps Ph.D. 1.
Chapter Eight Exploring the UNIX Utilities. 2 Lesson A Using the UNIX Utilities.
CSC414 “Introduction to UNIX/ Linux” Lecture 3
Oracle Virtualization Last Update Copyright 2012 Kenneth M. Chipps Ph.D.
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.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Guide to Parallel Operating Systems with Windows 7 and Linux Chapter 10 Operating System Management.
Operating Systems. Operating System Every general-purpose computer must have an operating system to run other programs. Operating systems perform basic.
System Administration Performance Monitoring For a server, it is crucial to monitor the health of the machine You need not only real time data collection.
How to Build a LAN Last Update Copyright 2007 Kenneth M. Chipps PhD 1.
Linux203Training Module System Mgmt.
Rootly Powers and Controlling Processes
Proc File System Sadi Evren SEKER.
C151 Multi-User Operating Systems
Shell Script Assignment 1.
Using the Terminal Lab 3+.
The Linux Command Line Chapter 10
COP 4343 Unix System Administration
Controlling Processes
Lab 6: Process Management
Linux Filesystem Management
Process Management and System Monitoring
Presentation transcript:

Linux Processes Last Update Copyright Kenneth M. Chipps Ph.D. 1

Objectives of This Section Learn –What processes are in Linux –How to monitor processes Copyright Kenneth M. Chipps Ph.D. 2

Processes Each task that the kernel is working on is assigned a process id or PID Each process id has a parent process or PPID The parent of all processes is init or PID 1 Init is responsible for creating and managing processes Copyright Kenneth M. Chipps Ph.D. 3

Processes Recall that everything in Linux is a file Whether it is or it isn’t Most people think of a file as being something that is physically stored on a disk magnetically In Linux processes appear as files, but with a file length of zero Copyright Kenneth M. Chipps Ph.D. 4

Processes This is relevant in that processes running on a Linux system are monitored using these files Copyright Kenneth M. Chipps Ph.D. 5

File Locations These process pseudo files are stored in –/proc Under /proc are several directories also with zero length Each of these numerically named directories corresponds to the process IDs of a particular process running on the system Copyright Kenneth M. Chipps Ph.D. 6

File Locations Such as –PID –1 –2 –3 –4 –5 –6 –And so on Copyright Kenneth M. Chipps Ph.D. 7

File Locations The corresponding directories will look like this –dr-xr-xr-x 3 root root 0 Feb 17 17:26 1 –dr-xr-xr-x 3 root root 0 Feb 17 17:26 16 –dr-xr-xr-x 3 root root 0 Feb 17 17:26 2 –dr-xr-xr-x 3 root root 0 Feb 17 17:26 3 –dr-xr-xr-x 3 root root 0 Feb 17 17:26 4 –dr-xr-xr-x 3 root root 0 Feb 17 17:26 5 –dr-xr-xr-x 3 root root 0 Feb 17 17:26 6 –And so on Copyright Kenneth M. Chipps Ph.D. 8

File Locations Within these directories will be a list of files that show some information about the process the directory represents For example Copyright Kenneth M. Chipps Ph.D. 9

File Locations 9166]$ ls -l total 0 -r--r--r-- 1 shs shs 0 Feb 17 17:31 cmdline lrwxrwxrwx 1 shs shs 0 Feb 17 17:31 cwd -> /home/shs -r shs shs 0 Feb 17 17:31 environ lrwxrwxrwx 1 shs shs 0 Feb 17 17:31 exe - > /usr/bin/gnome-terminal dr-x shs shs 0 Feb 17 17:31 fd -r--r--r-- 1 shs shs 0 Feb 17 17:31 maps -rw shs shs 0 Feb 17 17:31 mem lrwxrwxrwx 1 shs shs 0 Feb 17 17:31 root -> / -r--r--r-- 1 shs shs 0 Feb 17 17:31 stat -r--r--r-- 1 shs shs 0 Feb 17 17:31 statm -r--r--r-- 1 shs shs 0 Feb 17 17:31 status Copyright Kenneth M. Chipps Ph.D. 10

Information on the Process Each of these files contains information on the process that the directory represents Using this information is not straight forward This is more a function that a developer might do, rather than a system administrator But it is there if you wish to look at it Copyright Kenneth M. Chipps Ph.D. 11

ps command This command produces a static list of the processes running at that instant In other words, it is a snapshot of what was running when the command was invoked To see a constantly updated list of running processes, use the top program Copyright Kenneth M. Chipps Ph.D. 12

ps command ps –ef –To display all processes with extended information ps ax –To list of current system processes, including processes owned by other users ps aux –Displays the owner of the processes along with the processes Copyright Kenneth M. Chipps Ph.D. 13

lsof Let’s say top shows an unusual program using a bunch of cpu resources ps shows the program’s command line name to be something that the find command cannot locate This may mean someone is running something that they are trying to hide In such a case lsof may be more useful Run it against the pid Copyright Kenneth M. Chipps Ph.D. 14

lsof As in –lsof –p The output of this command will show in the first column the real name of the program associated with the PID Checking the output produced may show what the program has been doing Copyright Kenneth M. Chipps Ph.D. 15

kill command Used to terminate a program from outside of the program To use it –At the command line search for the process causing the problem using grep Such as –ps ax | grep nameoftheprogram –This will show something like 7790 pts/1 S 1:25 /usr/lib/nameoftheprogram Copyright Kenneth M. Chipps Ph.D. 16

kill command –What is needed is the process number This is the number in the first column when the ps command is run this way In this case –7790 –Run kill 7790 If this doesn't do it, the parent process or PPID may need to be killed Copyright Kenneth M. Chipps Ph.D. 17

kill command To find it run –ps axl | grep nameoftheprogram When the ps command is run in this form, the PPID is the number in the fourth column Copyright Kenneth M. Chipps Ph.D. 18

killall command With this command all that is needed is the name of the program to be killed As in –killall httpd It does not work with PIDs Copyright Kenneth M. Chipps Ph.D. 19

top command The top command displays the currently running processes, as well as important information about them including their memory and CPU usage The list is both real-time and interactive Copyright Kenneth M. Chipps Ph.D. 20

top command Copyright Kenneth M. Chipps Ph.D. 21

Gnome System Monitor The Gnome GUI has a program similar to top –Main Menu Programs –System »System monitor Copyright Kenneth M. Chipps Ph.D. 22

Gnome System Monitor Copyright Kenneth M. Chipps Ph.D. 23