SlideShare una empresa de Scribd logo
1 de 20
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

Más contenido relacionado

La actualidad más candente

Signal Handling in Linux
Signal Handling in LinuxSignal Handling in Linux
Signal Handling in LinuxTushar B Kute
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxLECO9
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.Ravi Kumar Patel
 
File system Os
File system OsFile system Os
File system OsNehal Naik
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process managementArnav Chowdhury
 
Process management in os
Process management in osProcess management in os
Process management in osMiong Lazaro
 
Processes in unix
Processes in unixProcesses in unix
Processes in unixmiau_max
 
Process management os concept
Process management os conceptProcess management os concept
Process management os conceptpriyadeosarkar91
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)Prakhar Maurya
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OSMsAnita2
 
Transactions and Concurrency Control
Transactions and Concurrency ControlTransactions and Concurrency Control
Transactions and Concurrency ControlDilum Bandara
 
Shell and its types in LINUX
Shell and its types in LINUXShell and its types in LINUX
Shell and its types in LINUXSHUBHA CHATURVEDI
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating systemtittuajay
 
Unix operating system architecture with file structure
Unix operating system architecture with file structure Unix operating system architecture with file structure
Unix operating system architecture with file structure amol_chavan
 

La actualidad más candente (20)

Signal Handling in Linux
Signal Handling in LinuxSignal Handling in Linux
Signal Handling in Linux
 
operating system structure
operating system structureoperating system structure
operating system structure
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptx
 
Processes and threads
Processes and threadsProcesses and threads
Processes and threads
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
Boot process
Boot processBoot process
Boot process
 
System call
System callSystem call
System call
 
File system Os
File system OsFile system Os
File system Os
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
 
Process management in os
Process management in osProcess management in os
Process management in os
 
Processes in unix
Processes in unixProcesses in unix
Processes in unix
 
Process management os concept
Process management os conceptProcess management os concept
Process management os concept
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OS
 
Transactions and Concurrency Control
Transactions and Concurrency ControlTransactions and Concurrency Control
Transactions and Concurrency Control
 
Shell and its types in LINUX
Shell and its types in LINUXShell and its types in LINUX
Shell and its types in LINUX
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating system
 
Unix operating system architecture with file structure
Unix operating system architecture with file structure Unix operating system architecture with file structure
Unix operating system architecture with file structure
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 

Similar a 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.docxmelbruce90096
 
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 - EngineeringYogesh Santhan
 
Operating system
Operating systemOperating system
Operating systemMark Muhama
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its conceptsKaran Thakkar
 
23565104 process-management(2)
23565104 process-management(2)23565104 process-management(2)
23565104 process-management(2)Anuj Malhotra
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process ConceptsMukesh Chinta
 
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.pptgezaegebre1
 
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationLM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationMani 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 ManagementVeejeya Kumbhar
 
Operating System-Concepts of Process
Operating System-Concepts of ProcessOperating System-Concepts of Process
Operating System-Concepts of ProcessShipra Swati
 

Similar a 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)
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
 
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
 

Más de 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
 

Más de 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
 

Último

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Último (20)

Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

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