UNIX System Administration Handbook Chapter 4. Controlling Processes 3 rd Edition Evi Nemeth et al. Li Song CMSC691X Summer 2002.

Slides:



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

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.
Zombie and orphan processes. Zombie process (from wikipedia) When a process ends, all of the memory and resources associated with it are deallocated.
Lesson 10-Controlling User Processes. Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.
Operating Systems Yasir Kiani. 20-Sep Agenda for Today Review of previous lecture Use of FIFOs in a program Example code Process management commands.
CS 497C – Introduction to UNIX Lecture 26: - The Process Chin-Chih Chang
UNIX Process Control Bach 7 Operating Systems Course Hebrew University Spring 2007.
Controlling Processes & Periodic Processes WeeSan Lee
CS 311 – Lecture 14 Outline Process management system calls Introduction System calls  fork()  getpid()  getppid()  wait()  exit() Orphan process.
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.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
Process Scheduling. Process The activation of a program. Can have multiple processes of a program Entities associated with a process –Instruction pointer,
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
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.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Process in Unix, Linux, and Windows CS-3013 A-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
Introduction to Processes CS Intoduction to Operating Systems.
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
Guide to Linux Installation and Administration, 2e1 Chapter 10 Managing System Resources.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
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.
Scis.regis.edu ● CS 468: Advanced UNIX Class 5 Dr. Jesús Borrego Regis University 1.
Linux Processes Travis Willey Jeff Mihalik. What is a process? A process is a program in execution A process includes: –program counter –stack –data section.
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  process  process creation/termination  context  process control block (PCB)  context switch  5-state process model  process scheduling short/medium/long.
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.
1 itec 400 Unix Processes George Vaughan Franklin University.
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
Direct memory access. IO Command includes: buffer address buffer length read or write dada position in disk When IO complete, DMA sends an interrupt request.
1 Lecture 19: Unix signals and Terminal management n what is a signal n signal handling u kernel u user n signal generation n signal example usage n terminal.
Unix System Administration Controlling Processes Chapter 5.
Process Manipulation. Process Manipulation in UNIX Basic process manipulation: creation, program loading, exiting, … fork(), exec(), wait(), exit() Process.
A process is a program in execution A running system consists of multiple processes – OS processes Processes started by the OS to do “system things” –
Process Management Process Concept Why only the global variables?
Linux 202 Training Module Program and Process.
Unix Process Management
Processes A process is a running program.
Processes in Unix, Linux, and Windows
KERNEL ARCHITECTURE.
Operating Systems Lecture 11.
Structure of Processes
Processes in Unix, Linux, and Windows
Processes in Unix, Linux, and Windows
CHAPTER 8 ( , ) John Carelli, Instructor Kutztown University
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
Controlling Processes
Chapter 4 Controlling Processes
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Processes in Unix, Linux, and Windows
Process Description and Control in Unix
Process Description and Control in Unix
Presentation transcript:

UNIX System Administration Handbook Chapter 4. Controlling Processes 3 rd Edition Evi Nemeth et al. Li Song CMSC691X Summer 2002

Process A running program Manage and monitor a program’s use of memory, processor time, and I/O resources

Components of a Process Address space segments of program code variables stack extra information Internal data structure address space map current status execution priority signal mask owner

Parameters PID: process ID number PPID: parent PID UID/EUID: real and effective user ID GID/EGID: real and effective group ID Niceness Control terminal

Life Cycle of a Process When system boots, kernel creates several processes autonomously, e.g. init, which always has PID 1. All processes except those kernel creates are descendants of init.

Life Cycle of A Process-- Contd. An existing process clones itself using system call fork to create a new process. The new process use exec system calls to begin execution of a new program. When a process completes, it calls a routine named _exit to notify the kernel that it is ready to die. Parent process calls wait to receive a copy of the child’s exit code. init is supposed to accept orphaned processes and perform the wait.

Process States Runnable: the process can be executed Sleeping: waiting for some resources Zombie: trying to die Stopped: suspended(not allowed to execute

PS: Monitor Process ps : processes status --“snapshot” ps aux, ps lax - Red Hat and FreeBSD ps ef, ps elf – Solaris and HP-UX top : display information about the top CPU processes, update every 10 sec -- a dynamically updated “big picture”

lsong1]$ ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root ? S 10:33 0:04 init [3] root ? SW 10:33 0:00 [keventd] root ? SW 10:33 0:00 [kapmd] root ? S 10:35 0:00 crond wnn ? S 10:35 0:00 /usr/bin/tserver xfs ? S 10:35 0:00 xfs -droppriv -da root ? S 10:35 0:00 anacron daemon ? S 10:35 0:00 /usr/sbin/atd root tty2 S 10:35 0:00 /sbin/mingetty tt lsong ? S 10:39 0:00 kdeinit: kwrited lsong ? S 10:39 0:00 korgac --miniicon lsong ? S 10:39 0:00 kalarmd -session lsong ? S 10:39 0:00 kdeinit: kio_file lsong ? S 10:39 0:00 autorun -l --inte lsong ? S 10:39 0:00 kdeinit: kio_file lsong ? S 10:39 0:00 kdeinit: kio_file lsong ? S 10:40 0:00 kdeinit: konsole lsong pts/1 S 10:40 0:00 /bin/bash lsong pts/1 R 10:40 0:00 ps aux

10:53am up 19 min, 4 users, load average: 0.01, 0.25, processes: 66 sleeping, 4 running, 0 zombie, 0 stopped CPU states: 7.6% user, 5.0% system, 0.0% nice, 87.2% idle Mem: K av, K used, 6968K free, 0K shrd, 22376K buff Swap: K av, 0K used, K free K cached PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND lsong R :00 top 1452 root M 4680 R :09 X 1570 lsong M R :05 kdeinit 1 root S :04 init 5 root SW :00 kswapd 1400 root S :00 login 1401 lsong S :00 bash 1440 lsong S :00 startx 1451 lsong S :00 xinit 1456 lsong S :00 startkde 1911 root S :00 kppp 1912 root S :00 kppp 1914 root S :00 kdeinit 1917 root S :00 kdeinit 1920 root S :00 kdeinit 1922 root S :00 kdeinit 1928 root S :00 pppd 1947 lsong M 9596 R :08 netscape-commun 2011 lsong S :00 netscape-commun lsong S :00 kdeinit

Nice and Renice A numeric hint about how the process should be treated in relationship to other processes. High nice value--low priority Low/negative nice value--high priority nice : set “nice value” at the process creation. renice : change the value during process execution. Child process inherits the nice value of its parent. Owner of the process can only increase its nice value but cannot lower it.

Signals Process-level interrupt requests. When a signal is received: Handler is called if designated— ”catching” signal Default action by kernel: i.e. terminate, generate a core dump Program can ignore and block signals.

Signals—contd. Signals should know: HUP, INT, QUIT, KILL, TERM, STOP, TSTP, CONT… KILL and STOP cannot be caught, blocked, or ignored.

KILL: Send Signals Syntax : Kill [-signal] pid Signal is the number of the signal to be sent e.g. KILL (9), TERM(15) Kill pid defaults to sending TERM(15) Kill -9 pid guarantee the process will die

Runaway Processes User processes use up excessive amounts of a system resource (CPU time, disk space) System processes that suddenly exhibit wild behavior Looking at ps output Legitimate-renice to lower priority Destructive-STOP