Lesson 10-Controlling User Processes. Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.

Slides:



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

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.
CIS 118 – Intro to UNIX Shells 1. 2 What is a shell? Bourne shell – Developed by Steve Bourne at AT&T Korn shell – Developed by David Korn at AT&T C-shell.
A Practical Guide to Fedora and Red Hat Enterprise Linux Unit 4: More Command Line Interface (CLI) Chapter 7: The Linux Shell By Fred R. McClurg Linux.
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.
Processes and Job Control. Foreground and Background (1)  Unix is a multi-tasking operating system –some of these tasks are being done by other users.
Introduction to Unix – CS 21 Lecture 10. Lecture Overview Midterm questions Jobs and processes description The foreground and background Controlling jobs.
1 Introduction to UNIX Ke Liu
1 © 2001 John Urrutia. All rights reserved. Chapter 5 The Shell Overview.
1 The Shell and some useful administrative Unix Commands How Unix works along with some additional, useful administrative Unix commands you might need.
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.
CS 497C – Introduction to UNIX Lecture 26: - The Process Chin-Chih Chang
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.
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
CS 497C – Introduction to UNIX Lecture 1: Getting Started Chin-Chih Chang
5 UNIX Processes. Introduction  Processes  How to list them  How to terminate them  Process priorities  Scheduling jobs  Signals.
1 The Shell and some useful administrative Unix Commands How Unix works along with some additional, useful administrative Unix commands you might need.
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.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
UNIX Unbounded 5th Edition Amir Afzal Chapter 3 Getting Started
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).
The Shell Chapter 7. Overview The Command Line Standard IO Redirection Pipes Running a Program in the Background Killing (a process!)
Linux+ Guide to Linux Certification, Third Edition
Additional UNIX Commands. 222 Lecture Overview  Multiple commands and job control  More useful UNIX utilities.
Linux Operations and Administration
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
Process Control. Module 11 Process Control ♦ Introduction ► A process is a running occurrence of a program, including all variables and other conditions.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
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
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
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,
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
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,
Introduction to Programming Using C An Introduction to Operating Systems.
1 Lecture 6 Introduction to Process Management COP 3353 Introduction to UNIX.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
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.
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.
The Process CIS 370, Fall 2009 CIS UMassD. The notion of a process In UNIX a process is an instance of a program in execution A job or a task Each process.
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.
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.
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.
Lesson 8-Specifying Instructions to the Shell. Overview An overview of shell. Execution of commands in a shell. Shell command-line expansion. Customizing.
Process Relationships Chien-Chung Shen CIS/UD
IT244 - Introduction to Linux / Unix Instructor: Bo Sheng
...looking a bit closer under the hood
Hands On UNIX AfNOG 2010 Kigali, Rwanda
Hands On UNIX AfNOG X Cairo, Egypt
The Linux Command Line Chapter 10
CHAPTER 13 Processes.
CSC 140: Introduction to IT
Linux Shell Script Programming
Lab 6: Process Management
Lecture 6 Introduction to Process Management
Presentation transcript:

Lesson 10-Controlling User Processes

Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.

Managing and Processing Processes Every running program is a separate entity, called a process. A process consists of several components working together, including the code, data, CPU activity, memory, input, output, and error handling.

Managing and Processing Processes Each process involves reading instructions, accessing computer memory, reading from input, evaluating arguments, performing calculations, and writing to output. Every process on the system has its own unique process ID number.

Managing and Processing Processes Obtaining detailed information on system processes. Identifying processes connected to a terminal. Starting a new shell process. Obtaining detailed data about user processes.

Genealogy of processes. Ending foreground processes. Ending background processes. Terminating a process that is not responding. Managing and Processing Processes

Obtaining Detailed Information on System Processes The “ps –aux” and the “ps –ef” commands can be used to get a list of all processes currently running on the system. The “ps –u $USER” command can be used to list only the processes owned by a particular user. The “ps –u root” command can be used to list the processes that are started when the system is booted up, and that are owned by the root user.

Identifying Processes Connected to a Terminal User processes must be informed of the port to which they are attached. The “tty” command can be used to determine the terminal port used by a user. The “ps –t port” command can be used to display the running processes, the shell, a process running sleep, and the process running the ps utility.

Identifying Processes Connected to a Terminal Output of ps Utility

Identifying Processes Connected to a Terminal PID – The PID, called the Process IDentification number, is a unique number assigned to each process when it gets created. CPU – It refers to the CPU time consumed by a process. CMD – The command mode contains the names of the utilities associated with each running process.

Starting a New Shell Process The “sh” command is used to start a child shell. The “echo $$” command can be used to obtain the PID of the current shell. The “exit” command or the CTRL-D keys can be used to exit the child shell.

Obtaining Detailed Data about User Processes Output of ps –l Command

Obtaining Detailed Data about User Processes Flags (F) – This field contains a number indicating the Flags or options set for a process. State (S) – It indicates the state of the process, which includes sleeping (S), running (R), idle (I), and traced (T). Size (SZ) – It contains a number indicating the size of the process in memory. Command (CMD) – It refers to the actual command being run by the process.

Genealogy of Processes Processes inherit data from their parent process. Every utility or executable file name that is typed is executed by a process that is a child of the shell process. The child process inherits data such as tty, user ID, and the current directory from the parent process.

Ending Foreground Processes The “stty –a” command can be used to display the settings for a system. The “echo $?” and the “echo $status” commands can be used to ask for the exit status sent by the process running sleep to the shell. The “echo $?” command is used by the sh and the recent csh family shells.

Ending Foreground Processes The “echo $status” command is used by the older csh family of shells. The CTRL-D key is used to mark the end-of-file character, while the CTRL-C key is used to interrupt a process. The CTRL-D key displays an output, but the CTRL-C does not generate any output.

Ending Foreground Processes The keyboard signal “quit” can be used to stop a foreground process. The “CTRL-\” keys can also be used to quit a process. The quit signal destroys the process and sometimes makes a copy of the CPU memory associated with the process at the time of exit. The copy is called a core file.

Ending Background Processes The “kill” command can be used to terminate a process running in the background. The command requires the PID of the process as the second argument. The “kill –l” command can be used to list all the kill signals available for the current system.

Ending Background Processes Listing of All Signals

Terminating a Process that is not Responding The following tasks should be carried out to terminate a process: A new terminal should be started. The current terminal port should be identified at the new login or terminal. All the processes should be listed. The PID of the particular process should be identified and the ‘kill’ command should be used to terminate it.

Managing Jobs A command-line that instructs the shell to start several processes with the output from the first connecting to the second and so on, is called a job. All modern shells allow users to start, suspend, make active, and kill the processes associated with a job.

Managing Jobs Suspending a job. Identifying the most recent job. Killing a particular job.

Suspending a Job The “stty –a” command is used to describe a list of CTRL key settings used by the terminal and the shell for communication. The CTRL-Z key is used to suspend a job. The suspended job does not use the system memory. The “fg” command is used to bring the last suspended job into the foreground.

Suspending a Job The “jobs” program lists all background and suspended jobs and their status. The “jobs” command is a shell built-in command. A job’s output is divided into four columns – the job number, the order, the status, and the command being executed.

Identifying the Most Recent Job The “fg %+” is used to bring the most recently suspended job to the foreground. The “fg %-” is used to bring the second most recently suspended job to the foreground.

Identifying the Most Recent Job The job number can also be used to get a job to the foreground. For example, “fg %2”, where %2 specifies the job with the job number 2. The job name can also be used to get a job to the foreground.

Killing a Job The “kill %+” command is used to kill the most recent job in the job list. The job number can also be passed as an argument to kill that particular job. The job name can also be passed as an argument to kill a job. Care should be taken while killing a job. We must not kill wrong jobs.

Exiting/Quitting When Jobs Have Been Stopped Job control is a very useful method of managing processes. UNIX job control provides a method of warning the users of stopped or running background jobs when an attempt is made to log out or exit a process. It logs out without warning when we issue the same command again, resulting in loss of unsaved data.

Summary Programs running in a system are executed by a process that reads the appropriate code and accomplishes the tasks. All the processes have their own unique PID, the PID of their parent, an owner, group, memory, code, input, output, error, and their tty port.

A command-line that consists of one process or a series of processes connected by pipes is called a job. The kill command terminates processes identified by either their process ID or job number/job name. Summary