Agenda Managing Processes (Jobs) Command Grouping Running jobs in background (bg) Bringing jobs to foreground (fg), Background job status (jobs) Suspending.

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.
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.
Essential System Administration 3rd Edition Chapter 2 The Unix Way(Cont.) University Of Palestine.
Job Control Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
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.
A Practical Guide to Red Hat ® Linux ®, Third Edition. © 2007 Mark G. Sobell, Prentice Hall,
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.
CS 497C – Introduction to UNIX Lecture 26: - The Process Chin-Chih Chang
Linux+ Guide to Linux Certification, Second Edition
Now, return to the Unix Unix shells: Subshells--- Variable---1. Local 2. Environmental.
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.
Processes & Daemons Chapter IV / Part III. Commands Internal commands: alias, cd, echo, pwd, time External commands, code is in a file: grep, ls, more.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
CTEC 1863 – Operating Systems Shell Scripting. CTEC F2 Overview How shell works Command line parameters –Shift command Variables –Including.
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.
Linux in More Detail Shirley Moore CPS5401 August 29,
Lesson 1. PC vs. Multi-user System  Personal Computer – each user gets his/her own processor (or multicore processor).  Multi-user system – The processor,
Operating Systems Yasir Kiani. 22-Sep Agenda for Today Review of previous lecture Process management commands: bg, fg, ^Z, jobs, ^C, kill Thread.
UNIX command line. In this module you will learn: What is the computer shell What is the command line interface What is the directory tree Some UNIX commands.
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.
Introduction to Linux OS (IV) AUBG ICoSCIS Team Prof. Volin Karagiozov March, 09 – 10, 2013 SWU, Blagoevgrad.
1 Day 10 Process Control. 2 Running a program in the background Here’s a trick: You can actually log onto a UNIX server as many times as you want Try.
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,
Agenda Getting Started: Using Unix Unix Structure / Features Elements of the Unix Philosophy Unix Command Structure Command Line Editing Online Unix Command.
Linux+ Guide to Linux Certification, Second Edition Chapter 10 Managing Linux Processes.
RH030 Linux Computing Essentials
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.
1 Lecture 6 Introduction to Process Management COP 3353 Introduction to UNIX.
1 © 2000 John Urrutia. All rights reserved. Session 5 The Bourne Shell.
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.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Agenda Positional Parameters / Continued... Command Substitution Bourne Shell / Bash Shell / Korn Shell Mathematical Expressions Bourne Shell / Bash Shell.
Chapter 5: The Shell The Man in the Middle. In this chapter … The command line Input, output, and redirection Process management Wildcards and expansion.
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.
BIF713 Introduction to Linux. Agenda Getting Started: Using Linux Unix and Linux - Structure / Features Elements of the Linux Philosophy Linux Command.
CSC414 “Introduction to UNIX/ Linux” Lecture 3
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.
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.
ULI101 Week 05. Week Overview ● File system links ● Hard and symbolic links ● Process management ● Storage quota information (quota) ● Printing.
Foreground and background processes
...looking a bit closer under the hood
IT244 - Introduction to Linux / Unix Instructor: Bo Sheng
SYSTEM ADMINISTRATION PART I by İlker Korkmaz and Kaya Oğuz
...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
...looking a bit closer under the hood
Operating Systems Lecture 12.
CSC 140: Introduction to IT
Lab 6: Process Management
Lecture 6 Introduction to Process Management
Presentation transcript:

Agenda Managing Processes (Jobs) Command Grouping Running jobs in background (bg) Bringing jobs to foreground (fg), Background job status (jobs) Suspending jobs (CTRL Z) Restarting jobs in background Displaying/Killing processes or jobs

Controlling Processes A process in UNIX simply represents the running of a command The process structure in UNIX is similar to the hierarchical structure of directories: The beginning process is root Parent processes can create child processes Processes can spawn other processes When a child process is finished, execution returns to its parent process

Controlling Processes It is important to learn how UNIX processes work, since administering a UNIX system requires knowledge of how to start, stop and monitor processes. The UNIX system is built on a series of processes and sub-processes. If you don’t understand processes, you could accidentally shut down the UNIX system. (not a very smart or popular thing to do!)

Processes For your account, the basic process is the shell (although for the entire system - from root downwards there are many processes). When you type in a UNIX command and press ENTER, a child process is created to allow execution of command. During this time the parent process “sleeps” and resumes when child process is completed. There is even a command called sleep to suspend the process for a specific number of seconds!

Process Identification (PID) Process Identification Numbers (PIDs) are used to keep track of separate processes To view a compact listing of process ID numbers, you can enter ps To view a detailed listing of process ID numbers (relating child (PID)& parent processes(PPID)) enter ps -l To view listing of processes for the entire system, enter ps -ef

Command Grouping You can run a set of commands on the same command line by typing such commands as: ls ; who ; date You can also, combine commands or files to be run in both the foreground or background (eg ls ; who or a & b ; c)

Command Grouping The UNIX OS has the ability to run programs in the foreground and in the background. This feature allows users of the UNIX system to run lengthy processes without interfering with their other tasks. To run a command or script in the background, type the symbol & after the command or filename (eg. who &). Note that spaces are allowed...

Command Grouping It is important to note that although these commands appear to be in a sequence, the shell may execute these in a different order may schedule jobs in a order For example, you may want to run both commands a & b in the background, and run command c in the foreground. Here is the command: (a;b)&c

Bringing processes to foreground When processes are run in the foreground, the shell will wait for the command to finish before allowing the user to enter another command (thus background processes are useful) If a process or processes are in the background (or suspended), you can bring it to the foreground by typing fg

Displaying job status (jobs command) You can display the status of jobs that are running in the background by typing the UNIX command jobs jobs commands give a listing of jobs running in the background: jobs with a plus sign “+” indicates default job to bring to foreground by entering fg Can bring numbered job to foreground by entering fg %(job#) - Note space between fg & %

Suspending jobs (CTRL Z) You can suspend or stop the execution of processes while they are running in the “foreground” by pressing When you press these keys, the process is suspended and placed into the background in order to free up the shell for other operations. You can resume process by bringing it to the foreground or have it run in background

Restarting Suspended Processes in the Background A process may take such a long time that it is better to suspend the job (i.e. send it to the background, and then have it run in the background). This will leave you to operate in the foreground If a process or processes are suspended in the background, you can have it continue running in the background by entering bg (rules such as bg %(job#) also apply)

Terminating processes or jobs (kill) Depending on your permissions, you may be able to abort or “kill” a process. Only root is allowed to kill other user’s processes, but as a user, you can processes that you have created. Killing a process is also useful to halt processes that are running in the background since or DELETE keys in foreground won’t work

Procedure to “Kill” a Process Procedure: We are assuming that you are killing one of your own process (you are logged in…) View process by typing ps -l Carefully locate PID to kill Type kill %(job#) to kill that job number (can also use kill PID or kill -9 PID to kill process. The kill command by itself kills more recent stopped job