architecture of the linux kernel

17
Architecture of the Linux Kernel by Dominique Gerald M Cimafranca [email protected] This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Philippines License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ph/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

Upload: dominique-cimafranca

Post on 07-Nov-2014

30.499 views

Category:

Technology


3 download

DESCRIPTION

Overview of the Linux Kernel, based on "Anatomy of the Linux Kernel" by M. Tim Jones, (IBM Developerworks) http://www.ibm.com/developerworks/linux/library/l-linux-kernel/

TRANSCRIPT

Page 1: Architecture Of The Linux Kernel

Architecture of the Linux Kernel

by Dominique Gerald M Cimafranca [email protected]

This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Philippines License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ph/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

Page 2: Architecture Of The Linux Kernel

Fundamental Architecture

Hardware Platform

User Applications

GNU C Library (glibc)

System Call Interface

Kernel

Architecture Dependent Kernel Code

User Space

Kernel Space

Page 3: Architecture Of The Linux Kernel

User Space Components

● User applications● glibc

● Provides the system call interface that connects to the kernel

● Provides the mechanism to transition between user-space application and kernel

● Each user space process occupies its own virtual address space (vs the kernel which runs on the single address space)

Page 4: Architecture Of The Linux Kernel

Kernel Space Components

● System Call Interface● Provides the basic functions such as read() and write()

● Kernel● Architecture-independent kernel code● Common to all processor architectures supported by

Linux

● Architecture-Dependent Code● Processor- and platform-specific code● Also known as Board Support Package

Page 5: Architecture Of The Linux Kernel

Kernel Subsystems

System Call Interface

Process Management Virtual File System

Memory Management Network Stack

Arch Device Drivers

Page 6: Architecture Of The Linux Kernel

System Call Interface

● Provides the means to perform function calls from user space into the kernel.

● This interface can be architecture dependent, even within the same processor family.

● Can be found in ● ./linux/kernel● ./linux/arch

Page 7: Architecture Of The Linux Kernel

Process Management

● Focused on the execution of processes● Each has an individual virtualization of the

processor (thread code, data, stack, and registers)

● Kernel provides API through SCI to start, stop, and communicate with processes

● Processes are managed by a scheduler

Page 8: Architecture Of The Linux Kernel

Scheduler

● Kernel implements a scheduling algorithm● Operates in constant time, regardless of threads● O(1), meaning, same time to schedule one thread

or many threads

● Can be found in● ./linux/kernel● ./linux/arch

Page 9: Architecture Of The Linux Kernel

Memory Management

● Memory is managed in pages● Typically 4KB per page for most architectures● Can be adjusted

● Support for hardware mechanisms for physical and virtual mappings, e.g. MMU on Pentium

● Keeps tracks of which pages are full, partially used, or empty

● Or if physical memory runs out, swap to disk● Can be found in ./linux/mm

Page 10: Architecture Of The Linux Kernel

Virtual File System

Virtual File System

ext3 FAT32 /proc...

Buffer Cache

Device Drivers

Physical Devices

Page 11: Architecture Of The Linux Kernel

Virtual File System

● Presents a common API abstraction of functions such as open, close, read, and write

● Translates to abstractions specific to a file system

● Support for over 50 different file systems● Can be found in ./linux/fs

Page 12: Architecture Of The Linux Kernel

Buffer Cache

● Caching layer that optimizes access to the physical devices by keeping data around for a short time

● Provides a common set of functions to the file system layer (independent of any particular file system)

Page 13: Architecture Of The Linux Kernel

Network Stack

● Follows a layered architecture modeled after the TCP/IP protocols

● TCP layer communicates with SCI via sockets● Sockets provide a standard API to the

networking subsystem● Manage connections● Move data between endpoints

● Can be found in ./linux/net

Page 14: Architecture Of The Linux Kernel

Device Drivers and Architecture-Dependent Code

● Most of the Linux kernel source code consists of device drivers● Can be found in ./linux/drivers

● While Linux kernel is mostly architecture● Can be found in ./linux/arch

Page 15: Architecture Of The Linux Kernel

Questions?

Page 16: Architecture Of The Linux Kernel

References

● Anatomy of the Linux Kernel, M. Tim Jones, IBM Developerworks (http://www.ibm.com/developerworks/linux/library/l-linux-kernel/)

Page 17: Architecture Of The Linux Kernel

Architecture of the Linux Kernel

by Dominique Gerald M Cimafranca [email protected]

This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Philippines License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ph/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.