SlideShare a Scribd company logo
1 of 35
Download to read offline
Linux Kernel
+ Linux Kernel Architecture
What is Linux ?
What is the Linux Kernel ?
How does the Kernel effect system
performance ?
+ Kernel
P
P
P P P
P
H
H H H
Kernel
+ Linux Kernel Architecture
Monolithic Kernel (diigo.com/085lp2)
Supports for System Calls (diigo.com/085lq5)
Support for Loadable Modules
Implements Preemptive Multitasking
Virtual Memory / Filesystem
Demand Paging / Loading
etc..
+ Linux Kernel Architecture
Kernel Function Libraries
– System (/proc, generic drivers)
– Networking (TCP, sockets, drivers)
– Storage (VFS, block devices)
– Memory (VM, PM)
– Processing (scheduler, fork, exec)
– Human Interface (HI devices)
+ Linux Kernel Architecture
Kernel Layers
– User space interface
– Virtual subsystem
– L2V bridge / transformer
– Logical subsystem
– Hardware interface
+ Linux Kernel Architecture
www.makelinux.net/kernel_map/
+ Linux Kernel and Processes
Linux Kernel and Processes
The Linux Kernel supports preemptive multitasking
(diigo.com/085lqo) which allows multiple processes
to run individually at the same time while prioritising
these with higher importance
What is a “Context Switch” ?
+ Linux Kernel and Processes
Context Switch
In order to support multi tasking a context switch
is being handled
Context switch stores or restores the CPU state
to where is 'stopped' before the last CS
+ Linux Kernel and Processes
Context switch can be forced by an interrupt
timer in case of a low latency operation
e.g: Disk I/O
Context Switch is also being used in order to
handle Interrupt requests
e.g: Completed read request
+ Linux Kernel and Processes
Context switch is being handled by the OS
Each process stack has a Process Control Block
which holds the relevant meta data for the CS
e.g: Program Counter, Registers Address List
Some CPUs (all x86 variants included) has a
Task State Segment (TSS) which is used to
store the PCB
+ Linux Kernel and Processes
In case a process needs to transite to Kernel
mode (during a system call) a Mode Switch is
being initiated
Price
Context switch is the most resource consuming
task of the OS.
+ Linux Kernel and Processes
To review Context Switch statistics use
– 'sar -w'
– 'vmstat'
Exercise:
 - Review the reciprocal relations between
User / System CPU utilization and CS
+ Linux Kernel and Processes
To review an individual process structure use
– 'pmap'
Exercise
 - Review the structure of several
processes. Can you identify the process
stack ?
+ Linux Kernel and Processes
CPU Scheduler
The Linux Kernel has a power full and high
performance CPU scheduler.
The CUP scheduler is designed to provide the
most appropriate amount of CPU [time]slices
– Scheduling is based on a dynamic
process priority rank
– Priority is changed to make sure no
process is 'hogging' the CUP nor starving
+ Linux Kernel and Processes
CPU Scheduler
– For each CPU the scheduler maintain
two priority ordered arrays for active and
expired tasks. After the active one is
done arrays are swapped
(Exception: diigo.com/085lrk)
4
3
2
1
4
3
2
1
+ Linux Kernel and Processes
CPU Scheduler
– The scheduling policy involves assessing
the priority for each task
– There are two classifications for tasks in
terms of scheduling
• CPU bound
• I/O bound
 These can be either Interactive, Batch or
RT processes
+ Linux Kernel and Processes
CPU Scheduler
– Process pre-emption occurs, when a
process receives a hardware interrupt
– Pre-emptive kernel, can ‘prefer’ a user
mode process over a kernel mode
process (even during an exception
handling), in order to support interactivity
+ Linux Kernel and Processes
CPU Scheduler
– When setting ‘nice’ value to a process, one
set a static portion of the scheduler priority
for that task
– Exercise
 ‘grep a /etc/services >/dev/null’
 Can you ‘tune’ this command group to
run faster ?
+ Linux Kernel and Processes
Multi Threading
Multi Threading is being used in order to have
several processing objects within the same
process
– Each Thread is being scheduled
separately by the Kernel
– Multiple threads share the same Memory
segment
+ Linux Kernel and Processes
Symmetric Multi Process systems can run
threads of the same process simultaneously
Linux implements 1-1 (1 scheduling object per
thread) threading via the Native Posix Thread
Library (NTPL)
* Just like Solaris and FreeBSD
+ Linux Kernel and Processes
To review Threads information use
– 'ps -eLf'
Exercise
– Can you identify multi threaded
processes on your system ?
– Can you find any difference between PID
and Thread ID ?
+ Inter Process Communication
IPC
IPC is an implementation of techniques to
exchange data between different threads
IPC can be used internally or across a computer
network
+ Inter Process Communication
IPC has 4 techniques
– Message passing
– Synchronization
– Shared memory
– Remote procedure call
+ Inter Process Communication
Message passing
Message can be a signal or data packet
Passing can be synchronous or asynchronous
Synchronisation
Used in order to keep several threads
synchronized and able to provide the same /
parallel service(s)
+ Inter Process Communication
Shared memory
Simply a shared form of memory
No control from of OS side
RPC
Method of running a procedure (subroutine) on a
remote process
+ Inter Process Communication
IPC implementations
PIPE – pass data between hierarchy related
threads
FIFO – pass data between non-related threads
Socket – pass large amount of data. Can
implement TCP internally
Shared Memory (SHM) – share defined amount
of storage between threads
+ Inter Process Communication
IPC implementations
Semaphore (SEM) – shared abstract data (like a
class) used to control access on a shared
resource
+ Inter Process Communication
IPC
Use the following commands to review IPC
information
– 'ipcs' – Review SHM, SEM, MSG
– 'ipcrm' – clean up IPC objects
– 'rpcinfo' – Review RPC
– 'popen' – Create a PIPE
– 'mkfifo' – Create a FIFO pipe
 *Try 'man ipc'
+ Inter Process Communication
IPC
Exercise
– Review IPC information on your system
Are there any SHMs ?
– Review RPC Services available on your
system
– Create a named pipe. Try to use it to pass a
message between two processes
(e.g: bash)
Can you name any advantages of using
fifo ?
+ Linux Kernel
Kernel Tune able parameters
Changing the kernel's behaviour when working
with processes, IPC, etc
Tune able parameters can be used via the '/proc'
filesystem or the 'syscall' command
+ Linux Kernel
Kernel Tune able parameters
General parameters
– 'ctrl-alt-del': sets the kernel reaction to
'ctrl-alt-del' key sequence
– 'domainname': sets machine's domain
name
– 'hostname': sets machine's host name
– 'panic': sets timer before restart after panic
– 'pid_max': sets maximum PID number
+ Linux Kernel
Kernel Tune able parameters
IPC parameters
– 'shmax': maximum size of shared memory
segment (bytes)
– 'shmall': total amount of shared memory
pages system wide
– 'shmmni': maximun number of shared
memory segments system wide
+ Linux Kernel
Kernel Tune able parameters
IPC parameters
– 'sem': holds 4 parameters
• maximum semaphores per array
• total maximum semaphores
• maximum operations per semaphore
operation call
• total maximum arrays
+ Linux Kernel
Kernel Tune able parameters
IPC parameters
– 'msgmni': maximun message queues
system wide
– 'msgmax': maximum size of message
(bytes)
– 'msgmnb': maximum size of queue (bytes)

More Related Content

What's hot

Linux kernel memory allocators
Linux kernel memory allocatorsLinux kernel memory allocators
Linux kernel memory allocatorsHao-Ran Liu
 
Process Scheduler and Balancer in Linux Kernel
Process Scheduler and Balancer in Linux KernelProcess Scheduler and Balancer in Linux Kernel
Process Scheduler and Balancer in Linux KernelHaifeng Li
 
Architecture Of The Linux Kernel
Architecture Of The Linux KernelArchitecture Of The Linux Kernel
Architecture Of The Linux Kernelguest547d74
 
Linux操作系统01 简介
Linux操作系统01 简介Linux操作系统01 简介
Linux操作系统01 简介lclsg123
 
Spectrum Scale Best Practices by Olaf Weiser
Spectrum Scale Best Practices by Olaf WeiserSpectrum Scale Best Practices by Olaf Weiser
Spectrum Scale Best Practices by Olaf WeiserSandeep Patil
 
Multiple processor systems
Multiple processor systemsMultiple processor systems
Multiple processor systemsjeetesh036
 
Linux Kernel Tour
Linux Kernel TourLinux Kernel Tour
Linux Kernel Toursamrat das
 
Highly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackupHighly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackupNilnandan Joshi
 
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. TanenbaumA Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaumeurobsdcon
 
Backup, Restore, and Disaster Recovery
Backup, Restore, and Disaster RecoveryBackup, Restore, and Disaster Recovery
Backup, Restore, and Disaster RecoveryMongoDB
 
Linux Performance Analysis and Tools
Linux Performance Analysis and ToolsLinux Performance Analysis and Tools
Linux Performance Analysis and ToolsBrendan Gregg
 
NetBSD and Linux for Embedded Systems
NetBSD and Linux for Embedded SystemsNetBSD and Linux for Embedded Systems
NetBSD and Linux for Embedded SystemsMahendra M
 
Running Applications on the NetBSD Rump Kernel by Justin Cormack
Running Applications on the NetBSD Rump Kernel by Justin Cormack Running Applications on the NetBSD Rump Kernel by Justin Cormack
Running Applications on the NetBSD Rump Kernel by Justin Cormack eurobsdcon
 
Ibm spectrum scale fundamentals workshop for americas part 4 Replication, Str...
Ibm spectrum scale fundamentals workshop for americas part 4 Replication, Str...Ibm spectrum scale fundamentals workshop for americas part 4 Replication, Str...
Ibm spectrum scale fundamentals workshop for americas part 4 Replication, Str...xKinAnx
 
Collaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAsCollaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAsNelson Calero
 

What's hot (20)

Linux introduction
Linux introductionLinux introduction
Linux introduction
 
Linux kernel memory allocators
Linux kernel memory allocatorsLinux kernel memory allocators
Linux kernel memory allocators
 
Basic Linux kernel
Basic Linux kernelBasic Linux kernel
Basic Linux kernel
 
Process Scheduler and Balancer in Linux Kernel
Process Scheduler and Balancer in Linux KernelProcess Scheduler and Balancer in Linux Kernel
Process Scheduler and Balancer in Linux Kernel
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Process scheduling linux
Process scheduling linuxProcess scheduling linux
Process scheduling linux
 
Architecture Of The Linux Kernel
Architecture Of The Linux KernelArchitecture Of The Linux Kernel
Architecture Of The Linux Kernel
 
Linux操作系统01 简介
Linux操作系统01 简介Linux操作系统01 简介
Linux操作系统01 简介
 
Spectrum Scale Best Practices by Olaf Weiser
Spectrum Scale Best Practices by Olaf WeiserSpectrum Scale Best Practices by Olaf Weiser
Spectrum Scale Best Practices by Olaf Weiser
 
Multiple processor systems
Multiple processor systemsMultiple processor systems
Multiple processor systems
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
Linux Kernel Tour
Linux Kernel TourLinux Kernel Tour
Linux Kernel Tour
 
Highly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackupHighly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackup
 
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. TanenbaumA Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
 
Backup, Restore, and Disaster Recovery
Backup, Restore, and Disaster RecoveryBackup, Restore, and Disaster Recovery
Backup, Restore, and Disaster Recovery
 
Linux Performance Analysis and Tools
Linux Performance Analysis and ToolsLinux Performance Analysis and Tools
Linux Performance Analysis and Tools
 
NetBSD and Linux for Embedded Systems
NetBSD and Linux for Embedded SystemsNetBSD and Linux for Embedded Systems
NetBSD and Linux for Embedded Systems
 
Running Applications on the NetBSD Rump Kernel by Justin Cormack
Running Applications on the NetBSD Rump Kernel by Justin Cormack Running Applications on the NetBSD Rump Kernel by Justin Cormack
Running Applications on the NetBSD Rump Kernel by Justin Cormack
 
Ibm spectrum scale fundamentals workshop for americas part 4 Replication, Str...
Ibm spectrum scale fundamentals workshop for americas part 4 Replication, Str...Ibm spectrum scale fundamentals workshop for americas part 4 Replication, Str...
Ibm spectrum scale fundamentals workshop for americas part 4 Replication, Str...
 
Collaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAsCollaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAs
 

Viewers also liked

chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinuxShay Cohen
 
Infra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationInfra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationShay Cohen
 
01 linux history overview
01 linux history overview01 linux history overview
01 linux history overviewShay Cohen
 
09 string processing_with_regex copy
09 string processing_with_regex copy09 string processing_with_regex copy
09 string processing_with_regex copyShay Cohen
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissionsShay Cohen
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editorShay Cohen
 
05 standard io_and_pipes
05 standard io_and_pipes05 standard io_and_pipes
05 standard io_and_pipesShay Cohen
 
10 finding files
10 finding files10 finding files
10 finding filesShay Cohen
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystemShay Cohen
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving toolsShay Cohen
 
02 linux desktop usage
02 linux desktop usage02 linux desktop usage
02 linux desktop usageShay Cohen
 
04 using and_configuring_bash
04 using and_configuring_bash04 using and_configuring_bash
04 using and_configuring_bashShay Cohen
 
13 process management
13 process management13 process management
13 process managementShay Cohen
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copyShay Cohen
 
14 network tools
14 network tools14 network tools
14 network toolsShay Cohen
 
08 text processing_tools
08 text processing_tools08 text processing_tools
08 text processing_toolsShay Cohen
 

Viewers also liked (16)

chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinux
 
Infra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationInfra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automation
 
01 linux history overview
01 linux history overview01 linux history overview
01 linux history overview
 
09 string processing_with_regex copy
09 string processing_with_regex copy09 string processing_with_regex copy
09 string processing_with_regex copy
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissions
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editor
 
05 standard io_and_pipes
05 standard io_and_pipes05 standard io_and_pipes
05 standard io_and_pipes
 
10 finding files
10 finding files10 finding files
10 finding files
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystem
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving tools
 
02 linux desktop usage
02 linux desktop usage02 linux desktop usage
02 linux desktop usage
 
04 using and_configuring_bash
04 using and_configuring_bash04 using and_configuring_bash
04 using and_configuring_bash
 
13 process management
13 process management13 process management
13 process management
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
 
14 network tools
14 network tools14 network tools
14 network tools
 
08 text processing_tools
08 text processing_tools08 text processing_tools
08 text processing_tools
 

Similar to Linux Performance Tunning Kernel

Similar to Linux Performance Tunning Kernel (20)

Runos OpenFlow Controller (eng)
Runos OpenFlow Controller (eng)Runos OpenFlow Controller (eng)
Runos OpenFlow Controller (eng)
 
Linux Device Driver,LDD,
Linux Device Driver,LDD,Linux Device Driver,LDD,
Linux Device Driver,LDD,
 
linux device driver
linux device driverlinux device driver
linux device driver
 
Visual comparison of Unix-like systems & Virtualisation
Visual comparison of Unix-like systems & VirtualisationVisual comparison of Unix-like systems & Virtualisation
Visual comparison of Unix-like systems & Virtualisation
 
Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)
 
Unix _linux_fundamentals_for_hpc-_b
Unix  _linux_fundamentals_for_hpc-_bUnix  _linux_fundamentals_for_hpc-_b
Unix _linux_fundamentals_for_hpc-_b
 
Linux
LinuxLinux
Linux
 
ubantu ppt.pptx
ubantu ppt.pptxubantu ppt.pptx
ubantu ppt.pptx
 
Chap1_Part2.pptx
Chap1_Part2.pptxChap1_Part2.pptx
Chap1_Part2.pptx
 
Realizing Linux Containers (LXC)
Realizing Linux Containers (LXC)Realizing Linux Containers (LXC)
Realizing Linux Containers (LXC)
 
Linux-Internals-and-Networking
Linux-Internals-and-NetworkingLinux-Internals-and-Networking
Linux-Internals-and-Networking
 
Ubuntu OS Presentation
Ubuntu OS PresentationUbuntu OS Presentation
Ubuntu OS Presentation
 
First steps on CentOs7
First steps on CentOs7First steps on CentOs7
First steps on CentOs7
 
Unix operating system basics
Unix operating system basicsUnix operating system basics
Unix operating system basics
 
Chapter 6 os
Chapter 6 osChapter 6 os
Chapter 6 os
 
Os
OsOs
Os
 
Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
 
Linux Container Brief for IEEE WG P2302
Linux Container Brief for IEEE WG P2302Linux Container Brief for IEEE WG P2302
Linux Container Brief for IEEE WG P2302
 
lesson05.ppt
lesson05.pptlesson05.ppt
lesson05.ppt
 

Recently uploaded

2024-04-09 - Pension Playpen roundtable - slides.pptx
2024-04-09 - Pension Playpen roundtable - slides.pptx2024-04-09 - Pension Playpen roundtable - slides.pptx
2024-04-09 - Pension Playpen roundtable - slides.pptxHenry Tapper
 
10 QuickBooks Tips 2024 - Globus Finanza.pdf
10 QuickBooks Tips 2024 - Globus Finanza.pdf10 QuickBooks Tips 2024 - Globus Finanza.pdf
10 QuickBooks Tips 2024 - Globus Finanza.pdfglobusfinanza
 
Money Forward Integrated Report “Forward Map” 2024
Money Forward Integrated Report “Forward Map” 2024Money Forward Integrated Report “Forward Map” 2024
Money Forward Integrated Report “Forward Map” 2024Money Forward
 
Zimbabwe's New Gold-Backed Currency- A Path to Stability or Another Monetary.pdf
Zimbabwe's New Gold-Backed Currency- A Path to Stability or Another Monetary.pdfZimbabwe's New Gold-Backed Currency- A Path to Stability or Another Monetary.pdf
Zimbabwe's New Gold-Backed Currency- A Path to Stability or Another Monetary.pdfFREELANCER
 
ΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτος
ΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτοςΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτος
ΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτοςNewsroom8
 
Hello this ppt is about seminar final project
Hello this ppt is about seminar final projectHello this ppt is about seminar final project
Hello this ppt is about seminar final projectninnasirsi
 
OAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptx
OAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptxOAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptx
OAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptxhiddenlevers
 
Building pressure? Rising rents, and what to expect in the future
Building pressure? Rising rents, and what to expect in the futureBuilding pressure? Rising rents, and what to expect in the future
Building pressure? Rising rents, and what to expect in the futureResolutionFoundation
 
Global Economic Outlook, 2024 - Scholaride Consulting
Global Economic Outlook, 2024 - Scholaride ConsultingGlobal Economic Outlook, 2024 - Scholaride Consulting
Global Economic Outlook, 2024 - Scholaride Consultingswastiknandyofficial
 
Aon-UK-DC-Pension-Tracker-Q1-2024. slideshare
Aon-UK-DC-Pension-Tracker-Q1-2024. slideshareAon-UK-DC-Pension-Tracker-Q1-2024. slideshare
Aon-UK-DC-Pension-Tracker-Q1-2024. slideshareHenry Tapper
 
Uk-NO1 Rohani Amil In Islamabad Amil Baba in Rawalpindi Kala Jadu Amil In Raw...
Uk-NO1 Rohani Amil In Islamabad Amil Baba in Rawalpindi Kala Jadu Amil In Raw...Uk-NO1 Rohani Amil In Islamabad Amil Baba in Rawalpindi Kala Jadu Amil In Raw...
Uk-NO1 Rohani Amil In Islamabad Amil Baba in Rawalpindi Kala Jadu Amil In Raw...Amil baba
 
TACLOBAN-CITY-DIVISION-POPQUIZ-2023.pptx
TACLOBAN-CITY-DIVISION-POPQUIZ-2023.pptxTACLOBAN-CITY-DIVISION-POPQUIZ-2023.pptx
TACLOBAN-CITY-DIVISION-POPQUIZ-2023.pptxKathlynVillar
 
2B Nation-State.pptx contemporary world nation
2B  Nation-State.pptx contemporary world nation2B  Nation-State.pptx contemporary world nation
2B Nation-State.pptx contemporary world nationko9240888
 
What is sip and What are its Benefits in 2024
What is sip and What are its Benefits in 2024What is sip and What are its Benefits in 2024
What is sip and What are its Benefits in 2024prajwalgopocket
 
ekthesi-trapeza-tis-ellados-gia-2023.pdf
ekthesi-trapeza-tis-ellados-gia-2023.pdfekthesi-trapeza-tis-ellados-gia-2023.pdf
ekthesi-trapeza-tis-ellados-gia-2023.pdfSteliosTheodorou4
 
Demographic transition and the rise of wealth inequality
Demographic transition and the rise of wealth inequalityDemographic transition and the rise of wealth inequality
Demographic transition and the rise of wealth inequalityGRAPE
 
Introduction to Health Economics Dr. R. Kurinji Malar.pptx
Introduction to Health Economics Dr. R. Kurinji Malar.pptxIntroduction to Health Economics Dr. R. Kurinji Malar.pptx
Introduction to Health Economics Dr. R. Kurinji Malar.pptxDrRkurinjiMalarkurin
 
Banking: Commercial and Central Banking.pptx
Banking: Commercial and Central Banking.pptxBanking: Commercial and Central Banking.pptx
Banking: Commercial and Central Banking.pptxANTHONYAKINYOSOYE1
 
Thoma Bravo Equity - Presentation Pension Fund
Thoma Bravo Equity - Presentation Pension FundThoma Bravo Equity - Presentation Pension Fund
Thoma Bravo Equity - Presentation Pension FundAshwinJey
 

Recently uploaded (19)

2024-04-09 - Pension Playpen roundtable - slides.pptx
2024-04-09 - Pension Playpen roundtable - slides.pptx2024-04-09 - Pension Playpen roundtable - slides.pptx
2024-04-09 - Pension Playpen roundtable - slides.pptx
 
10 QuickBooks Tips 2024 - Globus Finanza.pdf
10 QuickBooks Tips 2024 - Globus Finanza.pdf10 QuickBooks Tips 2024 - Globus Finanza.pdf
10 QuickBooks Tips 2024 - Globus Finanza.pdf
 
Money Forward Integrated Report “Forward Map” 2024
Money Forward Integrated Report “Forward Map” 2024Money Forward Integrated Report “Forward Map” 2024
Money Forward Integrated Report “Forward Map” 2024
 
Zimbabwe's New Gold-Backed Currency- A Path to Stability or Another Monetary.pdf
Zimbabwe's New Gold-Backed Currency- A Path to Stability or Another Monetary.pdfZimbabwe's New Gold-Backed Currency- A Path to Stability or Another Monetary.pdf
Zimbabwe's New Gold-Backed Currency- A Path to Stability or Another Monetary.pdf
 
ΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτος
ΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτοςΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτος
ΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτος
 
Hello this ppt is about seminar final project
Hello this ppt is about seminar final projectHello this ppt is about seminar final project
Hello this ppt is about seminar final project
 
OAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptx
OAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptxOAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptx
OAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptx
 
Building pressure? Rising rents, and what to expect in the future
Building pressure? Rising rents, and what to expect in the futureBuilding pressure? Rising rents, and what to expect in the future
Building pressure? Rising rents, and what to expect in the future
 
Global Economic Outlook, 2024 - Scholaride Consulting
Global Economic Outlook, 2024 - Scholaride ConsultingGlobal Economic Outlook, 2024 - Scholaride Consulting
Global Economic Outlook, 2024 - Scholaride Consulting
 
Aon-UK-DC-Pension-Tracker-Q1-2024. slideshare
Aon-UK-DC-Pension-Tracker-Q1-2024. slideshareAon-UK-DC-Pension-Tracker-Q1-2024. slideshare
Aon-UK-DC-Pension-Tracker-Q1-2024. slideshare
 
Uk-NO1 Rohani Amil In Islamabad Amil Baba in Rawalpindi Kala Jadu Amil In Raw...
Uk-NO1 Rohani Amil In Islamabad Amil Baba in Rawalpindi Kala Jadu Amil In Raw...Uk-NO1 Rohani Amil In Islamabad Amil Baba in Rawalpindi Kala Jadu Amil In Raw...
Uk-NO1 Rohani Amil In Islamabad Amil Baba in Rawalpindi Kala Jadu Amil In Raw...
 
TACLOBAN-CITY-DIVISION-POPQUIZ-2023.pptx
TACLOBAN-CITY-DIVISION-POPQUIZ-2023.pptxTACLOBAN-CITY-DIVISION-POPQUIZ-2023.pptx
TACLOBAN-CITY-DIVISION-POPQUIZ-2023.pptx
 
2B Nation-State.pptx contemporary world nation
2B  Nation-State.pptx contemporary world nation2B  Nation-State.pptx contemporary world nation
2B Nation-State.pptx contemporary world nation
 
What is sip and What are its Benefits in 2024
What is sip and What are its Benefits in 2024What is sip and What are its Benefits in 2024
What is sip and What are its Benefits in 2024
 
ekthesi-trapeza-tis-ellados-gia-2023.pdf
ekthesi-trapeza-tis-ellados-gia-2023.pdfekthesi-trapeza-tis-ellados-gia-2023.pdf
ekthesi-trapeza-tis-ellados-gia-2023.pdf
 
Demographic transition and the rise of wealth inequality
Demographic transition and the rise of wealth inequalityDemographic transition and the rise of wealth inequality
Demographic transition and the rise of wealth inequality
 
Introduction to Health Economics Dr. R. Kurinji Malar.pptx
Introduction to Health Economics Dr. R. Kurinji Malar.pptxIntroduction to Health Economics Dr. R. Kurinji Malar.pptx
Introduction to Health Economics Dr. R. Kurinji Malar.pptx
 
Banking: Commercial and Central Banking.pptx
Banking: Commercial and Central Banking.pptxBanking: Commercial and Central Banking.pptx
Banking: Commercial and Central Banking.pptx
 
Thoma Bravo Equity - Presentation Pension Fund
Thoma Bravo Equity - Presentation Pension FundThoma Bravo Equity - Presentation Pension Fund
Thoma Bravo Equity - Presentation Pension Fund
 

Linux Performance Tunning Kernel

  • 2. + Linux Kernel Architecture What is Linux ? What is the Linux Kernel ? How does the Kernel effect system performance ?
  • 3. + Kernel P P P P P P H H H H Kernel
  • 4. + Linux Kernel Architecture Monolithic Kernel (diigo.com/085lp2) Supports for System Calls (diigo.com/085lq5) Support for Loadable Modules Implements Preemptive Multitasking Virtual Memory / Filesystem Demand Paging / Loading etc..
  • 5. + Linux Kernel Architecture Kernel Function Libraries – System (/proc, generic drivers) – Networking (TCP, sockets, drivers) – Storage (VFS, block devices) – Memory (VM, PM) – Processing (scheduler, fork, exec) – Human Interface (HI devices)
  • 6. + Linux Kernel Architecture Kernel Layers – User space interface – Virtual subsystem – L2V bridge / transformer – Logical subsystem – Hardware interface
  • 7. + Linux Kernel Architecture www.makelinux.net/kernel_map/
  • 8. + Linux Kernel and Processes Linux Kernel and Processes The Linux Kernel supports preemptive multitasking (diigo.com/085lqo) which allows multiple processes to run individually at the same time while prioritising these with higher importance What is a “Context Switch” ?
  • 9. + Linux Kernel and Processes Context Switch In order to support multi tasking a context switch is being handled Context switch stores or restores the CPU state to where is 'stopped' before the last CS
  • 10. + Linux Kernel and Processes Context switch can be forced by an interrupt timer in case of a low latency operation e.g: Disk I/O Context Switch is also being used in order to handle Interrupt requests e.g: Completed read request
  • 11. + Linux Kernel and Processes Context switch is being handled by the OS Each process stack has a Process Control Block which holds the relevant meta data for the CS e.g: Program Counter, Registers Address List Some CPUs (all x86 variants included) has a Task State Segment (TSS) which is used to store the PCB
  • 12. + Linux Kernel and Processes In case a process needs to transite to Kernel mode (during a system call) a Mode Switch is being initiated Price Context switch is the most resource consuming task of the OS.
  • 13. + Linux Kernel and Processes To review Context Switch statistics use – 'sar -w' – 'vmstat' Exercise:  - Review the reciprocal relations between User / System CPU utilization and CS
  • 14. + Linux Kernel and Processes To review an individual process structure use – 'pmap' Exercise  - Review the structure of several processes. Can you identify the process stack ?
  • 15. + Linux Kernel and Processes CPU Scheduler The Linux Kernel has a power full and high performance CPU scheduler. The CUP scheduler is designed to provide the most appropriate amount of CPU [time]slices – Scheduling is based on a dynamic process priority rank – Priority is changed to make sure no process is 'hogging' the CUP nor starving
  • 16. + Linux Kernel and Processes CPU Scheduler – For each CPU the scheduler maintain two priority ordered arrays for active and expired tasks. After the active one is done arrays are swapped (Exception: diigo.com/085lrk) 4 3 2 1 4 3 2 1
  • 17. + Linux Kernel and Processes CPU Scheduler – The scheduling policy involves assessing the priority for each task – There are two classifications for tasks in terms of scheduling • CPU bound • I/O bound  These can be either Interactive, Batch or RT processes
  • 18. + Linux Kernel and Processes CPU Scheduler – Process pre-emption occurs, when a process receives a hardware interrupt – Pre-emptive kernel, can ‘prefer’ a user mode process over a kernel mode process (even during an exception handling), in order to support interactivity
  • 19. + Linux Kernel and Processes CPU Scheduler – When setting ‘nice’ value to a process, one set a static portion of the scheduler priority for that task – Exercise  ‘grep a /etc/services >/dev/null’  Can you ‘tune’ this command group to run faster ?
  • 20. + Linux Kernel and Processes Multi Threading Multi Threading is being used in order to have several processing objects within the same process – Each Thread is being scheduled separately by the Kernel – Multiple threads share the same Memory segment
  • 21. + Linux Kernel and Processes Symmetric Multi Process systems can run threads of the same process simultaneously Linux implements 1-1 (1 scheduling object per thread) threading via the Native Posix Thread Library (NTPL) * Just like Solaris and FreeBSD
  • 22. + Linux Kernel and Processes To review Threads information use – 'ps -eLf' Exercise – Can you identify multi threaded processes on your system ? – Can you find any difference between PID and Thread ID ?
  • 23. + Inter Process Communication IPC IPC is an implementation of techniques to exchange data between different threads IPC can be used internally or across a computer network
  • 24. + Inter Process Communication IPC has 4 techniques – Message passing – Synchronization – Shared memory – Remote procedure call
  • 25. + Inter Process Communication Message passing Message can be a signal or data packet Passing can be synchronous or asynchronous Synchronisation Used in order to keep several threads synchronized and able to provide the same / parallel service(s)
  • 26. + Inter Process Communication Shared memory Simply a shared form of memory No control from of OS side RPC Method of running a procedure (subroutine) on a remote process
  • 27. + Inter Process Communication IPC implementations PIPE – pass data between hierarchy related threads FIFO – pass data between non-related threads Socket – pass large amount of data. Can implement TCP internally Shared Memory (SHM) – share defined amount of storage between threads
  • 28. + Inter Process Communication IPC implementations Semaphore (SEM) – shared abstract data (like a class) used to control access on a shared resource
  • 29. + Inter Process Communication IPC Use the following commands to review IPC information – 'ipcs' – Review SHM, SEM, MSG – 'ipcrm' – clean up IPC objects – 'rpcinfo' – Review RPC – 'popen' – Create a PIPE – 'mkfifo' – Create a FIFO pipe  *Try 'man ipc'
  • 30. + Inter Process Communication IPC Exercise – Review IPC information on your system Are there any SHMs ? – Review RPC Services available on your system – Create a named pipe. Try to use it to pass a message between two processes (e.g: bash) Can you name any advantages of using fifo ?
  • 31. + Linux Kernel Kernel Tune able parameters Changing the kernel's behaviour when working with processes, IPC, etc Tune able parameters can be used via the '/proc' filesystem or the 'syscall' command
  • 32. + Linux Kernel Kernel Tune able parameters General parameters – 'ctrl-alt-del': sets the kernel reaction to 'ctrl-alt-del' key sequence – 'domainname': sets machine's domain name – 'hostname': sets machine's host name – 'panic': sets timer before restart after panic – 'pid_max': sets maximum PID number
  • 33. + Linux Kernel Kernel Tune able parameters IPC parameters – 'shmax': maximum size of shared memory segment (bytes) – 'shmall': total amount of shared memory pages system wide – 'shmmni': maximun number of shared memory segments system wide
  • 34. + Linux Kernel Kernel Tune able parameters IPC parameters – 'sem': holds 4 parameters • maximum semaphores per array • total maximum semaphores • maximum operations per semaphore operation call • total maximum arrays
  • 35. + Linux Kernel Kernel Tune able parameters IPC parameters – 'msgmni': maximun message queues system wide – 'msgmax': maximum size of message (bytes) – 'msgmnb': maximum size of queue (bytes)