1
ANATOMAY OF LINUX KERNEL
Anatomy of the Linux Kernel 2
Learning Objectives
to acquire basic vocabulary related to operating systems
to understand the basics of Linux kernel architecture
Sub-areas covered
Linux kernel and its subsystems
Anatomy of the Linux Kernel 3
Keywords
kernel
the central component of most computer operating systems (OS).
Its functions include managing the system’s resources
the communication between hardware and software components
Linux kernel
Unix-like operating system kernel
VFS (Virtual file system)
an abstraction layer on top of a more concrete file system
Anatomy of the Linux Kernel 4
Keywords
GNU
a computer operating system composed entirely of free software,
initiated in 1984 by Richard Stallman
[GNU is a recursive acronym for "GNU's Not Unix!", chosen
because GNU's design is Unix-like, but differs from Unix by being
free software and containing no Unix code. The GNU project
includes an operating system kernel, GNU HURD, which was the
original focus of the Free Software Foundation (FSF).]
GPL
a widely used free software license
originally written by Richard Stallman for the GNU project
Anatomy of the Linux Kernel 5
Keywords
Minix
free/open source, Unix-like operating system (OS) based on a microkernel
architecture
Unix
a computer operating system originally developed in 1969 by a group of AT&T
employees at Bell Labs including Ken Thompson, Dennis Ritchie and Douglas Ilroy
operating system
the software that
manages the sharing of the resources of a computer
provides programmers with an interface used to access those resources
Anatomy of the Linux Kernel 6
Keywords
buffer
a region of memory used to temporarily hold data while it is being moved from one
place to another
buffer cache
a collection of data duplicating original values stored elsewhere or computed earlier,
where the original data is expensive to fetch (owing to longer access time) or to compute,
compared to the cost of reading the cache
Anatomy of the Linux Kernel 7
Reading text
Pre-reading questions
What are the most popular operating systems?
What are the advantages of Linux?
What are the disadvantages of Linux?
Anatomy of the Linux Kernel 8
The Linux® kernel
the core of a large and complex operating system
over six million lines of code
well organized in terms of subsystems and layers.
a monolithic Unix-like computer OS kernel.
The Linux family of OSs is based on this kernel
Developer
Linus Torvalds and thousands of collaborators
Written in
C and assembly
Latest release
4.13.4 (28 September 2017)
Initial release
0.01 (17 September 1991)
What is an Operating System 9
You need two types of software in order to use your
computer
applications
the programs you use to do tasks, such as write a document, surf
the web, or play games
system software
runs the computer system for you,
an operating system
There are many different operating systems,
but they all have a similar architecture (or structure).
That is because they must all overcome the same problems and
perform the same basic functions.
What is an Operating System 10
An operating system is a program
that acts as an interface between
the user and the computer
hardware and controls the
execution of all kinds of
programs.
What is an Operating System 11
An operating system must be able to:
Manage system resources
CPU scheduling
Process management
Memory management
Input/Output device management
Storage device management (hard disks, CD/DVD drives, etc)
File System Management
Simplify the development and use of applications
What is an Operating System 12
Other Important Activities that an OS performs
Security
By means of password and similar other techniques, it prevents unauthorized access to
programs and data.
Control over system performance
Recording delays between request for a service and response from the system.
Job accounting
Keeping track of time and resources used by various jobs and users.
Error detecting aids
Production of dumps, traces, error messages, and other debugging and error detecting
aids.
Coordination between other softwares and users
Coordination and assignment of compilers, interpreters, assemblers and other software
to the various users of the computer systems.
What is an Operating System 13
Types of OSs
Batch operating system
Time-sharing operating systems
Distributed operating System
Network operating System
Real Time operating System
Hard real-time systems
Soft real-time systems
Some popular Operating Systems
Unix, Linux, Windows, DOS, OS X, VMS, OS/400, AIX, z/OS,
etc.
Linux history 14
Linux is arguably the most popular open source operating
system
Its history is actually quite short considering the timeline of
OSs
In the early days of computing, programmers developed on
the bare hardware in the hardware’s language.
The lack of an operating system meant that only one
application (and one user) could use the large and expensive
device at a time.
Linux history 15
Early operating systems
developed in the 1950s to provide a simpler development
experience.
Examples include
the General Motors Operating System (GMOS)
developed for the IBM 701
the FORTRAN Monitor System (FMS)
developed by North American Aviation for the IBM 709.
Linux history 16
In the 1960s, the MIT and a host of companies developed an
experimental operating system called Multics for the GE-
645
[Multics: Multiplexed Information and Computing Service]
In 1970, one of the developers of this operating system,
AT&T, left Multics and developed their own operating
system called Unics
[Unics: Uniplexed Information and Computing Service]
Along with this operating system was the C language,
for which C was developed and then rewritten to make operating
system development portable.
Linux history 17
Twenty years later, Andrew Tanenbaum created a microkernel version of
UNIX®,
called MINIX (for minimal UNIX), that ran on small personal computers.
This open source operating system inspired Linus Torvalds’ initial
development of Linux in the early 1990s.
Linux quickly evolved from a single-person project to a world-wide
development project involving thousands of developers.
Linux history 18
One of the most important decisions for Linux was its adoption of the GNU
General Public License (GPL).
Under the GPL, the Linux kernel was protected from commercial exploitation,
It also benefited from the user-space development of the GNU project.
This allowed useful applications such as the GNU Compiler Collection (GCC) and
various shell support.
Linux history
19
Linux has its roots in a student project. In 1992, an undergraduate called Linus Torvalds was
studying computer science in Helsinki, Finland. Like most computer science courses, a big
component of it was taught on (and about) Unix. Unix was the wonder operating system of the
1970s and 1980s: both a textbook example of the principles of operating system design, and
sufficiently robust to be the standard OS in engineering and scientific computing. But Unix was
a commercial product (licensed by AT&T to a number of resellers), and cost more than a
student could pay.
Annoyed by the shortcomings of Minix (a compact Unix clone written as a teaching aid by
Professor Andy Tannenbaum) Linus set out to write his own 'kernel' — the core of an operating
system that handles memory allocation, talks to hardware devices, and makes sure everything
keeps running.
He used the GNU programming tools developed by Richard Stallman's Free Software
Foundation, an organisation of volunteers dedicated to fulfilling Stallman's ideal of making
good software that anyone could use without paying. When he'd written a basic kernel, he
released the source code to the Linux kernel on the Internet.
Source code is important. It's the original from which compiled programs are generated. If you
don't have the source code to a program, you can't modify it to fix bugs or add new features.
Most software companies won't sell you their source code, or will only do so for an eyewatering
price, because they believe that if they make it available it will destroy their revenue stream.
Linux history 20
What happened next was astounding, from the conventional, commercial software industry point of view —
and utterly predictable to anyone who knew about the Free Software Foundation. Programmers (mostly
academics and students) began using Linux. They found that it didn't do things they wanted it to do -so they
fixed it. And where they improved it, they sent the improvements to Linus, who rolled them into the kernel.
And Linux began to grow.
There's a term for this model of software development; it's called Open Source (see www. opensource. org/
for more information). Anyone can have the source code - it's free (in the sense of free speech, not free beer).
Anyone can contribute to it. If you use it heavily you may want to extend or develop or fix bugs in it — and
it is so easy to give your fixes back to the community that most people do so.
An operating system kernel on its own isn't a lot of use; but Linux was purposefully designed as a near-clone
of Unix, and there is a lot of software out there that is free and was designed to compile on Linux. By about
1992, the first 'distributions' appeared.
A distribution is the Linux-user term for a complete operating system kit, complete with the utilities and
applications you need to make it do useful things — command interpreters, programming tools, text editors,
typesetting tools, and graphical user interfaces based on the X windowing system. X is a standard in
academic and scientific computing, but not hitherto common on PCs; it's a complex distributed windowing
system on which people implement graphical interfaces like KDE and Gnome.
As more and more people got to know about Linux, some of them began to port the Linux kernel to run on
non-standard computers. Because it's free, Linux is now the most widelyported operating system there is.