SlideShare a Scribd company logo
1 of 22
Kernel
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
What Is An Inode?
• An inode (index node) is a control structure that contains key
information needed by theOSto accessaparticular file.
• Several file names may be associated with a single inode, but each file
iscontrolled by exactly ONE inode.
• On the disk, there is an inode table that contains the inodes of all the
filesin thefilesystem.
• When a file is opened, its inode is brought into main memory and
stored in amemory-resident inodetable.
3
Data Structure for File Handling
• InodeTable
• List of all I-nodes
• Global Filetable.
• global to the kernel e.g. the byte offset in the file where the user's next read/write
will start
• theaccessrightsallowed to theopening process. 
• ProcessFileDescriptor table.
• local to every process
• containsinformation liketheidentifiersof thefilesopened by theprocess.
• Whenever, a process creates a file, it gets an index from this table primarily known
as FileDescriptor. 
Interaction Between Tables With An Example
• ExamplE:
• procEss a:
fd1 = opEn("/var/filE1", o_rdonlY);
fd2 = opEn("/var/filE2", o_rdWr);
fd3 = opEn("/var/filE1", o_WronlY);
•
• procEss B:
fd1 = opEn("/var/filE1", o_rdonlY);
fd2 = opEn("/var/filE3", o_rdonlY);
File Descriptors, File Table and Inode table
Explanation Of Figure
•Each o pe n() returns a file descriptor to the process, and
the corresponding entry in the user file descriptor
table points to a unique entry in the global file table even
though a file(/var/file1) is opened more then once. 
•These global file table entries map to the in-core inode
table entry. Every opened file has a unique entry in the
global file table and the user file descriptor table but
kernel keeps only single entry per file in the in-core
inode table.
•Separate entries are created in user file descriptor and
global file table, but only the reference count is
increased in the inode table.
File System
•A file system is consists of a sequence of logical blocks
(512/1024 byteetc.)
•A filesystem hasthefollowing 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
•Inodesareused to accessdisk files.
•Inodesmapsthedisk files
•For each filethereisan inodeentry in theinodelist
block
•Inodelist also keepstrack 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
•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
Processes
• Kernel hasaprocesstablethat keepstract of all activeprocesses
• Each entry in the process table contains pointers to the text, data,
stack and theU Areaof aprocess.
• 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
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
• The UNIX process runs in two modes:
• Usermode
• 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
• 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
Processstatesare-
•Theprocessisrunning in user mode
•Theprocessisrunning in kernel mode
•Theprocessisnot executing, but it isready to run
assoon asthescheduler choosesit
•Theprocessissleeping
• Such aswaiting for I/O to complete
Process State Transition
2
4
1
3asleep
user running
kernel running
ready to run
system call
or interrupt
Interrupt return
schedule processsleep
wakeup
return
context switch permissible
Fork System Call
• When a process is created by fork, it contains duplicate copies of the
text, dataand stack segmentsof itsparent
• 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
Parent
Child
U Area
U Area
stack
data
text
stack
data
Kernel File
Table
Kernel Region
Table
Region
table
Region
table
Kernal

More Related Content

Similar to 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
 

Similar to Kernal (20)

Kernal
KernalKernal
Kernal
 
Os
OsOs
Os
 
Structure of processes ppt
Structure of processes pptStructure of processes ppt
Structure of processes ppt
 
UNIT I.pptx
UNIT I.pptxUNIT I.pptx
UNIT I.pptx
 
Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)
 
OS Internals and Portable Executable File Format
OS Internals and Portable Executable File FormatOS Internals and Portable Executable File Format
OS Internals and Portable Executable File Format
 
Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)
 
Operating Systems & Applications
Operating Systems & ApplicationsOperating Systems & Applications
Operating Systems & Applications
 
File system and Deadlocks
File system and DeadlocksFile system and Deadlocks
File system and Deadlocks
 
Ch2
Ch2Ch2
Ch2
 
File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control
 
Systems Programming - File IO
Systems Programming - File IOSystems Programming - File IO
Systems Programming - File IO
 
Chap1_Part2.pptx
Chap1_Part2.pptxChap1_Part2.pptx
Chap1_Part2.pptx
 
ch1.ppt
ch1.pptch1.ppt
ch1.ppt
 
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1) Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1)
 
unixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdfunixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdf
 
Unix operating system
Unix operating systemUnix operating system
Unix operating system
 
2nd unit part 1
2nd unit  part 12nd unit  part 1
2nd unit part 1
 
chapter1.ppt
chapter1.pptchapter1.ppt
chapter1.ppt
 
Unix Operaring System
Unix Operaring SystemUnix Operaring System
Unix Operaring System
 

More from Asaduzzaman Kanok

More from Asaduzzaman Kanok (9)

Daffodil International University cover page
Daffodil International University cover pageDaffodil International University cover page
Daffodil International University cover page
 
market structure in economics
market structure in economicsmarket structure in economics
market structure in economics
 
Determining Requirements In System Analysis And Dsign
Determining Requirements In System Analysis And DsignDetermining Requirements In System Analysis And Dsign
Determining Requirements In System Analysis And Dsign
 
Assembly Language In Electronics
Assembly Language In ElectronicsAssembly Language In Electronics
Assembly Language In Electronics
 
Presentation on Modem working procedures
 Presentation on Modem working procedures Presentation on Modem working procedures
Presentation on Modem working procedures
 
Ethical hacking
Ethical hackingEthical hacking
Ethical hacking
 
Correlation Analysis
Correlation AnalysisCorrelation Analysis
Correlation Analysis
 
Networking slide
Networking slideNetworking slide
Networking slide
 
Rural Development in bangladesh
Rural Development in bangladeshRural Development in bangladesh
Rural Development in bangladesh
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 
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
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
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
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
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
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 

Kernal

  • 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. What Is An Inode? • An inode (index node) is a control structure that contains key information needed by theOSto accessaparticular file. • Several file names may be associated with a single inode, but each file iscontrolled by exactly ONE inode. • On the disk, there is an inode table that contains the inodes of all the filesin thefilesystem. • When a file is opened, its inode is brought into main memory and stored in amemory-resident inodetable. 3
  • 4. Data Structure for File Handling • InodeTable • List of all I-nodes • Global Filetable. • global to the kernel e.g. the byte offset in the file where the user's next read/write will start • theaccessrightsallowed to theopening process.  • ProcessFileDescriptor table. • local to every process • containsinformation liketheidentifiersof thefilesopened by theprocess. • Whenever, a process creates a file, it gets an index from this table primarily known as FileDescriptor. 
  • 5. Interaction Between Tables With An Example • ExamplE: • procEss a: fd1 = opEn("/var/filE1", o_rdonlY); fd2 = opEn("/var/filE2", o_rdWr); fd3 = opEn("/var/filE1", o_WronlY); • • procEss B: fd1 = opEn("/var/filE1", o_rdonlY); fd2 = opEn("/var/filE3", o_rdonlY);
  • 6. File Descriptors, File Table and Inode table
  • 7. Explanation Of Figure •Each o pe n() returns a file descriptor to the process, and the corresponding entry in the user file descriptor table points to a unique entry in the global file table even though a file(/var/file1) is opened more then once.  •These global file table entries map to the in-core inode table entry. Every opened file has a unique entry in the global file table and the user file descriptor table but kernel keeps only single entry per file in the in-core inode table. •Separate entries are created in user file descriptor and global file table, but only the reference count is increased in the inode table.
  • 8. File System •A file system is consists of a sequence of logical blocks (512/1024 byteetc.) •A filesystem hasthefollowing structure: Boot Block Super Block Inode List Data Blocks
  • 9. 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
  • 10. 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
  • 11. File System: Inode List •Inodesareused to accessdisk files. •Inodesmapsthedisk files •For each filethereisan inodeentry in theinodelist block •Inodelist also keepstrack of directory structure
  • 12. 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
  • 13. Processes •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
  • 14. Processes • Kernel hasaprocesstablethat keepstract of all activeprocesses • Each entry in the process table contains pointers to the text, data, stack and theU Areaof aprocess. • 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
  • 15. Kernel Support for Process Text Stack DataFile Descriptor Table Per Process Region Table Kernel Process Table Kernel Region TableA Process U Area
  • 16. 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.
  • 17. Mode of Process Execution • The UNIX process runs in two modes: • Usermode • 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 • 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.
  • 18. Process States Processstatesare- •Theprocessisrunning in user mode •Theprocessisrunning in kernel mode •Theprocessisnot executing, but it isready to run assoon asthescheduler choosesit •Theprocessissleeping • Such aswaiting for I/O to complete
  • 19. Process State Transition 2 4 1 3asleep user running kernel running ready to run system call or interrupt Interrupt return schedule processsleep wakeup return context switch permissible
  • 20. Fork System Call • When a process is created by fork, it contains duplicate copies of the text, dataand stack segmentsof itsparent • 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 Parent Child U Area U Area stack data text stack data Kernel File Table Kernel Region Table Region table Region table