SlideShare a Scribd company logo
Understanding the Linux 
operating system
PERFORMANCE TUNING 
Performance tuning is a challenging task that requires in-depth 
understanding of the hardware, operating system, and application.
LINUX PROCESS MANAGEMENT 
Process management is one of the most important roles of any 
operating system. 
Linux process management implementation is similar to UNIX® 
implementation. It includes process scheduling, interrupt handling, 
signaling, process prioritization, process switching, process state, 
process memory, and so on.
WHAT IS A PROCESS 
A process is an instance of execution that runs on a processor. The 
process uses any resources that the Linux kernel can handle to 
complete its task.
LIFE CYCLE OF A PROCESS 
Every process has its own life cycle such as creation, execution, 
termination, and removal. These phases will be repeated literally 
millions of times as long as the system is up and running. Therefore, 
the process life cycle is very important from the performance 
perspective.
LIFE CYCLE OF A PROCESS 
When a process creates a new process, the creating process (parent 
process) issues a fork() system call. When a fork() system call is 
issued, it gets a process descriptor for the newly created process 
(child process) and sets a new process id. It copies the values of the 
parent process’ process descriptor to the child’s. At this time the 
entire address space of the parent process is not copied; both 
processes share the same address space.
LIFE CYCLE OF A PROCESS 
The exec() system call copies the new program to the address space 
of the child process. Because both processes share the same address 
space, writing new program data causes a page fault exception. At 
this point, the kernel assigns the new physical page to the child 
process.
LIFE CYCLE OF A PROCESS 
When program execution has completed, the child process terminates 
with an exit() system call. The exit() system call releases most of the 
data structure of the process and notifies the parent process of the 
termination sending a signal
LIFE CYCLE OF A PROCESS 
The child process will not be completely removed until the parent 
process knows of the termination of its child process by the wait() 
system call. As soon as the parent process is notified of the child 
process termination, it removes all the data structure of the child 
process and release the process descriptor.
THREAD 
A thread is an execution unit generated in a single process. It runs 
parallel with other threads in the same process. They can share the 
same resources such as memory, address space, open files, and so 
on. They can access the same set of application data. A thread is also 
called Light Weight Process (LWP). Because they share resources, each 
thread should not change their shared resources at the same time. 
The implementation of mutual exclusion, locking, serialization, and so 
on, are the user application’s responsibility
PROCESS PRIORITY AND NICE 
LEVEL 
Process priority is a number that determines the order in which the 
process is handled by the CPU and is determined by dynamic priority 
and static priority. 
A process which has higher process priority has a greater chance of 
getting permission to run on a processor.
CONTEXT SWITCHING 
During process execution, information on the running process is stored in 
registers on the 
processor and its cache. The set of data that is loaded to the register for the 
executing 
process is called the context. To switch processes, the context of the 
running process is 
stored and the context of the next running process is restored to the 
register. The process 
descriptor and the area called kernel mode stack are used to store the 
context. This switching 
process is called context switching. Having too much context switching is 
undesirable 
because the processor has to flush its register and cache every time to make
INTERRUPT HANDLING 
Interrupt handling is one of the highest priority tasks. Interrupts are usually 
generated by I/O 
devices such as a network interface card, keyboard, disk controller, serial 
adapter, and so on. 
The interrupt handler notifies the Linux kernel of an event (such as keyboard 
input, ethernet 
frame arrival, and so on). It tells the kernel to interrupt process execution 
and perform 
interrupt handling as quickly as possible because some device requires quick 
responsiveness. This is critical for system stability. When an interrupt signal 
arrives to the 
kernel, the kernel must switch a current execution process to a new one to 
handle the
In Linux implementations, there are two types of interrupts. A hard 
interrupt is generated for devices which require responsiveness (disk 
I/O interrupt, network adapter interrupt, keyboard interrupt, mouse 
interrupt). 
A soft interrupt is used for tasks which processing can be deferred 
(TCP/IP operation, SCSI protocol operation, and so on). You can see 
information related to hard interrupts at /proc/interrupts.
PROCESS STATE 
Every process has its own state that shows what is currently happening in 
the process. 
Process state changes during process execution. Some of the possible states 
are as follows: 
TASK_RUNNING 
In this state, a process is running on a CPU or waiting to run in the queue 
(run queue). 
TASK_STOPPED 
A process suspended by certain signals (for example SIGINT, SIGSTOP) is in 
this state. The 
process is waiting to be resumed by a signal such as SIGCONT. 
TASK_INTERRUPTIBLE
In this state, the process is suspended and waits for a certain condition to be 
satisfied. If a process is in TASK_INTERRUPTIBLE state and it receives a signal to 
stop, the process state is changed and operation will be interrupted. A typical 
example of a 
TASK_INTERRUPTIBLE process is a process waiting for keyboard interrupt. 
TASK_UNINTERRUPTIBLE 
Similar to TASK_INTERRUPTIBLE. While a process in TASK_INTERRUPTIBLE state 
can be interrupted, sending a signal does nothing to the process in 
TASK_UNINTERRUPTIBLE state. A typical example of a TASK_UNINTERRUPTIBLE 
process is a process waiting for disk I/O operation. 
TASK_ZOMBIE 
After a process exits with exit() system call, its parent should know of the 
termination. In TASK_ZOMBIE state, a process is waiting for its parent to be 
notified to release all the data structure.
ZOMBIE PROCESSES 
When a process has already terminated, having received a signal to 
do so, it normally takes some time to finish all tasks (such as closing 
open files) before ending itself. In that normally very short time 
frame, the process is a zombie.
PROCESS MEMORY SEGMENTS 
A process uses its own memory area to perform work. The work 
varies depending on the situation and process usage. A process can 
have different workload characteristics and different data size 
requirements. The process has to handle a of variety of data sizes. To 
satisfy this requirement, the Linux kernel uses a dynamic memory 
allocation mechanism for each process.
The process memory area consist of these segments 
Text segment 
The area where executable code is stored. 
Data segment 
The data segment consists of these three areas. 
– Data: The area where initialized data such as static variables are stored. 
– BSS: The area where zero-initialized data is stored. The data is initialized to zero. 
– Heap: The area where malloc() allocates dynamic memory based on the demand. 
The heap grows towards higher addresses. 
Stack segment 
The area where local variables, function parameters, and the return address of a function 
is stored. The stack grows toward lower addresses.
LINUX CPU SCHEDULER 
The basic functionality of any computer is, quite simply, to compute. To be able to 
compute, 
there must be a means to manage the computing resources, or processors, and the 
computing tasks, also known as threads or processes. Thanks to the great work of Ingo 
Molnar, Linux features a kernel using a O(1) algorithm as opposed to the O(n) algorithm 
used 
to describe the former CPU scheduler. The term O(1) refers to a static algorithm, meaning 
that the time taken to choose a process for placing into execution is constant, regardless 
of 
the number of processes. 
The new scheduler scales very well, regardless of process count or processor count, and 
imposes a low overhead on the system. The algorithm uses two process priority arrays: 
1. active 
2. expired

More Related Content

What's hot

OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
Mukesh Chinta
 
Operating systems system structures
Operating systems   system structuresOperating systems   system structures
Operating systems system structures
Mukesh Chinta
 
System calls
System callsSystem calls
System calls
Bernard Senam
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
Suvendu Kumar Dash
 
Chapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresChapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresWayne Jones Jnr
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
Goutam Sahoo
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
Dhaval Sakhiya
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
onu9
 
Shell programming
Shell programmingShell programming
Shell programming
Moayad Moawiah
 
Shell and its types in LINUX
Shell and its types in LINUXShell and its types in LINUX
Shell and its types in LINUX
SHUBHA CHATURVEDI
 
Process in operating system
Process in operating systemProcess in operating system
Process in operating system
Chetan Mahawar
 
Process state in OS
Process state in OSProcess state in OS
Process state in OS
Khushboo Jain
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating systemtittuajay
 
Introduction to MPI
Introduction to MPI Introduction to MPI
Introduction to MPI
Hanif Durad
 
Linux System Programming - File I/O
Linux System Programming - File I/O Linux System Programming - File I/O
Linux System Programming - File I/O
YourHelper1
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
Eddy Reyes
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
vampugani
 
Linux architecture
Linux architectureLinux architecture
Linux architecturemcganesh
 

What's hot (20)

Process scheduling linux
Process scheduling linuxProcess scheduling linux
Process scheduling linux
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
 
Operating systems system structures
Operating systems   system structuresOperating systems   system structures
Operating systems system structures
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
 
System calls
System callsSystem calls
System calls
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
 
Chapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresChapter 2 - Operating System Structures
Chapter 2 - Operating System Structures
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
 
Shell programming
Shell programmingShell programming
Shell programming
 
Shell and its types in LINUX
Shell and its types in LINUXShell and its types in LINUX
Shell and its types in LINUX
 
Process in operating system
Process in operating systemProcess in operating system
Process in operating system
 
Process state in OS
Process state in OSProcess state in OS
Process state in OS
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating system
 
Introduction to MPI
Introduction to MPI Introduction to MPI
Introduction to MPI
 
Linux System Programming - File I/O
Linux System Programming - File I/O Linux System Programming - File I/O
Linux System Programming - File I/O
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 

Similar to Linux process management

Linux process management
Linux process managementLinux process management
Linux process managementRaghu nath
 
Operating System 3
Operating System 3Operating System 3
Operating System 3tech2click
 
Week 11Linux InternalsProcesses, schedulingLecture o.docx
Week 11Linux InternalsProcesses, schedulingLecture o.docxWeek 11Linux InternalsProcesses, schedulingLecture o.docx
Week 11Linux InternalsProcesses, schedulingLecture o.docx
melbruce90096
 
Operating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringOperating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - Engineering
Yogesh Santhan
 
Operating system
Operating systemOperating system
Operating system
Mark Muhama
 
Processing management
Processing managementProcessing management
Processing management
Kateri Manglicmot
 
Os
OsOs
OS-Process.pdf
OS-Process.pdfOS-Process.pdf
OS-Process.pdf
Rakibul Rakib
 
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
 
23565104 process-management(2)
23565104 process-management(2)23565104 process-management(2)
23565104 process-management(2)Anuj Malhotra
 
operating system for computer engineering ch3.ppt
operating system for computer engineering ch3.pptoperating system for computer engineering ch3.ppt
operating system for computer engineering ch3.ppt
gezaegebre1
 
Operating Systems
Operating Systems Operating Systems
Operating Systems
Ziyauddin Shaik
 
UNIT II.pptx
UNIT II.pptxUNIT II.pptx
UNIT II.pptx
YogapriyaJ1
 
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationLM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
Mani Deepak Choudhry
 
15. Computer Systems Basic Software 1
15. Computer Systems   Basic Software 115. Computer Systems   Basic Software 1
15. Computer Systems Basic Software 1New Era University
 
Advanced Operating Systems......Process Management
Advanced Operating Systems......Process ManagementAdvanced Operating Systems......Process Management
Advanced Operating Systems......Process Management
Veejeya Kumbhar
 
Operating System-Concepts of Process
Operating System-Concepts of ProcessOperating System-Concepts of Process
Operating System-Concepts of Process
Shipra Swati
 
Operating system ppt
Operating system pptOperating system ppt
Operating system ppt
kaviya kumaresan
 
Operating system ppt
Operating system pptOperating system ppt
Operating system ppt
kaviya kumaresan
 

Similar to Linux process management (20)

Linux process management
Linux process managementLinux process management
Linux process management
 
Operating System 3
Operating System 3Operating System 3
Operating System 3
 
Week 11Linux InternalsProcesses, schedulingLecture o.docx
Week 11Linux InternalsProcesses, schedulingLecture o.docxWeek 11Linux InternalsProcesses, schedulingLecture o.docx
Week 11Linux InternalsProcesses, schedulingLecture o.docx
 
Operating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringOperating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - Engineering
 
Operating system
Operating systemOperating system
Operating system
 
Processing management
Processing managementProcessing management
Processing management
 
Os
OsOs
Os
 
Os
OsOs
Os
 
OS-Process.pdf
OS-Process.pdfOS-Process.pdf
OS-Process.pdf
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its concepts
 
23565104 process-management(2)
23565104 process-management(2)23565104 process-management(2)
23565104 process-management(2)
 
operating system for computer engineering ch3.ppt
operating system for computer engineering ch3.pptoperating system for computer engineering ch3.ppt
operating system for computer engineering ch3.ppt
 
Operating Systems
Operating Systems Operating Systems
Operating Systems
 
UNIT II.pptx
UNIT II.pptxUNIT II.pptx
UNIT II.pptx
 
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationLM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
 
15. Computer Systems Basic Software 1
15. Computer Systems   Basic Software 115. Computer Systems   Basic Software 1
15. Computer Systems Basic Software 1
 
Advanced Operating Systems......Process Management
Advanced Operating Systems......Process ManagementAdvanced Operating Systems......Process Management
Advanced Operating Systems......Process Management
 
Operating System-Concepts of Process
Operating System-Concepts of ProcessOperating System-Concepts of Process
Operating System-Concepts of Process
 
Operating system ppt
Operating system pptOperating system ppt
Operating system ppt
 
Operating system ppt
Operating system pptOperating system ppt
Operating system ppt
 

More from Raghu nath

Mongo db
Mongo dbMongo db
Mongo db
Raghu nath
 
Ftp (file transfer protocol)
Ftp (file transfer protocol)Ftp (file transfer protocol)
Ftp (file transfer protocol)
Raghu nath
 
Javascript part1
Javascript part1Javascript part1
Javascript part1Raghu nath
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsRaghu nath
 
Selection sort
Selection sortSelection sort
Selection sortRaghu nath
 
Binary search
Binary search Binary search
Binary search Raghu nath
 
JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)Raghu nath
 
Stemming algorithms
Stemming algorithmsStemming algorithms
Stemming algorithmsRaghu nath
 
Step by step guide to install dhcp role
Step by step guide to install dhcp roleStep by step guide to install dhcp role
Step by step guide to install dhcp roleRaghu nath
 
Network essentials chapter 4
Network essentials  chapter 4Network essentials  chapter 4
Network essentials chapter 4Raghu nath
 
Network essentials chapter 3
Network essentials  chapter 3Network essentials  chapter 3
Network essentials chapter 3Raghu nath
 
Network essentials chapter 2
Network essentials  chapter 2Network essentials  chapter 2
Network essentials chapter 2Raghu nath
 
Network essentials - chapter 1
Network essentials - chapter 1Network essentials - chapter 1
Network essentials - chapter 1Raghu nath
 
Python chapter 2
Python chapter 2Python chapter 2
Python chapter 2Raghu nath
 
python chapter 1
python chapter 1python chapter 1
python chapter 1Raghu nath
 
Linux Shell Scripting
Linux Shell ScriptingLinux Shell Scripting
Linux Shell ScriptingRaghu nath
 

More from Raghu nath (20)

Mongo db
Mongo dbMongo db
Mongo db
 
Ftp (file transfer protocol)
Ftp (file transfer protocol)Ftp (file transfer protocol)
Ftp (file transfer protocol)
 
MS WORD 2013
MS WORD 2013MS WORD 2013
MS WORD 2013
 
Msword
MswordMsword
Msword
 
Ms word
Ms wordMs word
Ms word
 
Javascript part1
Javascript part1Javascript part1
Javascript part1
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Selection sort
Selection sortSelection sort
Selection sort
 
Binary search
Binary search Binary search
Binary search
 
JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)
 
Stemming algorithms
Stemming algorithmsStemming algorithms
Stemming algorithms
 
Step by step guide to install dhcp role
Step by step guide to install dhcp roleStep by step guide to install dhcp role
Step by step guide to install dhcp role
 
Network essentials chapter 4
Network essentials  chapter 4Network essentials  chapter 4
Network essentials chapter 4
 
Network essentials chapter 3
Network essentials  chapter 3Network essentials  chapter 3
Network essentials chapter 3
 
Network essentials chapter 2
Network essentials  chapter 2Network essentials  chapter 2
Network essentials chapter 2
 
Network essentials - chapter 1
Network essentials - chapter 1Network essentials - chapter 1
Network essentials - chapter 1
 
Python chapter 2
Python chapter 2Python chapter 2
Python chapter 2
 
python chapter 1
python chapter 1python chapter 1
python chapter 1
 
Linux Shell Scripting
Linux Shell ScriptingLinux Shell Scripting
Linux Shell Scripting
 
Perl
PerlPerl
Perl
 

Recently uploaded

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 

Recently uploaded (20)

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 

Linux process management

  • 1. Understanding the Linux operating system
  • 2. PERFORMANCE TUNING Performance tuning is a challenging task that requires in-depth understanding of the hardware, operating system, and application.
  • 3. LINUX PROCESS MANAGEMENT Process management is one of the most important roles of any operating system. Linux process management implementation is similar to UNIX® implementation. It includes process scheduling, interrupt handling, signaling, process prioritization, process switching, process state, process memory, and so on.
  • 4. WHAT IS A PROCESS A process is an instance of execution that runs on a processor. The process uses any resources that the Linux kernel can handle to complete its task.
  • 5. LIFE CYCLE OF A PROCESS Every process has its own life cycle such as creation, execution, termination, and removal. These phases will be repeated literally millions of times as long as the system is up and running. Therefore, the process life cycle is very important from the performance perspective.
  • 6. LIFE CYCLE OF A PROCESS When a process creates a new process, the creating process (parent process) issues a fork() system call. When a fork() system call is issued, it gets a process descriptor for the newly created process (child process) and sets a new process id. It copies the values of the parent process’ process descriptor to the child’s. At this time the entire address space of the parent process is not copied; both processes share the same address space.
  • 7. LIFE CYCLE OF A PROCESS The exec() system call copies the new program to the address space of the child process. Because both processes share the same address space, writing new program data causes a page fault exception. At this point, the kernel assigns the new physical page to the child process.
  • 8. LIFE CYCLE OF A PROCESS When program execution has completed, the child process terminates with an exit() system call. The exit() system call releases most of the data structure of the process and notifies the parent process of the termination sending a signal
  • 9. LIFE CYCLE OF A PROCESS The child process will not be completely removed until the parent process knows of the termination of its child process by the wait() system call. As soon as the parent process is notified of the child process termination, it removes all the data structure of the child process and release the process descriptor.
  • 10. THREAD A thread is an execution unit generated in a single process. It runs parallel with other threads in the same process. They can share the same resources such as memory, address space, open files, and so on. They can access the same set of application data. A thread is also called Light Weight Process (LWP). Because they share resources, each thread should not change their shared resources at the same time. The implementation of mutual exclusion, locking, serialization, and so on, are the user application’s responsibility
  • 11. PROCESS PRIORITY AND NICE LEVEL Process priority is a number that determines the order in which the process is handled by the CPU and is determined by dynamic priority and static priority. A process which has higher process priority has a greater chance of getting permission to run on a processor.
  • 12. CONTEXT SWITCHING During process execution, information on the running process is stored in registers on the processor and its cache. The set of data that is loaded to the register for the executing process is called the context. To switch processes, the context of the running process is stored and the context of the next running process is restored to the register. The process descriptor and the area called kernel mode stack are used to store the context. This switching process is called context switching. Having too much context switching is undesirable because the processor has to flush its register and cache every time to make
  • 13. INTERRUPT HANDLING Interrupt handling is one of the highest priority tasks. Interrupts are usually generated by I/O devices such as a network interface card, keyboard, disk controller, serial adapter, and so on. The interrupt handler notifies the Linux kernel of an event (such as keyboard input, ethernet frame arrival, and so on). It tells the kernel to interrupt process execution and perform interrupt handling as quickly as possible because some device requires quick responsiveness. This is critical for system stability. When an interrupt signal arrives to the kernel, the kernel must switch a current execution process to a new one to handle the
  • 14. In Linux implementations, there are two types of interrupts. A hard interrupt is generated for devices which require responsiveness (disk I/O interrupt, network adapter interrupt, keyboard interrupt, mouse interrupt). A soft interrupt is used for tasks which processing can be deferred (TCP/IP operation, SCSI protocol operation, and so on). You can see information related to hard interrupts at /proc/interrupts.
  • 15. PROCESS STATE Every process has its own state that shows what is currently happening in the process. Process state changes during process execution. Some of the possible states are as follows: TASK_RUNNING In this state, a process is running on a CPU or waiting to run in the queue (run queue). TASK_STOPPED A process suspended by certain signals (for example SIGINT, SIGSTOP) is in this state. The process is waiting to be resumed by a signal such as SIGCONT. TASK_INTERRUPTIBLE
  • 16. In this state, the process is suspended and waits for a certain condition to be satisfied. If a process is in TASK_INTERRUPTIBLE state and it receives a signal to stop, the process state is changed and operation will be interrupted. A typical example of a TASK_INTERRUPTIBLE process is a process waiting for keyboard interrupt. TASK_UNINTERRUPTIBLE Similar to TASK_INTERRUPTIBLE. While a process in TASK_INTERRUPTIBLE state can be interrupted, sending a signal does nothing to the process in TASK_UNINTERRUPTIBLE state. A typical example of a TASK_UNINTERRUPTIBLE process is a process waiting for disk I/O operation. TASK_ZOMBIE After a process exits with exit() system call, its parent should know of the termination. In TASK_ZOMBIE state, a process is waiting for its parent to be notified to release all the data structure.
  • 17. ZOMBIE PROCESSES When a process has already terminated, having received a signal to do so, it normally takes some time to finish all tasks (such as closing open files) before ending itself. In that normally very short time frame, the process is a zombie.
  • 18. PROCESS MEMORY SEGMENTS A process uses its own memory area to perform work. The work varies depending on the situation and process usage. A process can have different workload characteristics and different data size requirements. The process has to handle a of variety of data sizes. To satisfy this requirement, the Linux kernel uses a dynamic memory allocation mechanism for each process.
  • 19. The process memory area consist of these segments Text segment The area where executable code is stored. Data segment The data segment consists of these three areas. – Data: The area where initialized data such as static variables are stored. – BSS: The area where zero-initialized data is stored. The data is initialized to zero. – Heap: The area where malloc() allocates dynamic memory based on the demand. The heap grows towards higher addresses. Stack segment The area where local variables, function parameters, and the return address of a function is stored. The stack grows toward lower addresses.
  • 20. LINUX CPU SCHEDULER The basic functionality of any computer is, quite simply, to compute. To be able to compute, there must be a means to manage the computing resources, or processors, and the computing tasks, also known as threads or processes. Thanks to the great work of Ingo Molnar, Linux features a kernel using a O(1) algorithm as opposed to the O(n) algorithm used to describe the former CPU scheduler. The term O(1) refers to a static algorithm, meaning that the time taken to choose a process for placing into execution is constant, regardless of the number of processes. The new scheduler scales very well, regardless of process count or processor count, and imposes a low overhead on the system. The algorithm uses two process priority arrays: 1. active 2. expired