SlideShare une entreprise Scribd logo
1  sur  21
Introduction to Kernel
Topics
– Kernel Architecture
– File System
– Process
Reference:
The Design of the UNIX Operating System
by Maurice J. Bach
kernel Architecture (UNIX)
Library
hardware
File Subsystem
character block
Hardware control
Buffer Cache
system call interface
Device driver
Inter process
communication
Scheduler
Memory
Managemen
t
Process Control
Subsystem
User program
User level
kernel level
User level
kernel level
File System
• A file system is consists of a sequence of logical blocks
(512/1024 byte etc.)
• A file system has the following structure:
Boot Block Super Block Inode List Data Blocks
File System: Boot Block
• The beginning of the file system
• Contains bootstrap code to load the operating
system
• Initialize the operating system
• Typically occupies the first sector of the disk
File System: Super Block
• Describes the state of a file system
• Describes the size of the file system
– How many files it can store
• Where to find free space on the file system
• Other information
File System: Inode List
• Inodes are used to access disk files.
• Inodes maps the disk files
• For each file there is an inode entry in the inode
list block
• Inode list also keeps track of directory structure
File System: Data Block
• Starts at the end of the inode list
• Contains disk files
• An allocated data block can belong to one and
only one file in the file system
Processes(1)
• A process is the execution of a program
• A process is consists of text (machine code), data and stack
• Many process can run simultaneously as kernel schedules
them for execution
• Several processes may be instances of one program
• A process reads and writes its data and stack sections, but it
cannot read or write the data and stack of other processes
• A process communicates with other processes and the rest
of the world via system calls
Processes(2)
• Kernel has a process table that keeps tract of all
active processes
• Each entry in the process table contains pointers to
the text, data, stack and the U Area of a process.
• All processes in UNIX system, except the very first
process (process 0) which is created by the system
boot code, are created by the fork system call
Kernel Support for Process
Text
Stack
DataFile Descriptor Table
Per Process Region Table
Kernel Process
Table
Kernel Region
TableA Process
U Area
Process: Region Table
• Region table entries describes the attributes of
the region, such as whether it contains text or
data, whether it is shared or private
• The extra level from the per process region table
to kernel region table allows independent
processes to share regions.
Process: U Area
• U Area is the extension of process table entry.
• Fields of process table entry:
– State field
– User ID (UID)
• Fields of U Area
– Pointer to process table entry
– File descriptors of all open files
– Current directory and current root
– I/O parameters
– Process and file size limit
• Kernel can directly access fields of the U Area of the
executing process but not of the U Area of other processes
Process Context
• The context of a process is its state:
– Text, data( variable), register
– Process region table, U Area,
– User stack and kernel stack
• When executing a process, the system is said to
be executing in the context of the process.
Context Switch
• When the kernel decides that it should execute
another process, it does a context switch, so that
the system executes in the context of the other
process
• When doing a context switch, the kernel saves
enough information so that it can later switch
back to the first process and resume its
execution.
Mode of Process Execution(1)
• The UNIX process runs in two modes:
– User mode
• Can access its own instructions and data, but not kernel
instruction and data
– Kernel mode
• Can access kernel and user instructions and data
• When a process executes a system call, the
execution mode of the process changes from
user mode to kernel mode
Mode of Process Execution(2)
• When moving from user to kernel mode, the
kernel saves enough information so that it can
later return to user mode and continue execution
from where it left off.
• Mode change is not a context switch, just
change in mode.
Process States
Process states are:
– The process is running in user mode
– The process is running in kernel mode
– The process is not executing, but it is ready to run as
soon as the scheduler chooses it
– The process is sleeping
• Such as waiting for I/O to complete
Process State Transition(1)
2
4
1
3asleep
user running
kernel running
ready to run
system call
or interrupt
Interrupt return
schedule processsleep
wakeup
return
context switch
permissible
Process State Transition(2)
• The kernel allows a context switch only when a
process moves from the state kernel running to
the state asleep
• Process running in kernel mode cannot be
preempted by other processes.
Fork System Call(1)
• When a process is created by fork, it contains
duplicate copies of the text, data and stack
segments of its parent
• Also it has a File Descriptor Table (FDT) that
contains references to the same opened files as
its parent, such that they both share the same
file pointer to each opened file
Fork System Call(2)
U Area
U Area
stack
data
text
stack
data
Kernel File
Table
Kernel Region
Table
Parent
Child
Region
table
Region
table

Contenu connexe

Tendances

REAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMREAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEM
prakrutijsh
 
services and system calls of operating system
services and system calls of operating system services and system calls of operating system
services and system calls of operating system
Saurabh Soni
 
17. Recovery System in DBMS
17. Recovery System in DBMS17. Recovery System in DBMS
17. Recovery System in DBMS
koolkampus
 

Tendances (20)

Boot process
Boot processBoot process
Boot process
 
REAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMREAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEM
 
Introduction to TCL Programming : Tcl/Tk by Gaurav Roy
Introduction to TCL Programming : Tcl/Tk by Gaurav RoyIntroduction to TCL Programming : Tcl/Tk by Gaurav Roy
Introduction to TCL Programming : Tcl/Tk by Gaurav Roy
 
Operating system architecture
Operating system architectureOperating system architecture
Operating system architecture
 
OSI Model - Open Systems Interconnection
OSI Model - Open Systems InterconnectionOSI Model - Open Systems Interconnection
OSI Model - Open Systems Interconnection
 
Operating System - Monitors (Presentation)
Operating System - Monitors (Presentation)Operating System - Monitors (Presentation)
Operating System - Monitors (Presentation)
 
Process threads operating system.
Process threads operating system.Process threads operating system.
Process threads operating system.
 
services and system calls of operating system
services and system calls of operating system services and system calls of operating system
services and system calls of operating system
 
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
 
Kernel I/O subsystem
Kernel I/O subsystemKernel I/O subsystem
Kernel I/O subsystem
 
Kernel (OS)
Kernel (OS)Kernel (OS)
Kernel (OS)
 
17. Recovery System in DBMS
17. Recovery System in DBMS17. Recovery System in DBMS
17. Recovery System in DBMS
 
Memory organization (Computer architecture)
Memory organization (Computer architecture)Memory organization (Computer architecture)
Memory organization (Computer architecture)
 
Distributed Operating System_1
Distributed Operating System_1Distributed Operating System_1
Distributed Operating System_1
 
Parallel processing (simd and mimd)
Parallel processing (simd and mimd)Parallel processing (simd and mimd)
Parallel processing (simd and mimd)
 
Multi processor scheduling
Multi  processor schedulingMulti  processor scheduling
Multi processor scheduling
 
SOC design
SOC design SOC design
SOC design
 
Geographic Routing in WSN
Geographic Routing in WSNGeographic Routing in WSN
Geographic Routing in WSN
 
Communication in Distributed Systems
Communication in Distributed SystemsCommunication in Distributed Systems
Communication in Distributed Systems
 
OS-Process Management
OS-Process ManagementOS-Process Management
OS-Process Management
 

En vedette

Unit 8
Unit 8Unit 8
Unit 8
siddr
 
Unit 1
Unit 1Unit 1
Unit 1
siddr
 
The linux file system structure
The linux file system structureThe linux file system structure
The linux file system structure
Teja Bheemanapally
 

En vedette (20)

What is a Kernel? : Introduction And Architecture
What is a Kernel? : Introduction And ArchitectureWhat is a Kernel? : Introduction And Architecture
What is a Kernel? : Introduction And Architecture
 
Ch2
Ch2Ch2
Ch2
 
Unix kernal
Unix kernalUnix kernal
Unix kernal
 
Operating system kernal
Operating system kernalOperating system kernal
Operating system kernal
 
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
 
Architecture Of The Linux Kernel
Architecture Of The Linux KernelArchitecture Of The Linux Kernel
Architecture Of The Linux Kernel
 
KERNAL ARCHITECTURE
KERNAL ARCHITECTUREKERNAL ARCHITECTURE
KERNAL ARCHITECTURE
 
Kernel (computing)
Kernel (computing)Kernel (computing)
Kernel (computing)
 
Linux kernel architecture
Linux kernel architectureLinux kernel architecture
Linux kernel architecture
 
Unit 8
Unit 8Unit 8
Unit 8
 
NTFS and Inode
NTFS and InodeNTFS and Inode
NTFS and Inode
 
Unix processes
Unix processesUnix processes
Unix processes
 
Chapter 1: Introduction to Unix / Linux Kernel
Chapter 1: Introduction to Unix / Linux KernelChapter 1: Introduction to Unix / Linux Kernel
Chapter 1: Introduction to Unix / Linux Kernel
 
Api pour les nuls
Api pour les nulsApi pour les nuls
Api pour les nuls
 
Unit 1
Unit 1Unit 1
Unit 1
 
Linux files
Linux filesLinux files
Linux files
 
RTOS
RTOSRTOS
RTOS
 
Unix ch03-03(2)
Unix ch03-03(2)Unix ch03-03(2)
Unix ch03-03(2)
 
The linux file system structure
The linux file system structureThe linux file system structure
The linux file system structure
 
Linux Directory Structure
Linux Directory StructureLinux Directory Structure
Linux Directory Structure
 

Similaire à Kernal

Chap1_Part2.pptx
Chap1_Part2.pptxChap1_Part2.pptx
Chap1_Part2.pptx
NMohd3
 
unixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdfunixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdf
IxtiyorTeshaboyev
 

Similaire à Kernal (20)

Kernal
KernalKernal
Kernal
 
Structure of processes ppt
Structure of processes pptStructure of processes ppt
Structure of processes ppt
 
Chap1_Part2.pptx
Chap1_Part2.pptxChap1_Part2.pptx
Chap1_Part2.pptx
 
Os
OsOs
Os
 
Unix operating system
Unix operating systemUnix operating system
Unix operating system
 
unixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdfunixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdf
 
Os concepts
Os conceptsOs concepts
Os concepts
 
UNIT I.pptx
UNIT I.pptxUNIT I.pptx
UNIT I.pptx
 
Unix Operaring System
Unix Operaring SystemUnix Operaring System
Unix Operaring System
 
Os
OsOs
Os
 
The structure of process
The structure of processThe structure of process
The structure of process
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 
Chap3.ppt
Chap3.pptChap3.ppt
Chap3.ppt
 
Os1
Os1Os1
Os1
 
UNIX Operating System
UNIX Operating SystemUNIX Operating System
UNIX Operating System
 
Advanced Operating Systems......Process Management
Advanced Operating Systems......Process ManagementAdvanced Operating Systems......Process Management
Advanced Operating Systems......Process Management
 
Advanced_OS_Unit 1 & 2.ppt
Advanced_OS_Unit 1 & 2.pptAdvanced_OS_Unit 1 & 2.ppt
Advanced_OS_Unit 1 & 2.ppt
 
Introduction to System Calls
Introduction to System CallsIntroduction to System Calls
Introduction to System Calls
 
Operating Systems PPT 1 (1).pdf
Operating Systems PPT 1 (1).pdfOperating Systems PPT 1 (1).pdf
Operating Systems PPT 1 (1).pdf
 
Bsc cs 1 fit u-3 operating systems
Bsc cs 1 fit u-3 operating systemsBsc cs 1 fit u-3 operating systems
Bsc cs 1 fit u-3 operating systems
 

Plus de Ramasubbu .P (20)

radar
radarradar
radar
 
Press
PressPress
Press
 
Milling 2
Milling 2Milling 2
Milling 2
 
MIlling 1
MIlling 1MIlling 1
MIlling 1
 
Drillings
DrillingsDrillings
Drillings
 
Holding
HoldingHolding
Holding
 
Saftey
SafteySaftey
Saftey
 
Harvesting
HarvestingHarvesting
Harvesting
 
Plough
PloughPlough
Plough
 
Tractor PTO
Tractor PTOTractor PTO
Tractor PTO
 
Tractor Components
Tractor ComponentsTractor Components
Tractor Components
 
MSAT
MSATMSAT
MSAT
 
GPS
GPSGPS
GPS
 
Virus
VirusVirus
Virus
 
Hacker
HackerHacker
Hacker
 
Denail of Service
Denail of ServiceDenail of Service
Denail of Service
 
RAID CONCEPT
RAID CONCEPTRAID CONCEPT
RAID CONCEPT
 
Network Security
Network SecurityNetwork Security
Network Security
 
Timer
TimerTimer
Timer
 
Sequential Logic Circuit
Sequential Logic CircuitSequential Logic Circuit
Sequential Logic Circuit
 

Dernier

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
heathfieldcps1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Dernier (20)

How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
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
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

Kernal

  • 1. Introduction to Kernel Topics – Kernel Architecture – File System – Process Reference: The Design of the UNIX Operating System by Maurice J. Bach
  • 2. kernel Architecture (UNIX) Library hardware File Subsystem character block Hardware control Buffer Cache system call interface Device driver Inter process communication Scheduler Memory Managemen t Process Control Subsystem User program User level kernel level User level kernel level
  • 3. File System • A file system is consists of a sequence of logical blocks (512/1024 byte etc.) • A file system has the following structure: Boot Block Super Block Inode List Data Blocks
  • 4. File System: Boot Block • The beginning of the file system • Contains bootstrap code to load the operating system • Initialize the operating system • Typically occupies the first sector of the disk
  • 5. File System: Super Block • Describes the state of a file system • Describes the size of the file system – How many files it can store • Where to find free space on the file system • Other information
  • 6. File System: Inode List • Inodes are used to access disk files. • Inodes maps the disk files • For each file there is an inode entry in the inode list block • Inode list also keeps track of directory structure
  • 7. File System: Data Block • Starts at the end of the inode list • Contains disk files • An allocated data block can belong to one and only one file in the file system
  • 8. Processes(1) • A process is the execution of a program • A process is consists of text (machine code), data and stack • Many process can run simultaneously as kernel schedules them for execution • Several processes may be instances of one program • A process reads and writes its data and stack sections, but it cannot read or write the data and stack of other processes • A process communicates with other processes and the rest of the world via system calls
  • 9. Processes(2) • Kernel has a process table that keeps tract of all active processes • Each entry in the process table contains pointers to the text, data, stack and the U Area of a process. • All processes in UNIX system, except the very first process (process 0) which is created by the system boot code, are created by the fork system call
  • 10. Kernel Support for Process Text Stack DataFile Descriptor Table Per Process Region Table Kernel Process Table Kernel Region TableA Process U Area
  • 11. Process: Region Table • Region table entries describes the attributes of the region, such as whether it contains text or data, whether it is shared or private • The extra level from the per process region table to kernel region table allows independent processes to share regions.
  • 12. Process: U Area • U Area is the extension of process table entry. • Fields of process table entry: – State field – User ID (UID) • Fields of U Area – Pointer to process table entry – File descriptors of all open files – Current directory and current root – I/O parameters – Process and file size limit • Kernel can directly access fields of the U Area of the executing process but not of the U Area of other processes
  • 13. Process Context • The context of a process is its state: – Text, data( variable), register – Process region table, U Area, – User stack and kernel stack • When executing a process, the system is said to be executing in the context of the process.
  • 14. Context Switch • When the kernel decides that it should execute another process, it does a context switch, so that the system executes in the context of the other process • When doing a context switch, the kernel saves enough information so that it can later switch back to the first process and resume its execution.
  • 15. Mode of Process Execution(1) • The UNIX process runs in two modes: – User mode • Can access its own instructions and data, but not kernel instruction and data – Kernel mode • Can access kernel and user instructions and data • When a process executes a system call, the execution mode of the process changes from user mode to kernel mode
  • 16. Mode of Process Execution(2) • When moving from user to kernel mode, the kernel saves enough information so that it can later return to user mode and continue execution from where it left off. • Mode change is not a context switch, just change in mode.
  • 17. Process States Process states are: – The process is running in user mode – The process is running in kernel mode – The process is not executing, but it is ready to run as soon as the scheduler chooses it – The process is sleeping • Such as waiting for I/O to complete
  • 18. Process State Transition(1) 2 4 1 3asleep user running kernel running ready to run system call or interrupt Interrupt return schedule processsleep wakeup return context switch permissible
  • 19. Process State Transition(2) • The kernel allows a context switch only when a process moves from the state kernel running to the state asleep • Process running in kernel mode cannot be preempted by other processes.
  • 20. Fork System Call(1) • When a process is created by fork, it contains duplicate copies of the text, data and stack segments of its parent • Also it has a File Descriptor Table (FDT) that contains references to the same opened files as its parent, such that they both share the same file pointer to each opened file
  • 21. Fork System Call(2) U Area U Area stack data text stack data Kernel File Table Kernel Region Table Parent Child Region table Region table