Processes. System tasks Campus-Booster ID : **XXXXX. Copyright SUPINFO. All rights reserved

Similar documents
Sudo: Switch User Do. Administrative Privileges Delegation Campus-Booster ID : **XXXXX. Copyright SUPINFO. All rights reserved

Filesystem and common commands

Unix Processes. What is a Process?

Process Management forks, bombs, zombies, and daemons! Lecture 5, Hands-On Unix System Administration DeCal

elinks, mail processes nice ps, pstree, top job control, jobs, fg, bg signals, kill, killall crontab, anacron, at

Programs. Program: Set of commands stored in a file Stored on disk Starting a program creates a process static Process: Program loaded in RAM dynamic

elinks, mail processes nice ps, pstree, top job control, jobs, fg, bg signals, kill, killall crontab, anacron, at

Linux System Administration

Archives. Gather and compress Campus-Booster ID : **XXXXX. Copyright SUPINFO. All rights reserved

Access Control Lists. Beyond POSIX permissions Campus-Booster ID : **XXXXX. Copyright SUPINFO. All rights reserved

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes

07 - Processes and Jobs

Most of the work is done in the context of the process rather than handled separately by the kernel

Bamuengine.com. Chapter 7. The Process

APPLIED INFORMATICS Processes. Bash characteristics. Command type. Aliases.

Your daily cup of CLI

Chapter 9: Process management. Chapter 9 Process management

Lab 2: Linux/Unix shell

PROCESSES. At least they re not ISO-9001 processes

Managing Processes Process: A running program

Operating Systems Lab 1 (Users, Groups, and Security)

Study Guide Processes & Job Control

System Administration

Process States. Controlling processes. Process states. PID and PPID UID and EUID GID and EGID Niceness Control terminal. Runnable. Sleeping.

Lecture 5: Jobs and Processes

Command-line interpreters

Advanced Unix Concepts. Satyajit Rai

CSE 410: Computer Systems Spring Processes. John Zahorjan Allen Center 534

5/8/2012. Controlling User Processes Chapter 10

Processes & Signals. System Runs Many Processes Concurrently. State consists of memory image + register values + program counter

Process management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized)

PROCESSES. Jo, Heeseung

Processes. Jo, Heeseung

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu

What is a Process? Processes and Process Management Details for running a program

COSC243 Part 2: Operating Systems

CSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476

Introduction to UNIX Shell Exercises

Chapter 4 Controlling Processes

OS Structure, Processes & Process Management. Don Porter Portions courtesy Emmett Witchel

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System

CS Unix Tools. Fall 2010 Lecture 10. Hussam Abu-Libdeh based on slides by David Slater. September 29th, 2010

Lecture 24: Multitasking and Signals

Sperimentazioni I LINUX commands tutorial - Part II

Killing Zombies, Working, Sleeping, and Spawning Children

Simplest version of DayOfYear

Processes in linux. What s s a process? process? A dynamically executing instance of a program. David Morgan. David Morgan

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Signals. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

NAME top display top CPU processes. SYNOPSIS top [ ] [d delay] [p pid] [q] [c] [C] [S] [s] [i] [n iter] [b]

Linux Tutorial #6. -rw-r csce_user csce_user 20 Jan 4 09:15 list1.txt -rw-r csce_user csce_user 26 Jan 4 09:16 list2.

Shell and Signals. Computer Organization 3/17/2015. CSC252 - Spring The World of Multiprogramming or Multitasking. Unix Process Hierarchy

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

Processes. CS3026 Operating Systems Lecture 05

(MCQZ-CS604 Operating Systems)

Removing files and directories, finding files and directories, controlling programs

Exceptional Control Flow Exists at All Levels of a System. Systemprogrammering 2007 Föreläsning 3 Exceptional Control Flow Part II

Review of Fundamentals

Introduction to the Linux Command Line January Presentation Topics

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

Shells and Processes. Bryce Boe 2012/08/08 CS32, Summer 2012 B

CS 31: Intro to Systems Processes. Kevin Webb Swarthmore College March 31, 2016

S E C T I O N O V E R V I E W

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

Layers in a UNIX System. Create a new process. Processes in UNIX. fildescriptors streams pipe(2) labinstructions

Processes and Shells

ECF Exists at All Levels of a System Exceptional Control Flow Part II Oct. 22, 2002 Topics! Process Hierarchy! Shells! Signals!

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

CPSC 457 OPERATING SYSTEMS MIDTERM EXAM

Processes. What s s a process? process? A dynamically executing instance of a program. David Morgan

Process Control. Philipp Koehn. 23 April 2018

File system links. Week Overview. Hard and symbolic links Process management

M2PGER FORTRAN programming. General introduction. Virginie DURAND and Jean VIRIEUX 10/13/2013 M2PGER - ALGORITHME SCIENTIFIQUE

Working with Unix Processes. Copyright 2012 Jesse Storimer. All rights reserved. This ebook is licensed for individual use only.

Exceptions, Processes and Signals

Exceptional Control Flow Part II

Computer Systems and Architecture

IC221: Systems Programming 12-Week Written Exam [SOLUTIONS]

Processes. CS439: Principles of Computer Systems January 24, 2018

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 20

Giving credit where credit is due

Processes. CS439: Principles of Computer Systems January 30, 2019

Shell Execution of Programs. Process Groups, Session and Signals 1

Chap 4, 5: Process. Dongkun Shin, SKKU

Processes. Sanzheng Qiao. December, Department of Computing and Software

CST Algonquin College 2

Bashed One Too Many Times. Features of the Bash Shell St. Louis Unix Users Group Jeff Muse, Jan 14, 2009

Assignment 1. Teaching Assistant: Michalis Pachilakis (

Lecture-4. Introduction to Unix: More Commands, Boot-up Actions and X Window

PROCESS CONCEPTS. Process Concept Relationship to a Program What is a Process? Process Lifecycle Process Management Inter-Process Communication 2.

Midterm Exam CPS 210: Operating Systems Spring 2013

Part Workbook 9. Managing Processes

Perl and R Scripting for Biologists

Multitasking. Programmer s model of multitasking. fork() spawns new process. exit() terminates own process

Introduction to Linux

5/20/2007. Touring Essential Programs

CRUK cluster practical sessions (SLURM) Part I processes & scripts

CS 307: UNIX PROGRAMMING ENVIRONMENT REVIEW FOR EXAM 2

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes

Transcription:

Processes System tasks Campus-Booster ID : **XXXXX www.supinfo.com Copyright SUPINFO. All rights reserved

Processes Your trainer Presenter s Name Title: **Enter title or job role. Accomplishments: **What makes the presenter qualified to present this course. Education: **List degrees if important. Publications: **Writings by the presenter on the subject of the course or presentation. Contact: **Campus-Booster ID: presenter@supinfo.com

Processes Course objectives By completing this course, you will: n Explain the process concept. And different types. n List and sort running processes. Using several tools. n Spot CPU hogs. Who s eating all the system power? n Use signals. To terminate and communicate with processes.

Processes Course topics Course s plan: n Processes on Unices. What s a process? n Running processes. Background, foreground and priority. n Listing processes. Unix tasks managers. n Signals. Primitive IPC.

Processes Processes on Unices What s a process?

Processes on Unices Processes Everything is a file, if not, then, it s a process. Unknown source

Processes on Unices Processes What s a process? n System task management abstraction n In-memory executable code n Many properties n Runs as a (uig,gid) couple n Attached to a tty n daemons n Identified by a PID

Processes on Unices Process Hierarchy A process can spawn other processes: init ftpd login init is the first userland process (PID 1) started off by the kernel. It s the ancestor of every processes. ls bash cp

Processes on Unices Process Hierarchy Processes on Unix: fork(). n Process can spawn children n Child process n Inherit environment n Die if parent die n Can be detached n Parent process n Must wait for children n Zombies

Processes on Unices Daemons Processes gone rogue. n Special state n Detached from original parent n PPID = 1 n No control TTY n STDIN n STDOUT n STDERR n Used for services

Processes on Unices Process State A process can be: Name Description Running Has CPU time Runnable Sleeping Zombie/ Defunct Waits for CPU time Does nothing / Waits for something (I/O, ) Process ended. Parent didn t wait() (yet)

Processes on Unices Zombies / Defunct processes Can t kill what s already dead. n Ended process n No CPU cycles n No resources n Only id block and process table entry n Needs to be wait() ed n Stalled parent n Bugged parent n Kill the parent

Processes on Unices Stop-and-think Do you have any questions?

Processes on Unices Stop-and-think The only way to get rid of zombies/defunct processes is to reboot the system. True False

Processes on Unices Stop-and-think The only way to get rid of zombies/defunct processes is to reboot the system. True False

Processes Running processes Background, foreground and priorities

Running processes Processes in the shell I want my prompt back! n Background processes n Start with & n Ctrl-Z + bg n Move to foreground n fg n Ctrl-C kill the process n List running tasks n jobs n Detach from the shell n disown

Running processes Processes in the shell supinfo@localhost:~$ yes > /dev/null ^Z [1]+ Stopped yes > /dev/null supinfo@localhost:~$ bg [1]+ yes > /dev/null & supinfo@localhost:~$ cat /dev/zero > /dev/null & [2] 1861 supinfo@localhost:~$ jobs [1]- Running yes > /dev/null & [2]+ Running cat /dev/zero > /dev/null & supinfo@localhost:~$ fg cat /dev/zero > /dev/null ^Z [2]+ Stopped cat /dev/zero > /dev/null supinfo@localhost:~$ bg [2]+ cat /dev/zero > /dev/null & supinfo@localhost:~$ fg %1 yes > /dev/null

Running processes Priority So the last will be first, and the first last n Priority (PR) n Kernel-computed n Niceness n Many elements n -20 > 19 n Default 0 n Niceness n Only root can go negative

Running processes Niceness Starting a niced process n nice command n Defaults to 10 n Can be set [user@linux ~]$ nice [option] cmdline -n value: Run the process with the specified nice value

Running processes Niceness Modifying the nice value of a running process n renice command n PID s n Users n Only root can renice other s processes [user@linux ~]$ renice [ n] priority options -p pid: Renice the PID process -u user: Renice processes owned by user

Running processes Stop-and-think Do you have any questions?

Running processes Stop-and-think Only root can run processes with a negative nice value. True False

Running processes Stop-and-think Only root can run processes with a negative nice value. True False

Running processes Stop-and-think Users can always renice their own processes. True False

Running processes Stop-and-think Users can always renice their own processes. True False

Processes Listing processes Unix task managers

Listing processes Show processes List running processes [root@linux ~]# ps [options] Options none -u user -e -ef aux Definitions Processes running in the current user/shell Processes owned by user All processes (System V syntax) All processes, long form All processes (BSD Syntax)

Listing processes Show processes Filter processes [root@linux ~]# pgrep [options] pattern Options Definitions -l -U user, -G group, î -v Show process name Processes owned by user (list is or ed) Processes owned by group (list is or ed) Inverted match: Show process that do not match

Listing processes Interactive tools TUI-based process management. n Interactive tools n Keyboard controlled n Monitor system activity n top n Well-known n De facto standard n Old n Limited (list size, ) n htop n Fixes top limitations

Listing processes Stop-and-think Do you have any questions?

Listing processes Stop-and-think The ps aux and ps aux commands are both valid and have the same meaning. True False

Listing processes Stop-and-think The ps aux and ps aux commands are both valid and have the same meaning. True False

Processes Signals Primitive IPC

Signals Signal definition What s a signal? n Primitive IPC/Soft IRQ n Signal other process n Signal self n Events n Modem Hang up n Timer elapsed n Errors n Broken Pipe n Segmentation Fault n Custom meanining

Signals Common Signals Complete list with kill -l number Description 15 SIGTERM 9 SIGKILL 11 SIGSEGV 1 SIGHUP

Signals Sending signals From command line [user@linux ~]$ kill [options] [pid %job_id] Options Definitions -l -num -signal List signals Send signal n num. Defaults to SIGTERM(15) Send signal named signal. (SIGKILL or KILL)

Signals Sending signals From command line [user@linux ~]$ killall [options] [name] Options Definitions -l -s signal -u user List signals Send signal (name or n ). Defaults to SIGTERM(15) Select only processes owned by user

Signals Sending signals From command line [user@linux ~]$ pkill [options] pattern options: Same as pgrep -signal: Send signal (name or n ). Defaults to SIGTERM

Signals Part 4 Stop-and-think Do you have any questions?

Signals Stop-and-think To kill a job with the kill command, you must get its PID before. True False

Signals Stop-and-think To kill a job with the kill command, you must get its PID before. True False

Processes Course summary Priority/ niceness What s a process Signals Zombies Jobs

Processes For more If you want to go into these subjects more deeply, Publications Courses Linux Technologies: Edge Computing Linux system administration Web sites www.supinfo.com www.labo-linux.com www.blackbeltfactory.com Conferences FOSDEM RMLL Solutions Linux

Congratulations You have successfully completed the SUPINFO course module n 09 Processes

Processes The end n Kill with caution n Disown before closing your terminal