0% found this document useful (0 votes)
56 views44 pages

Case Study

Linux is a popular open-source version of the UNIX operating system. It has a modular kernel that provides services like multiprocessing and multi-threading. The Linux system has three main components - the kernel, system libraries, and system utilities. It uses algorithms like Completely Fair Scheduler for process scheduling and elevator and deadline algorithms for disk scheduling. Common Linux file systems include ext4, XFS, and btrfs. The virtual file system (VFS) provides a unified view of different file systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views44 pages

Case Study

Linux is a popular open-source version of the UNIX operating system. It has a modular kernel that provides services like multiprocessing and multi-threading. The Linux system has three main components - the kernel, system libraries, and system utilities. It uses algorithms like Completely Fair Scheduler for process scheduling and elevator and deadline algorithms for disk scheduling. Common Linux file systems include ext4, XFS, and btrfs. The virtual file system (VFS) provides a unified view of different file systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

Case Study

on

LINUX
LINUX is one of popular version of
UNIX operating System. It is OPEN
SOURCE as its source code is freely
available. It is free to use. LINUX was
designed considering UNIX compatibility.
Its functionality list is quite similar to that of
UNIX.
LINUX supports
• Multi Programming
• Multi User
• Multi Threading
• Multi Tasking
• Multi Processing
• And is most Real time OS.
Components of LINUX system.
Linux Operating System has
primarily three components :-
1) Kernel − Kernel is the core part of Linux. It is
responsible for all major activities of this operating
system. It consists of various modules and it interacts
directly with the underlying hardware. Kernel provides
the required abstraction to hide low level hardware
details to system or application programs.
2) System Library − System libraries are special
functions or programs using which application
programs or system utilities accesses Kernel's features.
These libraries implement most of the functionalities
of the operating system and do not requires kernel
module's code access rights.

3) System Utility − System Utility programs are


responsible to do specialized, individual level tasks.
Parameters
CPU SCHEDULING

DISK SCHEDULING

FILE SYSTEM

DIRECTORY STRUCTURE

MEMORY MGT.

SECURITY/PROTECTION
Process Scheduling
Linux follows two algorithms:
1) Time sharing Algorithm
- Applied among multiple Processes.
- Completely Fair Scheduler is Used.
- Scheduling on the basis of priority and
credits.
- Pre-emptive in nature.
- I/O bound job is preferred than CPU job.
- Linux uses dynamic priority policy.
MAIN
• Recrediting Operation has a rule of :
credits = (credits/2) + priority
• Job blocked frequently (due to I/O request)
Priority Increases.
• Job exhausting time slice frequently Priority
Decreases (as longer burst time).
• Highest credit process has greater time slice.
• Linux uses this Priority system to implement the
standard UNIX nice process-priority
mechanism.

MAIN
2) Real Time Scheduling Algorithm
- For Real Time tasks.
- Implements Round Robin and FCFS algorithm.
- Scheduling based on priorities.
• The Scheduler runs the process with highest priority; for
equal priority processes, it runs the process waiting the
longest.
• FIFO process continues to run until they either exit or block
• RR process will pre-empted after a while and moved to end
of scheduling queue, so that RR process of equal priority
automatically time share between themselves.
• Real time tasks has the highest priority above all
processes.

MAIN
Relationship between Priorities
and Time-Slice length

MAIN
Disk Scheduling
1) Linus Elevator I/O Scheduler
- Used in Older version of LINUX.
- Performs “Merging & Sorting”.
- Merging : Insertion at nearby request.
- Sorting : Sorting the queue sector-wise.
- Problem of Starvation : due to servicing
nearby requests only.
- Used less effective policy for solving
problem of starvation.
MAIN
2) Deadline I/O Scheduler
- Upgradation over Linus Elevator Scheduler
- Performs “Merging & Sorting” too.
- High Priority of READ request than WRITE
request
- Focus on preventing starvation.
- Allocate expiration time to each request.

MAIN
3) Anticipatory I/O Scheduler
- Upgradation over Deadline I/O Scheduler
- After servicing the READ request it waits for
few second for another READ request that may
generate in future(anticipates).
- Aim is to minimize seek time.
4) Noop I/O Scheduler
- Performs only Merging but not Sorting.
- Basic Scheduler, maintains request queue in near FIFO
order
- Used for Random access devices (flash memory cards).
• Other Schedulers are - Complete Fair Queuing I/O scheduler,
Budget Fair Queuing I/O Scheduler.

MAIN
File System
Two main aspects of file systems
- Data Str. to organize data and metadata on
disk.
- Implementation of operation like open, read,
write, close.
- Organises file onto blocks on disk.
* Data Blocks
* Inode Blocks
* Bitmaps
* Super Blocks

MAIN
• Data Blocks – File data stored in one or
more blocks.
• Inode Block – Meta data about every
file is stored here.
- Location of data blocks of file.
- Ownership, Permissions
• Bitmaps – Indicate which inodes/data
blocks are free.
• Super Blocks – Record of the characteristics
of a File System including its size,
the block size, the empty and the filled
blocks and their respective counts, the size
and location of the inode tables, the disk
block map and usage information, and the
size of the block groups.

MAIN
Linux File System
Linux supports numerous file systems, but
common choices for the system disk on a block
device include the ext* family (ext2, ext3 and ext4
), XFS, JFS (Journaled File System), and btrfs. For
raw flash without a flash translation layer(FTL) or 
Memory Technology Device (MTD), there are 
UBIFS, JFFS2 and YAFFS, among others. SquashFS
 is a common compressed read-only file system.

MAIN
Following Linux File System
has been discussed in detail :-
Virtual File System

ext2fs

Linux proc file system

MAIN
Virtual File System (VFS)
- VFS looks at file system as object such as inode-object,
file-object and file-system-object.
- Implement operation on each object using a functions
referenced in their function table.
- Inode-object represent a file
- File-object represent data access point in file.
- File-System-object represents directory.
- VFS defines directory operations in inode-object rather
than in the file object.

MAIN
Linux ext2fs file System
- Standard on disk file system used by Linux.
- ext2fs stands for second extended file system.
- Disk space is spits up into blocks.
- Related Data kept in single block group possibly
in order to minimize disk seeks when data is read.
- Each block group contains inode block, bitmap
block, data blocks, copy of superblock and block
group descriptor table.

MAIN
Allocating a file,
- ext2fs checks block group for file.
- Tries to keep contiguous allocation if possible,
reducing fragmentation if it can.

MAIN
- It starts searching for free blocks for allocation of
file(extending old file), from the block most recently
allocated to file.
- Search is done two ways – first, search for an entire free
byte in bitmap; if fail to find one,
- Secondly, it looks for any free bit.
- This search for free byte aims to allocate disk space in
chunks of at least 8 blocks.
- This is called PRE-ALLOCATION.
- It helps to reduce the fragmentation during interleaved
writes to separate files and also,
- Reduces CPU cost of disk allocation by allocating
multiple blocks.

MAIN
The Linux Proc File System
• The proc file system does not store data, rather, its
contents are computed on demand according to user file
I/O requests
• Proc must implement a directory str. And the file
contents within; it must then define a unique and
persistent inode number for each directory and files it
contains.
• It uses this inode number to identity just what operation
is required when a user tries to read from a particular
file inode or perform a lookup in a particular directory
inode.
• When data is read from one of these files, proc collects
the appropriate information, formats it into text form
and places it into the requesting process’s read buffer.
MAIN
Some other file system…
• JFS
The Journaled File System (JFS) was developed by IBM
for AIX UNIX which was used as an alternative to
system ext. JFS is an alternative to ext4 currently and is
used where stability is required with the use of very few
resources. When CPU power is limited JFS comes handy.
• Btrfs
B-Tree File System (Btrfs) focus on fault tolerance, fun
administration, repair System, large storage
configuration and is still under development. Btrfs is not
recommended for Production System
MAIN
• ReiserFS
It was introduced as an alternative to ext3 with improved
performance and advanced features. There was a time
when SuSE Linux‘s default file format was ReiserFS but
later Reiser went out of business and SuSe had no option
other than to return back to ext3. ReiserFS supports file
System Extension dynamically which was relatively an
advanced feature but the file system lacked certain
area of performance.
• XFS
XFS was a high speed JFS which aimed at
parallel I/O processing. NASA still usages this file system
on their 300+ terabyte storage server.

MAIN
Directory Structure
A Directory structure is the way an operating
system's file system and its files are displayed to
the user. Files are typically displayed in
a Hierarchical Tree Structure.
The Linux File Hierarchy Structure or the File
system Hierarchy Standard (FHS) defines the
directory structure and directory contents in Unix-
like operating systems. It is maintained by the
Linux Foundation.

MAIN
MAIN
Memory Mgt.
Linux memory management subsystem is
responsible for managing the memory in the
system. This includes implementation of virtual
memory and demand paging, memory
allocation both for kernel internal structures and
user space programs, mapping of files into
processes address space.

MAIN
Demand Paging
- OS copies a disk page into physical memory only on
demand and that page is not already in memory
(i.e., if a Page fault occurs).
- Process begins execution with none of its pages in
physical memory.
- This is an example of a lazy loading technique.
- Lazy Pager is used for Paging.

MAIN
- Linux implements Demand Paging without Pre-
Paging.
- Here, Pre-paging means no pages of a process is
initially present in the physical memory.
- Pages are swapped in only on demand.
- Hence, Linux supports Pure Demand Paging.

- Also, Linux uses Three Level Paging Scheme.

MAIN
MAIN
Virtual Memory
- Concept using which we can process the job of
length greater than physical memory.
- Virtual memory is commonly implemented by
Demand Paging.
- MMU is a h/w unit having
all memory references
passed through itself,
primarily performing the
translation of virtual
address physical address.

MAIN
• Linux supports virtual memory, that is, using a disk as an
extension of RAM so that the effective size of usable memory
grows correspondingly.
• The kernel will write the contents of a currently unused block
of memory to the hard disk so that the memory can be used
for another purpose.
• When the original contents are needed again, they are read
back into memory. This is all made completely transparent to
the user; programs running under Linux only see the larger
amount of memory available and don't notice that parts of
them reside on the disk from time to time.
• Of course, reading and writing the hard disk is slower (on the
order of a thousand times slower) than using real memory, so
the programs don't run as fast. The part of the hard disk that
is used as virtual memory is called the swap space.

MAIN
Address Translation

MAIN
Page Replacement Algo.
• Least Frequently Used Algorithm(LFU)
- For Older version of LINUX
- Uses Second Chance Algorithm
(modified version of FIFO)
- Uses extra reference bit in a Page Table.
- Implemented in a Circular Queue Manner.

MAIN
Continuation….

• In the Second Chance page replacement


policy, the candidate pages for removal
are consider in a round robin matter, and a page
that has been accessed between consecutive
considerations will not be replaced.
• The page replaced is the one that - considered in
a round robin matter - has not been accessed
since its last consideration.

MAIN
Implementation (SCA)
o Add a "second chance" bit to each memory frame.
o Each time a memory frame is referenced, set the "second
chance" bit to ONE (1) - this will give the frame a second
chance...
o A new page read into a memory frame has the second
chance bit set to ZERO (0)
o When you need to find a page for removal, look in a
round robin manner in the memory frames:
• If the second chance bit is ONE, reset its second chance
bit (to ZERO) and continue.
• If the second chance bit is ZERO, replace the page in
that memory frame.

MAIN
Second Chance Algo.

MAIN
Page Replacement Algo.
• Least Recently Used Algorithm (LRU)
- For Modern version of LINUX
- Least used page is a victim page.
- Implemented in two ways
* Counter – each page is associated with the
time of used field. Page with smallest time
value is victim.
* Stack – Page at the bottom is placed at the
top of stack for removal.

MAIN
Continuation….
• In the Least Recently Used (LRU) page
replacement policy, the page that is used
least recently will be replaced.
• Implementation:
o Add a register to every page frame - contain the
last time that the page in that frame was accessed
o Use a "logical clock" that advance by 1 tick each
time a memory reference is made.
o Each time a page is referenced, update its register

MAIN
LRU

MAIN
Security/Protection
• The pluggable authentication modules (PAM) system is
available under LINUX.
• PAM is based on a shared library that can be used by
any system component that needs to authenticate users.
• Access control under UNIX systems, including LINUX,
is performed through the use of numeric identifiers (UID
and GID).
• Access control is performed by assigning objects a
protections mask, which specifies which access modes –
read, write, or execute – are to be granted to processes
with owner, group, or world access.

MAIN
• Linux augments the standard UNIX setuid
mechanism in two ways :-
o It implements the POSIX specification’s saved user-id
mechanism, which allows a process to repeatedly
drop and re-acquire its effective uid.
o It has added a process characteristic that grants just a
subset of the rights of the effective uid.

• Linux provides another mechanism that allows a


client to selectively pass access to a single file to
some server process without granting it any
other privileges.

MAIN
Thank You !!!
By- Kishan Kumar (CSE-Vth Sem.)

You might also like