SlideShare a Scribd company logo
Linux Kernel Architecture
Amir Hossein Payberah
payberah@yahoo.com
Contents



What is Kernel ?
Kernel Architecture Overview
 User

Space
 Kernel Space


Kernel Functional Overview
 File

System
 Process Management
 Device Driver
 Memory Management
 Networking
2
What is Kernel ?
Modules or sub-systems that
provide the operating system
functions.
 The Core of OS


3
Types of kernels
Micro kernel (Modular kernel)
 Monolithic kernel


4
Micro kernel


It includes code only necessary to
allow the system to provide major
functionality.
 IPC
 Some

memory management
 Low level process management &
scheduling
 Low level input / output


Such as Amoeba, Mach and …
5
Monolithic kernel
It includes all the necessary
functions.
 Such as Linux and …


6
Micro vs. Monolithic


Micro
 Flexible
 Modular
 Easy



to implement

Monolithic
 Performance

7
Contents



What is Kernel ?
Kernel Architecture Overview
 User

Space
 Kernel Space


Kernel Functional Overview
 File

System
 Process Management
 Device Driver
 Memory Management
 Networking
8
Kernel Architecture
Overview
User Space
 Kernel Space


User Space
System Call
Kernel Space
Hardware

9
User Space




The User Space is the space in memory
where user processes run.
This Space is protected.
 The

system prevents one process from
interfering with another process.
 Only Kernel processes can access a user
process

10
Kernel Space




The kernel Space is the space in memory
where kernel processes run.
The user has access to it only through the
system call.

11
System Call
User Space and Kernel Space are
in different spaces.
 When a System Call is executed,
the arguments to the call are
passed from
User Space to Kernel Space.
 A user process becomes a kernel
process when it executes a system
call.


12
User Space and Kernel Space
Relationship
User
Process

User
Space
Kernel Space

Data Flow

Library Routine
Syscall Dispatch

Kernel
Service
13
Contents



What is Kernel ?
Kernel Architecture Overview
 User

Space
 Kernel Space


Kernel Functional Overview
 File

System
 Process Management
 Device Driver
 Memory Management
 Networking
14
Kernel Functional
Overview
File System
 Process Management
 Device Driver
 Memory Management
 Networking


15
Kernel Functional Overview

16
Functional Layer &
Architectural Layer
User Space
System Call
MM
PM

FS
Hardware
DM

Net

17
Contents



What is Kernel ?
Kernel Architecture Overview
 User

Space
 Kernel Space


Kernel Functional Overview
 File

System
 Process Management
 Device Driver
 Memory Management
 Networking
18
File System






It is responsible for storing information on
disk and retrieving and updating this
information.
The File System is accessed through
system calls such as : open, read, write, …
Example :
 FAT16,

FAT32, NTFS
 ext2, ext3
…
19
Type of Files


The Unix system has the following types of
files:
 Ordinary


Contain information entered into them by a user, an
application or …

 Directory


Files

Manage the cataloging of the file system

 Special


Files

Files (devices)

Used to access the peripheral devices

 FIFO

Files for Pipes
20
Extended File System
/

/bin /etc
ls

/dev

… /usr

/home

ping

A
data.txt

/root
B

pic.gif
21
File System Structure
Boot Super inode Block
Block Block List
List



Boot Block : information needs to boot the system
Super Block : File System Specifications
Size
 Max. number of files
 Free blocks
 Free inodes





inode List
Block List : The files data
22
Inode
Each file has an inode structure that
is identified by an i-number.
 The inode contains the information
required to access the file.
 It doesn’t contain file name.


23
Inode

(Cont.)

24
Directories

File
Name

inode Number

25
Virtual File System
It manages all the different file
system.
 It is an abstraction layer between the
application program and the file
system implementations.


26
Virtual File System (Cont.)


It describes the system’s file in terms
of superblocks and inodes (the same
way as the Ext2).

27
Virtual File System (Cont.)
Inode cache
 Directory Cache


28
Contents



What is Kernel ?
Kernel Architecture Overview
 User

Space
 Kernel Space


Kernel Functional Overview
 File

System
 Process Management
 Device Driver
 Memory Management
 Networking
29
Process Management
The Unix OS is a time-sharing
system.
 Every process is scheduled to run for
a period of time (time slice).
 Kernel creates, manages and deletes
the processes


30
Process Management (Cont.)






Every process (except init) in the system is create
as the result of a fork system call.
The fork system call splits a process into two
processes (Parent and Child).
Each process has a unique identifier (Process ID).

31
Process Structure


Each process is represented by a
task_struct data structure.
 It

contains the specifications of each process
such as:





State
Scheduling information
Identifier
…

32
Process Structure (cont.)


The task_vector is an array of pointers to
every task_struct data structure in the
system.
 This

means that the maximum number of
processes in the system is limited by the size of
the task vector

33
Type of Processes


Running




Waiting




The process is waiting for an event or for a resource.

Stopped




The process is either running or it is ready to run.

The process has been stopped, usually by receiving a
signal.

Zombie


This is a halted process which, for some reason, still has
a task_struct data structure in the task vector.
34
Contents



What is Kernel ?
Kernel Architecture Overview
 User

Space
 Kernel Space


Kernel Functional Overview
 File

System
 Process Management
 Device Driver
 Memory Management
 Networking
35
Device Driver





On of the purpose of an OS is to hide the
system’s hardware from user.
Instead of putting code to manage the HW
controller into every application, the code
is kept in the Linux kernel.
It abstracts the handling of devices.
 All

HW devices look like regular files.

36
Type of devices


Character devices
A

character device is one that can be accessed
as a stream of bytes.
 Example : Keyboard, Mouse, …


Block devices
A

block device can be accessed only as
multiples of a block.
 Example : disk, …


Network devices
 They

are created by Linux kernel.

37
Major Number and Minor Number


Major Number
 The

major number identifies the driver
associated with the device.



Minor Number
 The

minor number is used only by the driver
specified by the major number; other parts of
the kernel don't use it.
 It is common for a driver to control several
devices, the minor number provides a way for
the driver to differentiate among them.
38
Device Driver

(Cont.)

39
Contents



What is Kernel ?
Kernel Architecture Overview
 User

Space
 Kernel Space


Kernel Functional Overview
 File

System
 Process Management
 Device Driver
 Memory Management
 Networking
40
Memory Management



Physical memory is limited.
Virtual memory is developed to overcome
this limitation.

41
Virtual memory






Large Address space
Protection
Memory mapping
Fair physical memory allocation
Shared virtual memory

42
Physical and Virtual memory

43
Swap memory


It is a configurable partition on disk
treated in a manner similar to
memory.

44
Contents



What is Kernel ?
Kernel Architecture Overview
 User

Space
 Kernel Space


Kernel Functional Overview
 File

System
 Process Management
 Device Driver
 Memory Management
 Networking
45
Network layers

46
Linux network layers

47
BSD socket layer


It is a general interface (abstract
layer).
 Used



in networking and IPC.

Socket address families:
 UNIX
 INET
 AX25
 IPX
 APPLETALK
 X25
48
What is socket?
main()
{
FILE *fd;
fd = fopen (…);
process (fd);
fclose (fd);
}

main()
{
int sockfd;
sockfd = socket (…);
process (sockfd);
close (sockfd);
}

49
INET socket layer
It supports the Internet address
family.
 Its interface with BSD socket layer is
through a set of operation which is
registered with BSD socket layer.


50
Type of sockets


Stream Socket
 Provide

a reliable, sequenced, two-way
connection (such as TCP).



Datagram Socket
A

connection-less and unreliable connection
(such as UDP).



Raw Socket
 Used

for internal network protocols.

51
Question?
52
Ad

More Related Content

What's hot (20)

Linux basics
Linux basicsLinux basics
Linux basics
Santosh Khadsare
 
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardKernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Anne Nicolas
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
National Cheng Kung University
 
The Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageThe Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast Storage
Kernel TLV
 
Linux file system
Linux file systemLinux file system
Linux file system
Midaga Mengistu
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)
Tushar B Kute
 
Linux Kernel Overview
Linux Kernel OverviewLinux Kernel Overview
Linux Kernel Overview
Anil Kumar Pugalia
 
Linux introduction
Linux introductionLinux introduction
Linux introduction
Md. Zahid Hossain Shoeb
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
mcganesh
 
Linux - Introductions to Linux Operating System
Linux - Introductions to Linux Operating SystemLinux - Introductions to Linux Operating System
Linux - Introductions to Linux Operating System
Vibrant Technologies & Computers
 
Software management in linux
Software management in linuxSoftware management in linux
Software management in linux
nejadmand
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
Sagar Kumar
 
Linux device drivers
Linux device drivers Linux device drivers
Linux device drivers
Emertxe Information Technologies Pvt Ltd
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
Shay Cohen
 
KERNAL ARCHITECTURE
KERNAL ARCHITECTUREKERNAL ARCHITECTURE
KERNAL ARCHITECTURE
lakshmipanat
 
Linux distributions
Linux    distributionsLinux    distributions
Linux distributions
RJ Mehul Gadhiya
 
Linux kernel architecture
Linux kernel architectureLinux kernel architecture
Linux kernel architecture
SHAJANA BASHEER
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
mukul bhardwaj
 
Linux notes
Linux notesLinux notes
Linux notes
Teja Bheemanapally
 
Architecture Of The Linux Kernel
Architecture Of The Linux KernelArchitecture Of The Linux Kernel
Architecture Of The Linux Kernel
Dom Cimafranca
 
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardKernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Anne Nicolas
 
The Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageThe Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast Storage
Kernel TLV
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)
Tushar B Kute
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
mcganesh
 
Software management in linux
Software management in linuxSoftware management in linux
Software management in linux
nejadmand
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
Sagar Kumar
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
Shay Cohen
 
KERNAL ARCHITECTURE
KERNAL ARCHITECTUREKERNAL ARCHITECTURE
KERNAL ARCHITECTURE
lakshmipanat
 
Linux kernel architecture
Linux kernel architectureLinux kernel architecture
Linux kernel architecture
SHAJANA BASHEER
 
Architecture Of The Linux Kernel
Architecture Of The Linux KernelArchitecture Of The Linux Kernel
Architecture Of The Linux Kernel
Dom Cimafranca
 

Viewers also liked (20)

The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecture
hugo lu
 
linux software architecture
linux software architecture linux software architecture
linux software architecture
Sneha Ramesh
 
What is Kernel, basic idea of kernel
What is Kernel, basic idea of kernelWhat is Kernel, basic idea of kernel
What is Kernel, basic idea of kernel
Neel Parikh
 
Kernel (OS)
Kernel (OS)Kernel (OS)
Kernel (OS)
عطاءالمنعم اثیل شیخ
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking Explained
Thomas Graf
 
Operating system kernal
Operating system kernalOperating system kernal
Operating system kernal
Sumit Rajpal
 
Kernel (computing)
Kernel (computing)Kernel (computing)
Kernel (computing)
Teja Bheemanapally
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking Walkthrough
Thomas Graf
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
Divye Kapoor
 
Introduction to Linux OS
Introduction to Linux OSIntroduction to Linux OS
Introduction to Linux OS
Mohammed Safwat
 
Linux Kernel Introduction
Linux Kernel IntroductionLinux Kernel Introduction
Linux Kernel Introduction
Sage Sharp
 
Introduction To Linux Kernel Modules
Introduction To Linux Kernel ModulesIntroduction To Linux Kernel Modules
Introduction To Linux Kernel Modules
dibyajyotig
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
onu9
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
Thomas Graf
 
Kernal
KernalKernal
Kernal
Ramasubbu .P
 
Linux Kernel Tour
Linux Kernel TourLinux Kernel Tour
Linux Kernel Tour
samrat das
 
introduction to linux kernel tcp/ip ptocotol stack
introduction to linux kernel tcp/ip ptocotol stack introduction to linux kernel tcp/ip ptocotol stack
introduction to linux kernel tcp/ip ptocotol stack
monad bobo
 
Browsing Linux Kernel Source
Browsing Linux Kernel SourceBrowsing Linux Kernel Source
Browsing Linux Kernel Source
Motaz Saad
 
System calls
System callsSystem calls
System calls
Bernard Senam
 
Kernel mode vs user mode in linux
Kernel mode vs user mode in linuxKernel mode vs user mode in linux
Kernel mode vs user mode in linux
Siddique Ibrahim
 
The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecture
hugo lu
 
linux software architecture
linux software architecture linux software architecture
linux software architecture
Sneha Ramesh
 
What is Kernel, basic idea of kernel
What is Kernel, basic idea of kernelWhat is Kernel, basic idea of kernel
What is Kernel, basic idea of kernel
Neel Parikh
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking Explained
Thomas Graf
 
Operating system kernal
Operating system kernalOperating system kernal
Operating system kernal
Sumit Rajpal
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking Walkthrough
Thomas Graf
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
Divye Kapoor
 
Introduction to Linux OS
Introduction to Linux OSIntroduction to Linux OS
Introduction to Linux OS
Mohammed Safwat
 
Linux Kernel Introduction
Linux Kernel IntroductionLinux Kernel Introduction
Linux Kernel Introduction
Sage Sharp
 
Introduction To Linux Kernel Modules
Introduction To Linux Kernel ModulesIntroduction To Linux Kernel Modules
Introduction To Linux Kernel Modules
dibyajyotig
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
onu9
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
Thomas Graf
 
Linux Kernel Tour
Linux Kernel TourLinux Kernel Tour
Linux Kernel Tour
samrat das
 
introduction to linux kernel tcp/ip ptocotol stack
introduction to linux kernel tcp/ip ptocotol stack introduction to linux kernel tcp/ip ptocotol stack
introduction to linux kernel tcp/ip ptocotol stack
monad bobo
 
Browsing Linux Kernel Source
Browsing Linux Kernel SourceBrowsing Linux Kernel Source
Browsing Linux Kernel Source
Motaz Saad
 
Kernel mode vs user mode in linux
Kernel mode vs user mode in linuxKernel mode vs user mode in linux
Kernel mode vs user mode in linux
Siddique Ibrahim
 
Ad

Similar to Linux kernel architecture (20)

Section02-Structures.ppt
Section02-Structures.pptSection02-Structures.ppt
Section02-Structures.ppt
JamelPandiin2
 
Linux internal
Linux internalLinux internal
Linux internal
mcganesh
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
mcganesh
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentals
Bimal Jain
 
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
wangyuanyi
 
managing kernal module from egineering sunject operating system
managing kernal module from egineering sunject operating systemmanaging kernal module from egineering sunject operating system
managing kernal module from egineering sunject operating system
mohammadshahnawaz77
 
CS403: Operating System : Unit I _merged.pdf
CS403: Operating System :  Unit I _merged.pdfCS403: Operating System :  Unit I _merged.pdf
CS403: Operating System : Unit I _merged.pdf
Guru Nanak Technical Institutions
 
linux kernel overview 2013
linux kernel overview 2013linux kernel overview 2013
linux kernel overview 2013
Rohit Pratap Singh
 
Lecture 1 ,2 g gvggv g g gComputer.pptx
Lecture 1 ,2    g gvggv g g gComputer.pptxLecture 1 ,2    g gvggv g g gComputer.pptx
Lecture 1 ,2 g gvggv g g gComputer.pptx
ssuser76a9bc
 
Introduction to OS, types of operating systems
Introduction to OS, types of operating systemsIntroduction to OS, types of operating systems
Introduction to OS, types of operating systems
E.M.G.yadava womens college
 
Walking around linux kernel
Walking around linux kernelWalking around linux kernel
Walking around linux kernel
Dharshana Kasun Warusavitharana
 
ch2-system structure.ppt
ch2-system structure.pptch2-system structure.ppt
ch2-system structure.ppt
JohnColaco1
 
Ch2 system structure
Ch2 system structureCh2 system structure
Ch2 system structure
Ankit Dubey
 
OS Architectures and Different Kernel Approaches
OS Architectures and Different Kernel ApproachesOS Architectures and Different Kernel Approaches
OS Architectures and Different Kernel Approaches
osayauc
 
Unix1
Unix1Unix1
Unix1
girdharitrupti
 
Chapter 1- Introduction.ppt
Chapter 1- Introduction.pptChapter 1- Introduction.ppt
Chapter 1- Introduction.ppt
miki304759
 
Windows xp
Windows xpWindows xp
Windows xp
Dr. C.V. Suresh Babu
 
Windows Architecture Explained by Stacksol
Windows Architecture Explained by StacksolWindows Architecture Explained by Stacksol
Windows Architecture Explained by Stacksol
Stacksol
 
linux system and network administrations
linux system and network administrationslinux system and network administrations
linux system and network administrations
haile468688
 
operating system1.pdf
operating system1.pdfoperating system1.pdf
operating system1.pdf
Ganesh198271
 
Section02-Structures.ppt
Section02-Structures.pptSection02-Structures.ppt
Section02-Structures.ppt
JamelPandiin2
 
Linux internal
Linux internalLinux internal
Linux internal
mcganesh
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
mcganesh
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentals
Bimal Jain
 
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
wangyuanyi
 
managing kernal module from egineering sunject operating system
managing kernal module from egineering sunject operating systemmanaging kernal module from egineering sunject operating system
managing kernal module from egineering sunject operating system
mohammadshahnawaz77
 
Lecture 1 ,2 g gvggv g g gComputer.pptx
Lecture 1 ,2    g gvggv g g gComputer.pptxLecture 1 ,2    g gvggv g g gComputer.pptx
Lecture 1 ,2 g gvggv g g gComputer.pptx
ssuser76a9bc
 
ch2-system structure.ppt
ch2-system structure.pptch2-system structure.ppt
ch2-system structure.ppt
JohnColaco1
 
Ch2 system structure
Ch2 system structureCh2 system structure
Ch2 system structure
Ankit Dubey
 
OS Architectures and Different Kernel Approaches
OS Architectures and Different Kernel ApproachesOS Architectures and Different Kernel Approaches
OS Architectures and Different Kernel Approaches
osayauc
 
Chapter 1- Introduction.ppt
Chapter 1- Introduction.pptChapter 1- Introduction.ppt
Chapter 1- Introduction.ppt
miki304759
 
Windows Architecture Explained by Stacksol
Windows Architecture Explained by StacksolWindows Architecture Explained by Stacksol
Windows Architecture Explained by Stacksol
Stacksol
 
linux system and network administrations
linux system and network administrationslinux system and network administrations
linux system and network administrations
haile468688
 
operating system1.pdf
operating system1.pdfoperating system1.pdf
operating system1.pdf
Ganesh198271
 
Ad

More from Teja Bheemanapally (20)

Teradata
TeradataTeradata
Teradata
Teja Bheemanapally
 
Teradata
TeradataTeradata
Teradata
Teja Bheemanapally
 
Linux or unix interview questions
Linux or unix interview questionsLinux or unix interview questions
Linux or unix interview questions
Teja Bheemanapally
 
Linux crontab
Linux crontabLinux crontab
Linux crontab
Teja Bheemanapally
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
Teja Bheemanapally
 
Kernel (computing)
Kernel (computing)Kernel (computing)
Kernel (computing)
Teja Bheemanapally
 
Installing red hat enterprise linux1
Installing red hat enterprise linux1Installing red hat enterprise linux1
Installing red hat enterprise linux1
Teja Bheemanapally
 
Linux basic commands tutorial
Linux basic commands tutorialLinux basic commands tutorial
Linux basic commands tutorial
Teja Bheemanapally
 
In a monolithic kerne1
In a monolithic kerne1In a monolithic kerne1
In a monolithic kerne1
Teja Bheemanapally
 
Common linuxcommandspocketguide07
Common linuxcommandspocketguide07Common linuxcommandspocketguide07
Common linuxcommandspocketguide07
Teja Bheemanapally
 
50 most frequently used unix
50 most frequently used unix50 most frequently used unix
50 most frequently used unix
Teja Bheemanapally
 
Basic commands
Basic commandsBasic commands
Basic commands
Teja Bheemanapally
 
File system hierarchy standard
File system hierarchy standardFile system hierarchy standard
File system hierarchy standard
Teja Bheemanapally
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
Teja Bheemanapally
 
15 practical grep command examples in linux
15 practical grep command examples in linux15 practical grep command examples in linux
15 practical grep command examples in linux
Teja Bheemanapally
 
25 most frequently used linux ip tables rules examples
25 most frequently used linux ip tables rules examples25 most frequently used linux ip tables rules examples
25 most frequently used linux ip tables rules examples
Teja Bheemanapally
 
Shell intro
Shell introShell intro
Shell intro
Teja Bheemanapally
 
6 stages of linux boot process
6 stages of linux boot process6 stages of linux boot process
6 stages of linux boot process
Teja Bheemanapally
 
Installing red hat enterprise linux1
Installing red hat enterprise linux1Installing red hat enterprise linux1
Installing red hat enterprise linux1
Teja Bheemanapally
 

Recently uploaded (20)

IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
João Esperancinha
 
Agentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community MeetupAgentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community Meetup
Manoj Batra (1600 + Connections)
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Building the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdfBuilding the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdf
Cheryl Hung
 
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
Top-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptxTop-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptx
BR Softech
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
João Esperancinha
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Building the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdfBuilding the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdf
Cheryl Hung
 
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
Top-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptxTop-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptx
BR Softech
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 

Linux kernel architecture

  • 1. Linux Kernel Architecture Amir Hossein Payberah payberah@yahoo.com
  • 2. Contents   What is Kernel ? Kernel Architecture Overview  User Space  Kernel Space  Kernel Functional Overview  File System  Process Management  Device Driver  Memory Management  Networking 2
  • 3. What is Kernel ? Modules or sub-systems that provide the operating system functions.  The Core of OS  3
  • 4. Types of kernels Micro kernel (Modular kernel)  Monolithic kernel  4
  • 5. Micro kernel  It includes code only necessary to allow the system to provide major functionality.  IPC  Some memory management  Low level process management & scheduling  Low level input / output  Such as Amoeba, Mach and … 5
  • 6. Monolithic kernel It includes all the necessary functions.  Such as Linux and …  6
  • 7. Micro vs. Monolithic  Micro  Flexible  Modular  Easy  to implement Monolithic  Performance 7
  • 8. Contents   What is Kernel ? Kernel Architecture Overview  User Space  Kernel Space  Kernel Functional Overview  File System  Process Management  Device Driver  Memory Management  Networking 8
  • 9. Kernel Architecture Overview User Space  Kernel Space  User Space System Call Kernel Space Hardware 9
  • 10. User Space   The User Space is the space in memory where user processes run. This Space is protected.  The system prevents one process from interfering with another process.  Only Kernel processes can access a user process 10
  • 11. Kernel Space   The kernel Space is the space in memory where kernel processes run. The user has access to it only through the system call. 11
  • 12. System Call User Space and Kernel Space are in different spaces.  When a System Call is executed, the arguments to the call are passed from User Space to Kernel Space.  A user process becomes a kernel process when it executes a system call.  12
  • 13. User Space and Kernel Space Relationship User Process User Space Kernel Space Data Flow Library Routine Syscall Dispatch Kernel Service 13
  • 14. Contents   What is Kernel ? Kernel Architecture Overview  User Space  Kernel Space  Kernel Functional Overview  File System  Process Management  Device Driver  Memory Management  Networking 14
  • 15. Kernel Functional Overview File System  Process Management  Device Driver  Memory Management  Networking  15
  • 17. Functional Layer & Architectural Layer User Space System Call MM PM FS Hardware DM Net 17
  • 18. Contents   What is Kernel ? Kernel Architecture Overview  User Space  Kernel Space  Kernel Functional Overview  File System  Process Management  Device Driver  Memory Management  Networking 18
  • 19. File System    It is responsible for storing information on disk and retrieving and updating this information. The File System is accessed through system calls such as : open, read, write, … Example :  FAT16, FAT32, NTFS  ext2, ext3 … 19
  • 20. Type of Files  The Unix system has the following types of files:  Ordinary  Contain information entered into them by a user, an application or …  Directory  Files Manage the cataloging of the file system  Special  Files Files (devices) Used to access the peripheral devices  FIFO Files for Pipes 20
  • 21. Extended File System / /bin /etc ls /dev … /usr /home ping A data.txt /root B pic.gif 21
  • 22. File System Structure Boot Super inode Block Block Block List List   Boot Block : information needs to boot the system Super Block : File System Specifications Size  Max. number of files  Free blocks  Free inodes    inode List Block List : The files data 22
  • 23. Inode Each file has an inode structure that is identified by an i-number.  The inode contains the information required to access the file.  It doesn’t contain file name.  23
  • 26. Virtual File System It manages all the different file system.  It is an abstraction layer between the application program and the file system implementations.  26
  • 27. Virtual File System (Cont.)  It describes the system’s file in terms of superblocks and inodes (the same way as the Ext2). 27
  • 28. Virtual File System (Cont.) Inode cache  Directory Cache  28
  • 29. Contents   What is Kernel ? Kernel Architecture Overview  User Space  Kernel Space  Kernel Functional Overview  File System  Process Management  Device Driver  Memory Management  Networking 29
  • 30. Process Management The Unix OS is a time-sharing system.  Every process is scheduled to run for a period of time (time slice).  Kernel creates, manages and deletes the processes  30
  • 31. Process Management (Cont.)    Every process (except init) in the system is create as the result of a fork system call. The fork system call splits a process into two processes (Parent and Child). Each process has a unique identifier (Process ID). 31
  • 32. Process Structure  Each process is represented by a task_struct data structure.  It contains the specifications of each process such as:     State Scheduling information Identifier … 32
  • 33. Process Structure (cont.)  The task_vector is an array of pointers to every task_struct data structure in the system.  This means that the maximum number of processes in the system is limited by the size of the task vector 33
  • 34. Type of Processes  Running   Waiting   The process is waiting for an event or for a resource. Stopped   The process is either running or it is ready to run. The process has been stopped, usually by receiving a signal. Zombie  This is a halted process which, for some reason, still has a task_struct data structure in the task vector. 34
  • 35. Contents   What is Kernel ? Kernel Architecture Overview  User Space  Kernel Space  Kernel Functional Overview  File System  Process Management  Device Driver  Memory Management  Networking 35
  • 36. Device Driver    On of the purpose of an OS is to hide the system’s hardware from user. Instead of putting code to manage the HW controller into every application, the code is kept in the Linux kernel. It abstracts the handling of devices.  All HW devices look like regular files. 36
  • 37. Type of devices  Character devices A character device is one that can be accessed as a stream of bytes.  Example : Keyboard, Mouse, …  Block devices A block device can be accessed only as multiples of a block.  Example : disk, …  Network devices  They are created by Linux kernel. 37
  • 38. Major Number and Minor Number  Major Number  The major number identifies the driver associated with the device.  Minor Number  The minor number is used only by the driver specified by the major number; other parts of the kernel don't use it.  It is common for a driver to control several devices, the minor number provides a way for the driver to differentiate among them. 38
  • 40. Contents   What is Kernel ? Kernel Architecture Overview  User Space  Kernel Space  Kernel Functional Overview  File System  Process Management  Device Driver  Memory Management  Networking 40
  • 41. Memory Management   Physical memory is limited. Virtual memory is developed to overcome this limitation. 41
  • 42. Virtual memory      Large Address space Protection Memory mapping Fair physical memory allocation Shared virtual memory 42
  • 43. Physical and Virtual memory 43
  • 44. Swap memory  It is a configurable partition on disk treated in a manner similar to memory. 44
  • 45. Contents   What is Kernel ? Kernel Architecture Overview  User Space  Kernel Space  Kernel Functional Overview  File System  Process Management  Device Driver  Memory Management  Networking 45
  • 48. BSD socket layer  It is a general interface (abstract layer).  Used  in networking and IPC. Socket address families:  UNIX  INET  AX25  IPX  APPLETALK  X25 48
  • 49. What is socket? main() { FILE *fd; fd = fopen (…); process (fd); fclose (fd); } main() { int sockfd; sockfd = socket (…); process (sockfd); close (sockfd); } 49
  • 50. INET socket layer It supports the Internet address family.  Its interface with BSD socket layer is through a set of operation which is registered with BSD socket layer.  50
  • 51. Type of sockets  Stream Socket  Provide a reliable, sequenced, two-way connection (such as TCP).  Datagram Socket A connection-less and unreliable connection (such as UDP).  Raw Socket  Used for internal network protocols. 51
  翻译: