Linux Kernel Architecture



Similar documents
CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Operating Systems. Design and Implementation. Andrew S. Tanenbaum Melanie Rieback Arno Bakker. Vrije Universiteit Amsterdam

Outline. Operating Systems Design and Implementation. Chap 1 - Overview. What is an OS? 28/10/2014. Introduction

Operating System Structure

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

Chapter 10 Case Study 1: LINUX

Chapter 11 I/O Management and Disk Scheduling

Two Parts. Filesystem Interface. Filesystem design. Interface the user sees. Implementing the interface

Minix Mini Unix (Minix) basically, a UNIX - compatible operating system. Minix is small in size, with microkernel-based design. Minix has been kept

Example of Standard API

File Systems Management and Examples

TELE 301 Lecture 7: Linux/Unix file

Chapter 3 Operating-System Structures

Computer Forensics Principles and Practices

The Linux Virtual Filesystem

Chapter 12 File Management. Roadmap

Chapter 12 File Management

COS 318: Operating Systems

Chapter 2 System Structures

ELEC 377. Operating Systems. Week 1 Class 3

The POSIX Socket API

Module 20: The Linux System

Operating Systems CSE 410, Spring File Management. Stephen Wagner Michigan State University

Chapter 12 File Management

Kernel Types System Calls. Operating Systems. Autumn 2013 CS4023

Operating Systems Design 16. Networking: Sockets

b. A program calls malloc to request more memory from the operating system. i.what system call would malloc use to request more memory of the OS?

CHAPTER 17: File Management

REAL TIME OPERATING SYSTEM PROGRAMMING-II: II: Windows CE, OSEK and Real time Linux. Lesson-12: Real Time Linux

HP-UX System and Network Administration for Experienced UNIX System Administrators Course Summary

File Systems for Flash Memories. Marcela Zuluaga Sebastian Isaza Dante Rodriguez

Device Management Functions

Operating Systems 4 th Class

Operating System Structures

Network Programming TDC 561

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Survey of Filesystems for Embedded Linux. Presented by Gene Sally CELF

Operating System Components and Services

CHAPTER 15: Operating Systems: An Overview

Outline: Operating Systems

Have both hardware and software. Want to hide the details from the programmer (user).

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

CSC 2405: Computer Systems II

CSE 120 Principles of Operating Systems. Modules, Interfaces, Structure

How To Write A Windows Operating System (Windows) (For Linux) (Windows 2) (Programming) (Operating System) (Permanent) (Powerbook) (Unix) (Amd64) (Win2) (X

Storage and File Systems. Chester Rebeiro IIT Madras

Multiprogramming. IT 3123 Hardware and Software Concepts. Program Dispatching. Multiprogramming. Program Dispatching. Program Dispatching

Operating System Components

Virtual Private Systems for FreeBSD

Process Description and Control william stallings, maurizio pizzonia - sistemi operativi

STUDY GUIDE CHAPTER 4

Network Programming with Sockets. Process Management in UNIX

Chapter 11 I/O Management and Disk Scheduling

Operating System Structures

Objectives of Lecture. Network Architecture. Protocols. Contents

Tutorial on Socket Programming

Chapter 6, The Operating System Machine Level

Chapter 11: File System Implementation. Operating System Concepts with Java 8 th Edition

Limi Kalita / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 5 (3), 2014, Socket Programming

Operating Systems OS Architecture Models

Comparing and Contrasting Windows and Linux Forensics. Zlatko Jovanovic. International Academy of Design and Technology

6.828 Operating System Engineering: Fall Quiz II Solutions THIS IS AN OPEN BOOK, OPEN NOTES QUIZ.

Kernel comparison of OpenSolaris, Windows Vista and. Linux 2.6

HTTP-FUSE PS3 Linux: an internet boot framework with kboot

Chapter 11: File System Implementation. Operating System Concepts 8 th Edition

Upon completion of this chapter, you will able to answer the following questions:

OS Concepts and structure

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

COS 318: Operating Systems. File Layout and Directories. Topics. File System Components. Steps to Open A File

Lecture 25 Symbian OS

System Calls and Standard I/O

Linux Kernel Networking. Raoul Rivas

760 Veterans Circle, Warminster, PA Technical Proposal. Submitted by: ACT/Technico 760 Veterans Circle Warminster, PA

Networking Operating Systems (CO32010)

Network Attached Storage. Jinfeng Yang Oct/19/2015

LSN 10 Linux Overview

Operating System Organization. Purpose of an OS

Computers: Tools for an Information Age

DEVICE DRIVERS AND TERRUPTS SERVICE MECHANISM Lesson-14: Device types, Physical and Virtual device functions

Linux Driver Devices. Why, When, Which, How?

Operating System Overview. Otto J. Anshus

Datacenter Operating Systems

Algorithms and Methods for Distributed Storage Networks 7 File Systems Christian Schindelhauer

Introduction. What is an Operating System?

IT6203 Systems & Network Administration. (Optional)

Chapter 3: Operating-System Structures. Common System Components

OPERATING SYSTEM SERVICES

Network File System (NFS) Pradipta De

Introduction to Operating Systems. Perspective of the Computer. System Software. Indiana University Chen Yu

Virtual Private Networks

Distributed Operating Systems. Cluster Systems

CS161: Operating Systems

Network File System (NFS)

EXPLORING LINUX KERNEL: THE EASY WAY!

Part III Storage Management. Chapter 11: File System Implementation

Red Hat Linux Internals

Transcription:

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 Data Flow User Space Kernel Space 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 FS DM MM Hardware Net PM 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 Files Contain information entered into them by a user, an application or Directory Files Manage the cataloging of the file system Special Files (devices) Used to access the peripheral devices FIFO Files for Pipes 20

Extended File System / /bin /etc /dev /usr /home /root ls ping A B data.txt pic.gif 21

File System Structure Boot Block Super Block inode List Block 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 The process is either running or it is ready to run. Waiting The process is waiting for an event or for a resource. Stopped 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