CH 16 Unix & Linux Operating System
CH 16 Unix & Linux Operating System
Computer Software
Operating System: Acts as an interface between the
Computer Hardware and the Application program.
Facilitates the user to interact with the system and
carry out various operations.
Application Software: Programs which are designed
to perform specific tasks. Application program runs on
the OS.
Utility Software: Programs mainly used for upkeep of
the system and troubleshooting.
2
Task of Operating System
Program Execution
Memory Management
Multi Tasking
Interrupts handling
Disk Access and File Systems
Device Drivers
Networking
Security
Graphical User Interface
3
Features of UNIX/LINUX
Open Source software
A hierarchical file system incorporating
demountable volumes.
Device independence, since devices are
treated as files.
Ability to initiate asynchronous processes.
Shell - the powerful command programming
language.
System command language selectable on a
per-user basis.
Highly rich set of utilities.
4
Features of UNIX/LINUX
High degree of portability.
User friendly commands with online manual help.
X windows GUI interface.
Facilitates communication across homogenous &
heterogeneous systems.
UNIX/LINUX is a cross-platform operating system.
Free access to UNIX/LINUX source code
5
UNIX/LINUX OS organization
6
Kernel
Core or nucleus of an operating system
Interacts with the hardware
First program to get loaded when the system starts and runs
till the session gets terminated
Kernel performs the following tasks:-
I/O management
Process management
Device management
File management
Memory management
7
8
Kernel types
Monolithic
All OS related code are stuffed in a single
module
Available as a single file
Advantage : Faster functioning
Micro
OS components are isolated and run in
their own address space
Device drivers, programs and system
services run outside kernel memory space
Supports modularity
Lesser in size
9
Shell
Program that interacts with kernel
Command interpreter
Distribution
Installation
11
LINUX Distributions
Redhat
Fedora
Novell’s SUSE
Mandrake
Debian
Ubuntu
Live CDs – Knoppix, puppy
CRUX
Slackware
12
UNIX/LINUX BOOT SEQUENCE
13
UNIX/LINUX BOOT SEQUENCE
BIOS loads and executes the MBR boot loader.
MBR is located in the 1st sector of the bootable disk.
Typically /dev/hda, or /dev/sda
MBR is less than 512 bytes in size. This has three
components
primary boot loader info in 1st 446 bytes
partition table info in next 64 bytes (4*16)
mbr validation check in last 2 bytes.
MBR contains information about GRUB
MBR loads and executes the GRUB boot loader
14
MASTER BOOT RECORD
BOOTLOADER PART1 PART2 PART3 PART4 MBR
VAL
446 BYTES 16 16 16 16 2
BYTES BYTES BYTES BYTES BYTES
MBR
512 BYTES
15
UNIX/LINUX BOOT SEQUENCE
GRUB stands for GRand Unified Bootloader.
GRUB just loads and executes Kernel and initrd
images.
Kernel executes the /sbin/init program
initrd - Initial RAM Disk.
initrd is used by kernel as temporary root file system
until kernel is booted and the real root file system is
mounted. It also contains necessary drivers compiled
inside, which helps it to access the hard drive
partitions, and other hardware.
16
init identifies the default initlevel from
/etc/inittab and uses that to load all appropriate
program.
Depending on your default init level setting, the
system will execute the programs from one of the
following directories.
Run level 0 – /etc/rc.d/rc0.d/
Run level 1 – /etc/rc.d/rc1.d/
Run level 2 – /etc/rc.d/rc2.d/
Run level 3 – /etc/rc.d/rc3.d/
Run level 4 – /etc/rc.d/rc4.d/
Run level 5 – /etc/rc.d/rc5.d/
Run level 6 – /etc/rc.d/rc6.d/ 17
UNIX/LINUX FILE SYSTEM
A file system is the method and data structure that an
operating system uses to keep track of files on a disk or
partition. It is the way the files are organized on the
disk.
A ‘file system’ is a group of files and relevant
information regarding them.
The disk space allotted to a UNIX/LINUX file system is
made of 'blocks', each of which are typically of 512
bytes.
Some file systems may have blocks of 1024 or 2048
bytes as well.
18
UNIX/LINUX FILE SYSTEM
• All the blocks belonging to the file system are
logically divided into four parts. The first block of a
file system is called 'Boot block' which is followed
by 'Super block', 'Inode Table' and 'Data blocks'.
20
UNIX/LINUX FILE SYSTEM
The number of free data blocks available
A partial list of immediately allocable free data
blocks
Number of free inodes available
A partial list of immediately usable inodes
When a file is created, the kernel looks up the
list available in the superblock.
The Inode Table
The blocks of a file are scattered throughout the
disk, the addresses of all its blocks have to be
stored, and not just the starting and ending
ones. 21
UNIX/LINUX FILE SYSTEM
These addresses are available in the form of a linked
list in the inode, a table maintained individually for
each file.
All inodes are stored in inode blocks, distinctly
separate from the data blocks, and are arranged
contiguously in a user-inaccessible area of the file
system.
Each inode is accessed by a number, called the i-
number (or inode number), which simply references
the position of the inode in the list.
22
UNIX/LINUX FILE SYSTEM
For each file, there is an inode entry in the table. Each
entry is made up of 64 bytes and contains the relevant
details for that file. These details are:
a) Owner of the file.
b) Group to which the owner belongs.
c) Type of file
d) File access permissions
e) Date and time of last access
f) Date and time of last modification
g) Number of links to file
h) Size of the file
i) Addresses of blocks where the file is physically
present.
23
UNIX/LINUX FILE SYSTEM
The Data Blocks
These contain the actual file contents.
An allocated block can belong to only one file in the
file system.
The block cannot be used for storing any other file's
contents unless the file to which it originally belonged
is deleted.
24
UNIX/LINUX FILE SYSTEM
UNIX/LINUX is made with one thought in mind:
Everything is a file.
A file is an element of data storage in a file system.
It neither contains its own size nor its attributes,
including the end-of-file mark.
It doesn't even contain its own name
A directory file contains two fields for each file.
The name of the file
its identification number (the inode)
25
Types of Files
Ordinary file
Directory file
Device files
Links
Sockets
Named Pipes
26
File System organisation
The salient features of UNIX/LINUX
file system are:
It has hierarchical file structure
27
Filesystem Hierarchical Standard
28
Filesystem Hierarchical Standard
All files and directories appear under the root
directory "/", even if they are stored on different
physical devices(drives). Note however that some of
these directories may or may not be present on a
UNIX/LINUX system depending on whether certain
subsystems, such as the X Window System, are
installed.
/ Primary hierarchy root and root directory of the
entire file system hierarchy.
29
Filesystem Hierarchical Standard
/bin Essential command binaries that need to be
available in single user mode
/boot Boot loader files
/dev Essential devices
/etc Host-specific system-wide configuration files.
/home Users' home directories, containing saved files,
personal settings, etc.
/lib Libraries essential for the binaries in /bin and
/sbin. Libraries are readily identifiable through their
filename extension of *.so
30
Filesystem Hierarchical Standard
/mnt Mount points for Temporarily mounted
filesystems.
/opt Optional application software packages
/proc Virtual filesystem documenting kernel and
process status as text files
/root Home directory for the root (Super) user.
/sbin Essential system binaries for system
administration
/tmp Temporary files
/usr Secondary hierarchy for read-only user data;
contains the majority of (multi-)user utilities and
applications
31
Filesystem Hierarchical Standard
/usr/local Tertiary hierarchy for local data, specific to
this host. Typically has further subdirectories, e.g.,
bin/, lib/, share/.
/var Variable files—files whose content is expected to
continually change during normal operation of the
system—such as logs, spool files, and temporary e-
mail files. Sometimes on a separate partition.
/var/lib State information. Persistent data modified by
programs as they run, e.g., databases, packaging
system metadata, etc.
32
Filesystem Hierarchical Standard
33
Filesystem Hierarchical Standard
/var/spool/mail/ Deprecated location for users'
mailboxes.
/var/tmp Temporary files to be preserved between
reboots.
/var/www Website file hierarchies (the default
location for websites served by Apache).
34
Important Files
/etc/hosts Map of IP numbers to hostnames.
/etc/passwd User account information.
/etc/groupUser group information
/etc/shadow shadow password file to hold the
password hashes.
/etc/profile Default environment for users of the
bash shell.
/etc/rc?.d/* Service start/stop scripts.
/etc/X11/xorg.conf X configuration file.
35
T H A N K S FOR YOUR KIND
ATTENTION
36