The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What...
Transcript of The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What...
![Page 1: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/1.jpg)
Presented by Sebastian SmithCS446: Principles of Operating Systems
4/4/06
The Linux Operating System
![Page 2: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/2.jpg)
Overview
● Introduction to Linux● The Linux Kernel● Processes● Threads● Memory Management● CPU Scheduling● The Virtual Filesystem
![Page 3: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/3.jpg)
What is Linux?
![Page 4: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/4.jpg)
What Linux is
● A kernel● Originally written by Linus Torvalds● Based on Minix by Andrew Tanenbaum● Released in 1991 (Windows 3.0a)● Originally written for the 80386● Supported by a community of hackers
![Page 5: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/5.jpg)
Linux in the Unix Family
![Page 6: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/6.jpg)
GNU/Linux
● The Linux operating system– The Linux kernel– GNU libraries and
tools● Linux would not
exist without GNU
![Page 7: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/7.jpg)
Linux Distributions
● The Linux kernel packaged with software● Released by companies, communities and
individuals● Quality control
– Software packages are assembled and tested before distribution
● Designed for specific audiences● Currently ~386 distributions● Full installation, embedded, and virtual
distributions
![Page 8: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/8.jpg)
Common Distributions
● Ubuntu● Mandriva● Suse● Fedora● Slackware
● Mepis● Knoppix● Debian● Damn Small● Gentoo
![Page 9: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/9.jpg)
Supported Architectures
● IA32● IA64● x86● x86_64● Alpha● MIPS● Motorola 68k● Sparc● Ultrasparc
● PPC64● HP PARISC● Cell● ARM● PPC● Hitachi SuperH● IBM S/390● DEC VAX● AXIS CRIS
![Page 10: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/10.jpg)
The Linux Kernel
● Monolithic Kernel● Loadable modules (microkernellike)● Drivers can run in ring 0 or in userspace (ring
3 in x86)● 10,239 lines of code at version 0.01● 5,929,913 lines of code at version 2.6.0● Current stable release 2.6.16
![Page 11: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/11.jpg)
The Linux Kernel (cont)
● Version numbering– Three number version scheme A.B.C[.D]– A denotes the kernel version– B denotes the major revision (odd = development
version)– C denotes the minor revision– D optionally denotes the fix of a grave error
![Page 12: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/12.jpg)
The Linux Kernel (cont)
● Primary Kernel Components– Process/thread and I/O schedulers– File systems– Virtual memory– Network protocols– Device drivers– Signal handling
![Page 13: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/13.jpg)
Processes
● Multiple supported binary formats● Processes implemented as a vector of tasks● Number of processes limited by size of task
vector (512 by default)● 2.6 kernel support up to one billion
processes, 2.4 up to 32 thousand
![Page 14: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/14.jpg)
Threads
● No distinction between threads and processes ("lightweight processes")
● Multiple userlevel threads are mapped into a single kernellevel process that share GID
● Process created by copying the attributes of the current process
● Thread functionality results from sharing of virtual memory
● Native POSIX Thread Library
![Page 15: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/15.jpg)
CPU Scheduling
● Three Linux scheduling classes– SCHED_FIFO (realtime) [0–99]– SCHED_RR (realtime) [0–99]– SCHED_OTHER (nonrealtime) [100–139]
● Preemptive scheduling● Dynamic priorities● Scheduling priorities may set within each
class● A lower priority number = higher priority● Switching to level [099] requires root access
![Page 16: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/16.jpg)
CPU Scheduling (cont)
● The O(1) scheduler (SCHED_OTHER)– Scheduling done in constant time– Scales well with number of processes and
processors– Improved SMP affinity– Provide good interactive performance– Favors I/O bound tasks over processorbound
tasks– Runqueue (list of runnable processes)
● Active and expired priority arrays
![Page 17: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/17.jpg)
Memory Management
● Virtual memory– Three level page
table (x86)– Page allocation
based on the buddy system
– Page replacement based on the clock algorithm
![Page 18: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/18.jpg)
Memory Management (cont)
● Kernel memory– Uses virtual memory page allocation mechanism– Buddy system used to allocate and deallocate
memory– "Slab allocation" for odd sized memory
allocation
![Page 19: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/19.jpg)
The Virtual File System (VFS)
● Presents a single, unified file system interface to user processes
● Defines a common file model● Assumes files are objects on local mass
storage regardless of the target file system or underlying hardware
● A mapping module transforms the VFS representation to the real file system
![Page 20: The Linux Operating System - Freedoursat.free.fr/docs/CS446_S06/CS446_S06_7_Case1_Linux.pdf · What Linux is A kernel Originally written by Linus Torvalds Based on Minix by Andrew](https://reader031.fdocuments.net/reader031/viewer/2022030408/5a8970877f8b9a882e8ec0e6/html5/thumbnails/20.jpg)
Questions/Discussion