SlideShare a Scribd company logo
Process Management
Overview
• Each task in Unix starts a process.
• Each process is assigned a unique process identification
number (PID).
• Some processes are started by the system and are used
to control activities, these are usually called daemons
• Processes started by the user from the shell inherit the
shell’s terminal, and interact through it
• Processes started in the GUI don’t usually have a
terminal associated with them
Processes and PIDs
• Use the ‘ps’ command to list the processes currently
running on the system.
• The command is:
ps [options]
• Commonest options are -ef: (in some UNIXs aux)
– –e Every process on the system
– –f Full listing
• Use pgrep command to search for a specific process.
This is equivalent to ps –ef | grep
• Without options, ps will just print all processes that share
the terminal with it.
Processes and PIDs
• ‘ps’ can also print out resource usage information for all
processes on the system.
Example
$ ps aux | head
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 10348 732 ? Ss 2010 0:04 init [3]
apache 6019 0.0 0.8 241120 9184 ? S Jun26 0:01 /usr/sbin/httpd
root 6108 0.0 0.0 5908 620 ? Ss Mar30 0:16 syslogd -m 0
Process Life Line
• There are three stages in the process life cycle:
– Fork – the parent process creates an exact image of
itself in the memory and gets a new PID.
– Exec – the new process rewrites its image in the
memory and executes. The parent (i.e. shell) either
waits for the process to finish (foreground) or
continues to run (background)
– Termination – the child process returns a signal to the
parent, which contains an exit code. The parent
process deletes the child from the process table.
Signals
• UNIX systems use signals to communicate different
scenarios between processes
• The kernel manages signal transfers
• When a process receives a signal it stops its current
activity and moves to a signal handling routine
• Different signals have different default routines, which
can be overridden by the programmer
• Among other things signals terminate, suspend and
continue process.
• From a regular user perspective, most signals are
irrelevant – they are used by the kernel
Signaling with kill
• Use the command kill to send a signal to a process.
$ kill [-signal] %job-id|process-id
• The name is derived from the fact the default signal kill
sends is the SIGTERM (15) signal, which by default
terminates the process
• For a foreground process, ^C achieves the same result,
but it is actually the terminal sending a SIGINT (2) to the
process
• Both these signals can be blocked by the process (the
BASH, for example, blocks them)
• The signal SIGKILL (9) cannot be blocked, so if all else
fails, this is the way to destroy a stuck process
• ^Z sends the signal SIGTSTP, while SIGSTOP
is a non blocked equivalent
Cron
• The cron daemon continually checks the users crontab
files and execute periodic tasks
• Edit the user’s crontab with the command crontab –e
• An editor (usually vi) is opened with the crontab. The
table has six fields:
minute,hour,day,month,weekday,command
59,23,*,*,*, echo Hello > hello.$(date +%s)
• You can list your crontab with crontab –l
• In the system level, there is an additional mechanism of
crontabs for once-a-day, once-a-week, etc.
Monitoring processes by top
• ‘top’ - Displays the top processes on the system and
periodically updates the information.
• The first few lines of the display show general
information about the system’s state:
– Load averages in the last 1, 5, and 15 minutes.
– Existing processes no. and the no. of processes in
each state (sleeping, waiting, running, starting,
zombie, and stopped).
– Percentage of time spent in each of the processor
states (user, nice, system, idle, interrupt and
swapper) per processor on the system.
– Average value for each of the processor states (only
on multi-processor systems).
Monitoring processes by top – cont.
CPU Processor number on which the process is executing (only on multi-processor systems).
TTY Terminal interface used by the process
PID Process ID number
USERNAME Name of the owner of the process
PRI Current priority of the process
NI Nice value ranging from -20 to +20
SIZE Total size of the process in kilobytes.
RES Resident size of the process in kilobytes
STATE Current state of the process. The various states are sleep, wait, run, idle, zomb, or stop
TIME Number of system and CPU seconds the process has consumed
%WCPU Weighted CPU (central processing unit) percentage
%CPU Raw CPU percentage. This field is used to sort the top processes
COMMAND Name of the command the process is currently running

More Related Content

What's hot

Priority scheduling algorithms
Priority scheduling algorithmsPriority scheduling algorithms
Priority scheduling algorithms
Daffodil International University
 
Program execution
Program executionProgram execution
Program execution
peoplesmagnet
 
Process Control Block & Threads and Their Management
Process Control Block & Threads and Their ManagementProcess Control Block & Threads and Their Management
Process Control Block & Threads and Their Management
Ujjwal Kumar
 
Introduction to Scheduling
Introduction to SchedulingIntroduction to Scheduling
Introduction to Scheduling
pec2013
 
OPERATING SYSTEM-"Scheduling policies"
OPERATING SYSTEM-"Scheduling policies"OPERATING SYSTEM-"Scheduling policies"
OPERATING SYSTEM-"Scheduling policies"
Ankit Surti
 
Microprogram Control
Microprogram Control Microprogram Control
Microprogram Control
Anuj Modi
 
Presentiaon task sheduling first come first serve FCFS
Presentiaon  task sheduling first come first serve FCFSPresentiaon  task sheduling first come first serve FCFS
Presentiaon task sheduling first come first serve FCFS
Ahmed Salah
 
Computer architecture control unit
Computer architecture control unitComputer architecture control unit
Computer architecture control unit
Mazin Alwaaly
 
Linux System Monitoring basic commands
Linux System Monitoring basic commandsLinux System Monitoring basic commands
Linux System Monitoring basic commands
Mohammad Rafiee
 
Microarchitecture
MicroarchitectureMicroarchitecture
Microarchitecture
meashi
 
Microprogrammed Control Unit
Microprogrammed Control UnitMicroprogrammed Control Unit
Microprogrammed Control Unit
PreethiSureshkumar1
 
Register Organization and Instruction cycle
Register Organization and Instruction cycleRegister Organization and Instruction cycle
Register Organization and Instruction cycle
Muhammad Ameer Mohavia
 
Os presentation process
Os presentation processOs presentation process
Os presentation process
Naseer Ahmad
 
Ch7 official
Ch7 officialCh7 official
Ch7 official
ranjanpriya
 
Cpu scheduling algorithms simulation using java
Cpu scheduling algorithms simulation using javaCpu scheduling algorithms simulation using java
Cpu scheduling algorithms simulation using java
jsivasrinivas
 
Micro Programmed Control Unit
Micro Programmed Control UnitMicro Programmed Control Unit
Micro Programmed Control Unit
Kamal Acharya
 
3 4- computer organization and archietecture- COA- CO- Computer organization
3 4- computer organization and archietecture- COA- CO- Computer organization3 4- computer organization and archietecture- COA- CO- Computer organization
3 4- computer organization and archietecture- COA- CO- Computer organization
Jay Patel
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its concepts
Karan Thakkar
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
Tayba Farooqui
 
My ppt @ bec doms on process management
My ppt @ bec doms on process managementMy ppt @ bec doms on process management
My ppt @ bec doms on process management
Babasab Patil
 

What's hot (20)

Priority scheduling algorithms
Priority scheduling algorithmsPriority scheduling algorithms
Priority scheduling algorithms
 
Program execution
Program executionProgram execution
Program execution
 
Process Control Block & Threads and Their Management
Process Control Block & Threads and Their ManagementProcess Control Block & Threads and Their Management
Process Control Block & Threads and Their Management
 
Introduction to Scheduling
Introduction to SchedulingIntroduction to Scheduling
Introduction to Scheduling
 
OPERATING SYSTEM-"Scheduling policies"
OPERATING SYSTEM-"Scheduling policies"OPERATING SYSTEM-"Scheduling policies"
OPERATING SYSTEM-"Scheduling policies"
 
Microprogram Control
Microprogram Control Microprogram Control
Microprogram Control
 
Presentiaon task sheduling first come first serve FCFS
Presentiaon  task sheduling first come first serve FCFSPresentiaon  task sheduling first come first serve FCFS
Presentiaon task sheduling first come first serve FCFS
 
Computer architecture control unit
Computer architecture control unitComputer architecture control unit
Computer architecture control unit
 
Linux System Monitoring basic commands
Linux System Monitoring basic commandsLinux System Monitoring basic commands
Linux System Monitoring basic commands
 
Microarchitecture
MicroarchitectureMicroarchitecture
Microarchitecture
 
Microprogrammed Control Unit
Microprogrammed Control UnitMicroprogrammed Control Unit
Microprogrammed Control Unit
 
Register Organization and Instruction cycle
Register Organization and Instruction cycleRegister Organization and Instruction cycle
Register Organization and Instruction cycle
 
Os presentation process
Os presentation processOs presentation process
Os presentation process
 
Ch7 official
Ch7 officialCh7 official
Ch7 official
 
Cpu scheduling algorithms simulation using java
Cpu scheduling algorithms simulation using javaCpu scheduling algorithms simulation using java
Cpu scheduling algorithms simulation using java
 
Micro Programmed Control Unit
Micro Programmed Control UnitMicro Programmed Control Unit
Micro Programmed Control Unit
 
3 4- computer organization and archietecture- COA- CO- Computer organization
3 4- computer organization and archietecture- COA- CO- Computer organization3 4- computer organization and archietecture- COA- CO- Computer organization
3 4- computer organization and archietecture- COA- CO- Computer organization
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its concepts
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
 
My ppt @ bec doms on process management
My ppt @ bec doms on process managementMy ppt @ bec doms on process management
My ppt @ bec doms on process management
 

Viewers also liked

Augusta Linux User Group - Vim Introduction
Augusta Linux User Group - Vim IntroductionAugusta Linux User Group - Vim Introduction
Augusta Linux User Group - Vim Introduction
Keith Pickett
 
Infra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationInfra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automation
Shay Cohen
 
Unit3 browsing the filesystem
Unit3 browsing the filesystemUnit3 browsing the filesystem
Unit3 browsing the filesystem
root_fibo
 
14 network tools
14 network tools14 network tools
14 network tools
Shay Cohen
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystem
Shay Cohen
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
Shay Cohen
 
chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinux
Shay Cohen
 

Viewers also liked (7)

Augusta Linux User Group - Vim Introduction
Augusta Linux User Group - Vim IntroductionAugusta Linux User Group - Vim Introduction
Augusta Linux User Group - Vim Introduction
 
Infra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationInfra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automation
 
Unit3 browsing the filesystem
Unit3 browsing the filesystemUnit3 browsing the filesystem
Unit3 browsing the filesystem
 
14 network tools
14 network tools14 network tools
14 network tools
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystem
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 
chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinux
 

Similar to 13 process management

UNIX Notes
UNIX NotesUNIX Notes
UNIX Notes
PandurangBiradar2
 
Advanced Operating Systems......Process Management
Advanced Operating Systems......Process ManagementAdvanced Operating Systems......Process Management
Advanced Operating Systems......Process Management
Veejeya Kumbhar
 
Operating System Structure Part-I.pdf
Operating System Structure Part-I.pdfOperating System Structure Part-I.pdf
Operating System Structure Part-I.pdf
Harika Pudugosula
 
Operating Systems
Operating Systems Operating Systems
Operating Systems
Ziyauddin Shaik
 
LP-Unit3.docx
LP-Unit3.docxLP-Unit3.docx
LP-Unit3.docx
SeetharamNageshAppe1
 
Computer system architecture
Computer system architectureComputer system architecture
Computer system architecture
jeetesh036
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
Emertxe Information Technologies Pvt Ltd
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
Mukesh Chinta
 
Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2)
rohassanie
 
07 Systems Software Programming-IPC-Signals.pptx
07 Systems Software Programming-IPC-Signals.pptx07 Systems Software Programming-IPC-Signals.pptx
07 Systems Software Programming-IPC-Signals.pptx
KushalSrivastava23
 
Operating System 3
Operating System 3Operating System 3
Operating System 3
tech2click
 
Course 102: Lecture 19: Using Signals
Course 102: Lecture 19: Using Signals Course 102: Lecture 19: Using Signals
Course 102: Lecture 19: Using Signals
Ahmed El-Arabawy
 
Bedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdfBedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdf
AyushBaiswar1
 
Ch3 processes
Ch3   processesCh3   processes
Ch3 processes
Welly Dian Astika
 
Linux : Booting and runlevels
Linux : Booting and runlevelsLinux : Booting and runlevels
Linux : Booting and runlevels
John Ombagi
 
OS Content.pdf
OS Content.pdfOS Content.pdf
OS Content.pdf
VAIBHAVSAHU55
 
OS (1).pptx
OS (1).pptxOS (1).pptx
OS (1).pptx
KumarMit2
 
Operating system 18 process creation and termination
Operating system 18 process creation and terminationOperating system 18 process creation and termination
Operating system 18 process creation and termination
Vaibhav Khanna
 
Lecture5
Lecture5Lecture5
Lecture5
Ali Shah
 
Operating Systems PPT 1 (1).pdf
Operating Systems PPT 1 (1).pdfOperating Systems PPT 1 (1).pdf
Operating Systems PPT 1 (1).pdf
FahanaAbdulVahab
 

Similar to 13 process management (20)

UNIX Notes
UNIX NotesUNIX Notes
UNIX Notes
 
Advanced Operating Systems......Process Management
Advanced Operating Systems......Process ManagementAdvanced Operating Systems......Process Management
Advanced Operating Systems......Process Management
 
Operating System Structure Part-I.pdf
Operating System Structure Part-I.pdfOperating System Structure Part-I.pdf
Operating System Structure Part-I.pdf
 
Operating Systems
Operating Systems Operating Systems
Operating Systems
 
LP-Unit3.docx
LP-Unit3.docxLP-Unit3.docx
LP-Unit3.docx
 
Computer system architecture
Computer system architectureComputer system architecture
Computer system architecture
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
 
Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2)
 
07 Systems Software Programming-IPC-Signals.pptx
07 Systems Software Programming-IPC-Signals.pptx07 Systems Software Programming-IPC-Signals.pptx
07 Systems Software Programming-IPC-Signals.pptx
 
Operating System 3
Operating System 3Operating System 3
Operating System 3
 
Course 102: Lecture 19: Using Signals
Course 102: Lecture 19: Using Signals Course 102: Lecture 19: Using Signals
Course 102: Lecture 19: Using Signals
 
Bedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdfBedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdf
 
Ch3 processes
Ch3   processesCh3   processes
Ch3 processes
 
Linux : Booting and runlevels
Linux : Booting and runlevelsLinux : Booting and runlevels
Linux : Booting and runlevels
 
OS Content.pdf
OS Content.pdfOS Content.pdf
OS Content.pdf
 
OS (1).pptx
OS (1).pptxOS (1).pptx
OS (1).pptx
 
Operating system 18 process creation and termination
Operating system 18 process creation and terminationOperating system 18 process creation and termination
Operating system 18 process creation and termination
 
Lecture5
Lecture5Lecture5
Lecture5
 
Operating Systems PPT 1 (1).pdf
Operating Systems PPT 1 (1).pdfOperating Systems PPT 1 (1).pdf
Operating Systems PPT 1 (1).pdf
 

More from Shay Cohen

Linux Performance Tunning Memory
Linux Performance Tunning MemoryLinux Performance Tunning Memory
Linux Performance Tunning Memory
Shay Cohen
 
Linux Performance Tunning Kernel
Linux Performance Tunning KernelLinux Performance Tunning Kernel
Linux Performance Tunning Kernel
Shay Cohen
 
Linux Performance Tunning introduction
Linux Performance Tunning introductionLinux Performance Tunning introduction
Linux Performance Tunning introduction
Shay Cohen
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving tools
Shay Cohen
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
Shay Cohen
 
10 finding files
10 finding files10 finding files
10 finding files
Shay Cohen
 
08 text processing_tools
08 text processing_tools08 text processing_tools
08 text processing_tools
Shay Cohen
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editor
Shay Cohen
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissions
Shay Cohen
 
05 standard io_and_pipes
05 standard io_and_pipes05 standard io_and_pipes
05 standard io_and_pipes
Shay Cohen
 
04 using and_configuring_bash
04 using and_configuring_bash04 using and_configuring_bash
04 using and_configuring_bash
Shay Cohen
 
02 linux desktop usage
02 linux desktop usage02 linux desktop usage
02 linux desktop usage
Shay Cohen
 
09 string processing_with_regex copy
09 string processing_with_regex copy09 string processing_with_regex copy
09 string processing_with_regex copy
Shay Cohen
 
01 linux history overview
01 linux history overview01 linux history overview
01 linux history overview
Shay Cohen
 

More from Shay Cohen (14)

Linux Performance Tunning Memory
Linux Performance Tunning MemoryLinux Performance Tunning Memory
Linux Performance Tunning Memory
 
Linux Performance Tunning Kernel
Linux Performance Tunning KernelLinux Performance Tunning Kernel
Linux Performance Tunning Kernel
 
Linux Performance Tunning introduction
Linux Performance Tunning introductionLinux Performance Tunning introduction
Linux Performance Tunning introduction
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving tools
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
 
10 finding files
10 finding files10 finding files
10 finding files
 
08 text processing_tools
08 text processing_tools08 text processing_tools
08 text processing_tools
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editor
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissions
 
05 standard io_and_pipes
05 standard io_and_pipes05 standard io_and_pipes
05 standard io_and_pipes
 
04 using and_configuring_bash
04 using and_configuring_bash04 using and_configuring_bash
04 using and_configuring_bash
 
02 linux desktop usage
02 linux desktop usage02 linux desktop usage
02 linux desktop usage
 
09 string processing_with_regex copy
09 string processing_with_regex copy09 string processing_with_regex copy
09 string processing_with_regex copy
 
01 linux history overview
01 linux history overview01 linux history overview
01 linux history overview
 

Recently uploaded

AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
HarpalGohil4
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
FilipTomaszewski5
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
ScyllaDB
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
Ortus Solutions, Corp
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Ukraine
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
UiPathCommunity
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
zjhamm304
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
Sunil Jagani
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
Fwdays
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's TipsGetting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
ScyllaDB
 

Recently uploaded (20)

AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's TipsGetting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
 

13 process management

  • 2. Overview • Each task in Unix starts a process. • Each process is assigned a unique process identification number (PID). • Some processes are started by the system and are used to control activities, these are usually called daemons • Processes started by the user from the shell inherit the shell’s terminal, and interact through it • Processes started in the GUI don’t usually have a terminal associated with them
  • 3. Processes and PIDs • Use the ‘ps’ command to list the processes currently running on the system. • The command is: ps [options] • Commonest options are -ef: (in some UNIXs aux) – –e Every process on the system – –f Full listing • Use pgrep command to search for a specific process. This is equivalent to ps –ef | grep • Without options, ps will just print all processes that share the terminal with it.
  • 4. Processes and PIDs • ‘ps’ can also print out resource usage information for all processes on the system. Example $ ps aux | head USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 10348 732 ? Ss 2010 0:04 init [3] apache 6019 0.0 0.8 241120 9184 ? S Jun26 0:01 /usr/sbin/httpd root 6108 0.0 0.0 5908 620 ? Ss Mar30 0:16 syslogd -m 0
  • 5. Process Life Line • There are three stages in the process life cycle: – Fork – the parent process creates an exact image of itself in the memory and gets a new PID. – Exec – the new process rewrites its image in the memory and executes. The parent (i.e. shell) either waits for the process to finish (foreground) or continues to run (background) – Termination – the child process returns a signal to the parent, which contains an exit code. The parent process deletes the child from the process table.
  • 6. Signals • UNIX systems use signals to communicate different scenarios between processes • The kernel manages signal transfers • When a process receives a signal it stops its current activity and moves to a signal handling routine • Different signals have different default routines, which can be overridden by the programmer • Among other things signals terminate, suspend and continue process. • From a regular user perspective, most signals are irrelevant – they are used by the kernel
  • 7. Signaling with kill • Use the command kill to send a signal to a process. $ kill [-signal] %job-id|process-id • The name is derived from the fact the default signal kill sends is the SIGTERM (15) signal, which by default terminates the process • For a foreground process, ^C achieves the same result, but it is actually the terminal sending a SIGINT (2) to the process • Both these signals can be blocked by the process (the BASH, for example, blocks them) • The signal SIGKILL (9) cannot be blocked, so if all else fails, this is the way to destroy a stuck process • ^Z sends the signal SIGTSTP, while SIGSTOP is a non blocked equivalent
  • 8. Cron • The cron daemon continually checks the users crontab files and execute periodic tasks • Edit the user’s crontab with the command crontab –e • An editor (usually vi) is opened with the crontab. The table has six fields: minute,hour,day,month,weekday,command 59,23,*,*,*, echo Hello > hello.$(date +%s) • You can list your crontab with crontab –l • In the system level, there is an additional mechanism of crontabs for once-a-day, once-a-week, etc.
  • 9. Monitoring processes by top • ‘top’ - Displays the top processes on the system and periodically updates the information. • The first few lines of the display show general information about the system’s state: – Load averages in the last 1, 5, and 15 minutes. – Existing processes no. and the no. of processes in each state (sleeping, waiting, running, starting, zombie, and stopped). – Percentage of time spent in each of the processor states (user, nice, system, idle, interrupt and swapper) per processor on the system. – Average value for each of the processor states (only on multi-processor systems).
  • 10. Monitoring processes by top – cont. CPU Processor number on which the process is executing (only on multi-processor systems). TTY Terminal interface used by the process PID Process ID number USERNAME Name of the owner of the process PRI Current priority of the process NI Nice value ranging from -20 to +20 SIZE Total size of the process in kilobytes. RES Resident size of the process in kilobytes STATE Current state of the process. The various states are sleep, wait, run, idle, zomb, or stop TIME Number of system and CPU seconds the process has consumed %WCPU Weighted CPU (central processing unit) percentage %CPU Raw CPU percentage. This field is used to sort the top processes COMMAND Name of the command the process is currently running

Editor's Notes

  1. Each task you perform in the Unix environment starts a process. An example of a process is using vi to edit a text file, or sending file to a printer. Each process is assigned a unique process identification number (PID), which is used by the system to identify the process.The following chapter defines useful commands to handle processes.
  2. Example:$ ps –ef | more UID PID PPID C STIME TTY TIME CMDroot 0 0 0 Dec 19 ? 0:01 sched root 1 0 0 Dec 19 ? 0:11 /etc/init - root 2 0 0 Dec 19 ? 0:00 pageout root 3 0 0 Dec 19 ? 201:03 fsflush root 126 1 0 Dec 19 ? 0:00 /usr/lib/netsvc/yp/ypxfrd root 322 1 0 Dec 19 ? 0:00 /usr/lib/saf/sac -t 300root 104 1 0 Dec 19 ? 2:34 /usr/sbin/rpcbind root 118 116 0 Dec 19 ? 1:01 rpc.nisd_resolv -F -C 8 -p 1073741824 -t udp root 106 1 0 Dec 19 ? 0:00 /usr/sbin/keyservroot 304 1 0 Dec 19 ? 0:00 /usr/sbin/rpld -a root 116 1 0 Dec 19 ? 7:46 /usr/lib/netsvc/yp/ypserv -d root 123 1 0 Dec 19 ? 0:03 /usr/lib/netsvc/yp/ypbind root 133 1 0 Dec 19 ? 0:00 /usr/lib/netsvc/yp/rpc.ypupdated--More— 
  3. Example:$ ps –ef | more UID PID PPID C STIME TTY TIME CMDroot 0 0 0 Dec 19 ? 0:01 sched root 1 0 0 Dec 19 ? 0:11 /etc/init - root 2 0 0 Dec 19 ? 0:00 pageout root 3 0 0 Dec 19 ? 201:03 fsflush root 126 1 0 Dec 19 ? 0:00 /usr/lib/netsvc/yp/ypxfrd root 322 1 0 Dec 19 ? 0:00 /usr/lib/saf/sac -t 300root 104 1 0 Dec 19 ? 2:34 /usr/sbin/rpcbind root 118 116 0 Dec 19 ? 1:01 rpc.nisd_resolv -F -C 8 -p 1073741824 -t udp root 106 1 0 Dec 19 ? 0:00 /usr/sbin/keyservroot 304 1 0 Dec 19 ? 0:00 /usr/sbin/rpld -a root 116 1 0 Dec 19 ? 7:46 /usr/lib/netsvc/yp/ypserv -d root 123 1 0 Dec 19 ? 0:03 /usr/lib/netsvc/yp/ypbind root 133 1 0 Dec 19 ? 0:00 /usr/lib/netsvc/yp/rpc.ypupdated--More— 
  4. When a new command is issued in the shell, a new process starts. The first stage of a new process is when the parent process (the shell in our example) creates an exact copy of itself in the memory. The new process (the child process) has the exact environment as the parent process, but it has a different PID. This act of creating an exact copy of the parent process in the memory is called fork.In the next stage, the child process rewrites its image in the memory with the image of the command it should run. Once the image of the new process is in the memory – the new command starts to execute.This stage is called exec.After the command finishes, it terminates. Before the command terminates completely, its parent process should acknowledge its termination. The parent process receives from the child process the exit code (or an indication why the child was killed, if the child did not exit voluntarily) and is responsible for deleting the child from the process table. 
  5. There are 46 signals in the Unix operating systems. Each signal is associated with a number and a name. Information on the different signals can be found by using the following command:$ man –s 5 signal The kill command sends a signal to a process. By doing this the kill command enables terminating unwanted command processes. It is useful when there is a need to stop a command that takes a long time to run, or when there is a need to terminate a process that you can not quit in the normal way.In order to send a signal to a process, it’s PID has to be known. Use the ps command to get the PID. After finding the process PID, type kill followed by the PID.If you use the kill command without specifying a signal, signal 15 (SIGTERM) is sent to the process with the specified PID number. This usually causes the process to terminate.Example:$ ps -u userd1 PID TTY TIME CMD 25190 pts/0 0:02 ls 25083 pts/0 0:00 ksh$ kill 25190$ jobs[1] + Terminated ls -R / > /dev/null 2>&1 &$ Use the –u option of the ps command to find the processes that the user userd1 is running. Then the ls command is terminated with the kill command. If you need to forcibly terminate a process, you can append the –9 option to the kill command. This option is necessary for killing shells which do not respond to any other signal to terminate.Command format:$ kill –9 pid WARNING – For processes other then shell, use kill –9 command as a last resort because it is an abrupt method and does not allow for proper process termination. To abort a background job, use the specific job number as an argument to the kill command:$ jobs[1] + Running ls -R / > /dev/null 2>&1 &$$$ kill %1[1] + Terminated ls -R / > /dev/null 2>&1 &$ The pkill command works exactly like the pgrep command, except that it terminates the matching process or processes with a kill signal:$ ls -R / > /dev/null 2>&1 &[1] 25387$ $ pkill ls$ jobs[1] + Terminated ls -R / > /dev/null 2>&1 &$