CSC414 “Introduction to UNIX/ Linux” Lecture 3

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.
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.
Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
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.
1 CS 333 Introduction to Operating Systems Class 2 – OS-Related Hardware & Software The Process Concept Jonathan Walpole Computer Science Portland State.
Review: Operating System Manages all system resources ALU Memory I/O Files Objectives: Security Efficiency Convenience.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Processes & Daemons Chapter IV / Part III. Commands Internal commands: alias, cd, echo, pwd, time External commands, code is in a file: grep, ls, more.
1 Operating Systems Ch An Overview. Architecture of Computer Hardware and Systems Software Irv Englander, John Wiley, Bare Bones Computer.
Introduction to Embedded Systems Traditional OS Processes and Scheduling Lecture 15hb.
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.
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 Filesystem Management
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Managing Processes CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
Chapter 3 Process Description and Control
Linux+ Guide to Linux Certification, Third Edition
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,
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
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.
CE Operating Systems Lecture 10 Processes and process management in Linux.
8-Sep Operating Systems Yasir Kiani. 8-Sep Agenda for Today Review of previous lecture Process scheduling concepts Process creation and termination.
Scis.regis.edu ● CS 468: Advanced UNIX Class 4 Dr. Jesús Borrego Regis University 1.
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.
1  process  process creation/termination  context  process control block (PCB)  context switch  5-state process model  process scheduling short/medium/long.
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
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.
ACCESS CONTROL. Components of a Process  Address space  Set of data structures within the kernel - process’s address space map - current status - execution.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
Linux Processes Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Processes 2 Introduction to Operating Systems: Module 4.
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.
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.
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.
Chapter 3: Processes.
The Linux Command Line Chapter 10
Operating Systems Lecture 6.
Mid Term review CSC345.
CSC 140: Introduction to IT
Controlling Processes
Chapter 3: Processes.
Processes – Part I.
CS510 Operating System Foundations
Lab 6: Process Management
Linux Filesystem Management
Process Management and System Monitoring
Lecture 6 Introduction to Process Management
Presentation transcript:

CSC414 “Introduction to UNIX/ Linux” Lecture 3

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level Schedule Introduction to Unix/ Linux Kernel Structure and Device Drivers. System and Storage Structure. Processes and Inter- Process Communication. Shell Programming. User Management and Disk Quota. System Management. Network Management. Security. Advanced System Administration.

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level Contents: Definition. Process types. Process Attributes. Creation of a Process Signals. Managing Processes ( commands).

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level Definition: A process represents a running program. It’s the object through which a program’s use of memory, processor time, and I/O resources can be managed and monitored. Not every command starts a single process. Some commands initiate a series of processes, such as mozilla; others, like ls, are executed as a single command. You need to be aware of the four execution states : A runnable process is ready to execute whenever CPU time is available. It has acquired all the resources it needs and is just waiting for CPU time to process its data. As soon as the process makes a system call that cannot be immediately completed (such as a request to read part of a file), the kernel puts it to sleep. Sleeping processes are waiting for a specific event to occur. Interactive shells and system daemons spend most of their time sleeping, waiting for terminal input or network connections. Since a sleeping process is effectively blocked until its request has been satisfied, it will get no CPU time unless it receives a signal or a response to one of its I/O requests. Zombies are processes that have finished execution but have not yet had their status collected. If you see zombies hanging around, check their PPIDs with ps to find out where they’re coming from. Stopped processes are administratively forbidden to run. Processes are stopped on receipt of a STOP or TSTP signal and are restarted with CONT. Being stopped is similar to sleeping, but there’s no way for a process to get out of the stopped state other than having some other process wake it up (or kill it).

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level Process types: Interactive processes: Initialized and controlled through a terminal session. There has to be someone connected to the system to start them. They are not started automatically as part of the system functions. Other applications can't be run as long as this process is running in the foreground Running a process in the background is only useful for programs that don't need user input (via the shell), used for long time execution jobs.

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level Cont. Automatic processes Automatic or batch processes are not connected to a terminal. They wait to be executed on a FIFO basis. can be executed using one of two criteria: At a certain date and time: done using the at command At times when the total system load is low enough to accept extra jobs: done using the batch command. Daemons Daemons are server processes that run continuously Initialized at system startup and then wait in the background until their service is required

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level Process Attributes: A process has a series of characteristics: The process ID or PID: a unique identification number used to refer to the process. The parent process ID or PPID: the number of the process (PID) that started this process. Nice number: the degree of friendliness of this process toward other processes (not to be confused with process priority, which is calculated based on this nice number and recent CPU usage of the process). The priority or importance of a job is defined by it's nice number. A program with a high nice; it is not an important job. The lower the nice number, the more important a job is. Terminal or TTY: terminal to which the process is connected. User name of the real and effective user (RUID and EUID): the owner of the process.

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level Creation of a Process. Process creation (fork-and-exec mechanism ) A new process is created because an existing process makes an exact copy of itself. This child process has the same environment as its parent, only the process ID number is different. This procedure is called forking. After the forking process, the address space of the child process is overwritten with the new process data. This is done through an exec call to the system.

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level  

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level Signals: Signals are process-level interrupt requests. About thirty different kinds are defined, and they’re used in a variety of ways: They can be sent among processes as a means of communication. They can be sent by the terminal driver to kill, interrupt, or suspend processes when keys such as <Control-C> and <Control-Z> are typed. They can be sent by an administrator (with kill) to achieve various ends. They can be sent by the kernel when a process commits an infraction such as division by zero. They can be sent by the kernel to notify a process of an “interesting” condition such as the death of a child process or the availability of data on an I/O channel.

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level Cont. KILL is unblockable and terminates a process at the kernel level. A process can never actually receive this signal. • INT is sent by the terminal driver when you type <Control-C>. It’s a request to terminate the current operation. Simple programs should quit (if they catch the signal) or simply allow themselves to be killed, which is the default if the signal is not caught. Programs that have an interactive command line (such as a shell) should stop what they’re doing, clean up, and wait for user input again. • TERM is a request to terminate execution completely. It’s expected that the receiving process will clean up its state and exit. • HUP has two common interpretations. First, it’s understood as a reset request by many daemons. If a daemon is capable of rereading its configuration file and adjusting to changes without restarting, a HUP can generally be used to trigger this behavior. Second, HUP signals are sometimes generated by the terminal driver in an attempt to “clean up” (i.e., kill) the processes attached to a particular terminal. This behavior is largely a holdover from the days of wired terminals and modem connections, hence the name “hangup.” • QUIT is similar to TERM, except that it defaults to producing a core dump if not caught. A few programs cannibalize this signal and interpret it to mean something else.

Managing Processes ( commands) 2015 Qassim University, College of Computer, 9th level Managing Processes ( commands)

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level Cont. ps Get the status of one or more processes. Eg: ps ax |more to see all processes including daemons Eg : ps –ef | grep <process> top The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel. Information are updated every 5 seconds. The first line of top contains the same information displayed by the uptime command:

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level Cont. pstree Display the tree of running processes. relations between processes pgrep looks through the currently running processes and lists the process IDs which matches the selection criteria to stdout. All the criteria have to match. EX: pgrep -u root sshd will only list the processes called sshd AND owned by root.

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level Cont. kill Ex: "kill 34" - Effect: Kill or stop the process with the process ID number 34. killall Kill processes by name. Can check for and restart processes. pid Find the process ID of a running program

Qassim University, College of Computer, 9th level 2015 Qassim University, College of Computer, 9th level Reading Chapter 5 from the textbook. Chapter 4 from “Introduction to Linux A Hands on Guide” (online http://www.tldp.org/LDP/intro-linux/html/intro-linux.html )