A case study on The Linux
System
DIPIKA UPADHAYA
ROLLNO:04/076
Linux History
Linux is a modern, free operating system based on UNIX standards.
First developed as a small but self-contained kernel in 1991 by Linus Torvalds.
Its history has been one of collaboration by many users from all around the world.
Designed to run efficiently and reliably on common PC hardware but also runs on a
variety of other platforms.
Linux development revolved largely around the central operating system Kernel
The Linux kernel
The first Linux kernel(Version 0.01, may 1991) had no networking, ran only on 80386-
compatible Intel processors and PC hardware, and had extremely limited device-driver support
and supported only the Minix file system.
Linux 1.0(March 1994) support for UNIX’s standard TCP/IP networking protocols, device
driver support, BSD compatible socket interface, enhanced file system , extra hardware support.
Version 1.2(March 1995) was the final PC- only Linux Kernel.
Linux2.0(June 1996) support for multiprocessor architecture, memory management code,
improved TCP/IP, standardized configuration interface.
2.4 and 2.6 increased SMP support, added journaling file system, preemptive kernel, 64-bit
memory support.
The Linux System
Linux uses many tools developed as part of Berkeley’s BSD operating system, MIT’s X
Window system and the Free Software Foundation’s GNU project.
The min system libraries were started by the GNU project, with improvements provided
by the Linux community.
Linux networking tools were derived from 4.3 BSD code.
Linux System is maintained by a loose network of developers collaborating over the
internet.
Linux Distributions
The basic Linux System include standard, precompiled set of packages or distributions,
system installation and management utilities and ready-to-install packages of common
UNIX tools.
Early distributions include SLS and Slackware
Red Hat and Debian are popular distributions
The RPM package file format permits compatibility among th various Linux distributions.
Linux Licensing
The Linux kernel is distributed under the GNU General Public License , the terms of
which are set out by the Free Software Foundation.
Anyone using Linux, or creating their own derivative of Linux, may not make the derived
product proprietary.
Software released under the GPL may not be redistributed as a binary –only product.
Design Principles
Linux is a multiuser, multitasking system with a fullset of UNIX-compatible tools
Main design goals are speed, efficiency and standardization
Linux is designed to be complaint with the relevant POSIX documents
Components of Linux System:
Components of a Linux System
The kernel is responsible for maintaining the important abstractions of the operating
system
Kernel code executes in kernel model with full access to all the physical resources of the
computer
All kernel code and data structures are kept in the same single address space.
The system libraries define a standard set of functions through which applications
interact with the kernel
The system utilities perform individual specialized management tasks.
Kernel Modules
The Linux kernel has the ability to load and unload arbitrary sections of kernel code on
demand.
A kernel module may typically implement a device driver, a file system or a networking
protocol.
The module interface allows third parties to write and distribute, on their own terms,
device drivers or file system that could not be distributed under the GPL.
Kernel modules allow a Linux system to be set up with a standard, minimal kernel ,
without any extra device drivers built in
Components of Module support
Module Management system: allows modules to be loaded into memory and communicate with the
rest of the kernel
Module loader and unloader: User mode utilities, work with the module management system to load
and unload modules
Driver registration system: Allows the modules to tell the rest of the kernel that a new driver is
available
Conflict-resolution mechanisms: Reserving hardware resources and protecting them from accidental
use by another driver.
Process management
Process management separates the creation of process and running of a new program into two operations:
The fork() system call creates a new process
A new program is run after a call to exec()
Under Linux, process properties fall into three groups: the process’s identity, environment and context.
Process Identity
PID: Unique identifier used to specify processes to the operating system when an application makes a system call to
signal, modify or wait for another process.
Credentials: User Id that determine the process’s rights to access system resources and files
Personality: Personality identifier that can slightly modify the semantics of certain system calls.
Process Management
Process Environment: Composed of two null-terminated vectors
The argument vector lists the command line arguments used to invoke running program
The environment vector is a list of “NAME=VALUE” pairs.
Process Context:
Constantly changing state of a running program at any point in time.
Scheduling context is information that scheduler needs to suspend and restart process.
The kernel maintains accounting information about the resources currently being consumed.
The file table is an array of pointers to kernel file structures.
The signal-handler table define the routine in the process’s address space to be called
The virtual-memory context describes the full contents of its private address space.
Processes and Threads
Linux uses the same internal representation for processes and threads
A distinction is only made when a new thread is created by the clone system call
Fork creates a new process with its own entirely new process context
Clone creates a new process with its own identity, but allowed to share data structures of
its parent.
Using clone gives an application fine grained control over exactly what is shared between
two threads.
Scheduling
In Linux, scheduling includes the running of
the various kernel tasks along with running
and interrupting of process
Two types of scheduling algorithm :
preemptive and priority-based
Process Scheduling
Two process-scheduling algorithms are used by Linux
A time-sharing algorithm for fair preemptive scheduling between multiple processes
A real-time algorithm for tasks where absolute priorities are more important than fairness
A process’s scheduling class defines which algorithm to apply
For time-sharing processes, it uses a prioritized or credit based algorithm.
Memory Management
Memory management system of Linux deals with allocating and freeing pages, groups of
pages and small blocks of memory
Additional mechanisms for handling virtual memory, memory mapped into the address
space of running processes.
Splits memory into 3 different zones due to hardware characteristics.
Managing Physical Memory
The page allocator allocates and frees all physical pages.
The allocator uses a buddy-heap algorithm to keep track of available physical pages.
Each allocatable memory region is paired with an adjacent partner. When both freed up, they are combined to form
larger region
If a small memory request cannot be satisfied, then a larger free region will be subdivided to satisfy request.
Virtual Memory
The VM manager maintains two separate views of a process’s address space :
A logical view describing instructions concerning the layout of the address space
A physical view of each address space is stored in the hardware page tables for the process
The kernel creates a new virtual address space
1. When a process runs a new program with the exec system call
2. Upon creation of a new process by the fork system call
VM paging system relocates pages of memory from physical memory out to disk
VM paging divided into two section:
1. The page out-policy algorithm decides which pages to write out to disk, and when
2. The paging mechanism actually carries out the transfer and pages data back into physical memory as needed.
Executing and Loading User Programs
Linux maintains a table of functions for loading programs.
The registration of multiple loader routines allows Linux to support both the ELF and
a.out binary formats.
Initially, binary-file pages are mapped into virtual memory., Only when a program tries to
access a given page
An ELF-format binary file consists of a header followed by several page aligned sections
The ELF loader works by reading the header and mapping the sections of the file into
separate regions of virtual memory.
File System
The kernel hides the implementation details and manages the multiple different file system via an abstraction layer i.e.
the virtual file system
The Linux VFS is designed around object-oriented principles and is composed of two components:
1. A set of definitions that define what a file object is allowed to look like
2. A layer of software to manipulate those objects
The Linux Ext2fs file system uses allocation policies designed to place logically adjacent blocks of a file into
physically adjacent blocks on disk, so that it can submit an I/O request for several disk blocks as a single operation.
The Linux Proc File system does not store data, rather, its contents are computed on demand according to the user file
I/O requests.
Proc must implement a directory structure and define a unique & persistent inode number for each directory and file it
contains.
File System
Ext2fs Block- Allocation Policies is defined by following diagram
Input and Output
The I/O system in Linux looks much like that in any UNIX system.
Users can open an access channel to a device in the same way they open any other file—devices can appear as
objects within the file system.
Linux splits all devices into three classes:
1. Block devices allow random access to completely independent, fixed size blocks of data.
2. Character devices include most other devices; they don’t need to support the functionality of regular files.
3. Network devices are interfaced via the kernel's networking subsystem.
Input and Output
Device-Driver Block Structure
Interprocess Communication
Linux informs processes that an event has occurred via signals.
The Linux kernel does not use signals to communicate with processes which are running in kernel mode, rather
communication within the kernel is accomplished via scheduling states and wait queue structures.
The pipe mechanism allows a child process to inherit a communication channel to its parent, data written to one
end of the pipe can be read by other
Shared memory offers an extremely fast way of communicating
Shared memory must be used in conjunction with another Interprocess-communication mechanism to obtain
synchronization.
Network Structure
The most important set of protocols in the Linux networking system is internet protocol suite
It implements routing between different hosts anywhere on the network
Networking in the Linux is implemented by three layers of software:
1. The socket interface
2. Protocol drivers
3. Network device drivers
Security
The security concerns can be classified in two groups
1. Authentication: Making sure that nobody can access the system without first proving that he/ she has entry
rights. PAM( pluggable authentication modules) is based on shared library that can be used by any system
component that needs to authenticate users.
2. Access Control: Providing a mechanism for checking whether a user has the right to access a certain object and
preventing access to objects as required. Access control is performed though the use of unique numeric identifiers
and by assigning objects a protection mask, which specifies which access modes- read, write, or execute.
Thank You !!!