SlideShare a Scribd company logo
Rushdi Shams, Dept of CSE, KUET 1
Operating SystemsOperating Systems
File SystemsFile Systems
Version 1.0
Rushdi Shams, Dept of CSE, KUET 2
Introduction
• Processes can store a limited amount of information
within its own address space.
• For some applications this size is adequate but for
others (airline reservations, banking), the space is
too small
Rushdi Shams, Dept of CSE, KUET 3
Introduction
• Information stored must survive the termination of
the process using it. Typically, processes were
designed in a way such that after their usage on
variables, the values are lost when processes release
them.
• Inappropriate for applications like database systems
Rushdi Shams, Dept of CSE, KUET 4
Introduction
• Multiple processes must be able to access the
information concurrently. Truly speaking, while a
process operates on an information, it was not
accessible for others
Rushdi Shams, Dept of CSE, KUET 5
Introduction
• So, we have three essential requirements for long-
term information storage-
1. Store a large amount of information
2. The information must be stored for a long time
3. Multiple processes must be able to access the
information concurrently
• These requirements led us towards keeping the
information in files
Rushdi Shams, Dept of CSE, KUET 6
Introduction
• Information in files must be persistent- process
termination and creation must not affect them
• Only the owner can modify/delete the information if
she likes.
Rushdi Shams, Dept of CSE, KUET 7
File Naming
When a process creates a file, it gives a file name
When the process terminates, the file continues to
exist and can be accessed by other processes using its
name.
Some file systems distinguish between upper and
lower case letters, whereas others do not.
Are the file names cat.doc, cAt.doc, caT.doc and
CAT.doc same in windows? What about in UNIX?
Rushdi Shams, Dept of CSE, KUET 8
File Naming
Many OS support two-part file names- two parts
separated with a period (.).
The part after the period is called file extension.
Filename extensions can be considered a type of
metadata.
They are commonly used to infer information about
the way data might be stored in the file.
Rushdi Shams, Dept of CSE, KUET 9
File Structure
 Generally, there are three kinds of files-
1. Byte Sequence
2. Record Sequence
3. Tree Sequence
Rushdi Shams, Dept of CSE, KUET 10
File Types
 Generally, there are two
types of files-
1. ASCII files
2. Binary files
 ASCII files are easy to
understand if you use a text
editor whereas binary files
are completely glibberish if
you print them
Rushdi Shams, Dept of CSE, KUET 11
File Access Strategies
Sequential access
read all bytes/records from the beginning
cannot jump around, could rewind or back up
Random access
bytes/records read in any order
essential for data base systems
read can be …
 move file marker (seek), then read or …
 read and then move file marker
Rushdi Shams, Dept of CSE, KUET 12
File Access Strategies
There are also several file usage patterns.
Most files are small (e.g., .login and .c files), and most
file references are too small files.
Large files use up most of the disk space (e.g., mp3
files).
Large files account for most of the bytes transferred
between memory and disk.
Rushdi Shams, Dept of CSE, KUET 13
File Access Strategies
These usage patterns are bad news for file system
designers. 
To achieve high performance, a designer needs to
make sure that small files are accessed efficiently,
since there are many of them, and they are used
frequently.
A designer also needs to make sure that large files are
accessed efficiently, since they consume most of the
disk space, and account for most of the data
movement.
Rushdi Shams, Dept of CSE, KUET 14
Directories
 To keep track of files, file systems normally have
directories or folders
 In many systems directories themselves are files!
 Simply put, there are three types of directory
systems-
1. Single-level directory systems
2. Two-level directory systems
3. Hierarchical directory systems
Rushdi Shams, Dept of CSE, KUET 15
Single-level directory system
Simplest form of directory
system
One directory contains all the
files
Sometimes called root directory
Good choice when number of
user is only one
The directory in figure has two
owners- A and B having four
files
Problem- different users may
accidentally use same names for
their files
Rushdi Shams, Dept of CSE, KUET 16
Two-level directory system
Each user will have
separate directories
containing their owned
files
The problem with
naming is resolved.
Log in procedure is
required
May allow one user to
access others’ files
Rushdi Shams, Dept of CSE, KUET 17
Hierarchical Directory Systems
The problem of two-level
directory system is the
absence of grouping facility
You may group your works
like- games in one place,
movies in the other.
Hierarchical directory
systems have the facility of
two-level directory systems
plus the organization facility
Rushdi Shams, Dept of CSE, KUET 18
File System Layout
File systems are stored on disks
Disks are divided up into one or more partitions
Each partition has independent file systems
Sector 0 of the disk is called Master Boot Record
(MBR)
Computer uses MBR to boot itself
The end of MBR contains the partition table- that has
the start and end address of each partition
Rushdi Shams, Dept of CSE, KUET 19
File System Layout
One of the partitions in the partition table is marked
as active
When computer is booted, the BIOS reads in and
executes MBR
The first thing MBR program does is to locate the
active partition
The first block of this active partition is Boot Block.
MBR reads and executes it.
The program in Boot Block loads the OS contained in
that partition
Rushdi Shams, Dept of CSE, KUET 20
File System Layout
Every partition starts with a Boot Block
But only the partition having the OS will be marked
as active
Other partitions hold the Boot Block as you can
change your mind and copy another version of the OS
into one of them
Rushdi Shams, Dept of CSE, KUET 21
File System Layout
Rushdi Shams, Dept of CSE, KUET 22
File System Layout
Super Block contains all the key parameters about the file
system
It is read into memory when the computer is booted or the file
system is first touched
Typically holds a Magic Number to identify the file system type
(.exe or .bmp?), number of blocks, etc
Rushdi Shams, Dept of CSE, KUET 23
File System Layout
Free space management reveals the free blocks in the file
system
i-nodes is an array of data structures, one per file, simply telling
about the file
Root directory contains the top of the file system tree
Remainder of the disk contains all other directory and files for
that partition
Rushdi Shams, Dept of CSE, KUET 24
Implementing Files:
Contiguous Allocation
Simplest allocation scheme to store each file as a
contiguous run of disk blocks
Disk with 1 KB blocks, a 50 KB file would need 50
consecutive blocks; Disk with 2 KB blocks would
make it okay with 25 consecutive blocks
Rushdi Shams, Dept of CSE, KUET 25
Implementing Files:
Contiguous Allocation
Rushdi Shams, Dept of CSE, KUET 26
Implementing Files:
Contiguous Allocation
Advantages
Simple to implement 
You only need to know the disk address of the first
block and the distance of the file block from it
Read performance is excellent, as you need only two
seek operations (boot block and file block) and one
read operation (one contiguous stream of bytes)
Disadvantages
Disks become fragmented
Wastage of storage is possible
Rushdi Shams, Dept of CSE, KUET 27
Implementing Files:
Linked List Allocation
Every block will have two sections- a pointer to next
one (the first word of the block) and data (the rest of
the words)
Unlike contiguous allocation, every disk block can be
used in this method
No space is lost due to disk fragmentation
Rushdi Shams, Dept of CSE, KUET 28
Implementing Files:
Linked List Allocation
Reading a file sequentially is straight forward but
random access is slow.
To get block n, the OS has to start at the beginning
and read the n-1 blocks prior to it
Overhead due to pointer information
Rushdi Shams, Dept of CSE, KUET 29
Implementing Files:
Linked List Allocation
Rushdi Shams, Dept of CSE, KUET 30
Linked List Allocation:
using Table in Memory
The disadvantages are eliminated by taking the
pointer word from each block and putting it into a
table in memory
Such a table in main memory is called FAT (File
Allocation Table)
Rushdi Shams, Dept of CSE, KUET 31
Linked List Allocation:
using Table in Memory
Rushdi Shams, Dept of CSE, KUET 32
Linked List Allocation:
using Table in Memory
Entire block is available for data (no pointer
information)
Faster random access
The primary disadvantage-
the table must be in memory all the time to make it work
a 20 GB disk and with 1 KB block size, the table needs 20
million entries one for each of 20 million blocks
each entry is 4 bytes long
so, FAT will occupy 80 MB space in memory all the time
Rushdi Shams, Dept of CSE, KUET 33
i-nodes
It is a data structure that lists the attributes and disk
addresses of the file’s blocks
With i-nodes, it is possible to find all the blocks of a
file
i-nodes need only be in memory when the
corresponding file is open
If each i-node contains n-bytes and there are k-files
are opened at a time, that instant, kn-bytes are
reserved in memory
Rushdi Shams, Dept of CSE, KUET 34
i-nodes
Rushdi Shams, Dept of CSE, KUET 35
i-nodes
This array is usually far smaller than the space
occupied by the FAT
Table for holding the linked list is proportional to
disk itself.
If the disk has n blocks, the table needs n-entries
As the disks grow, the table grows linearly with them
i-node requires an array whose size is proportional to
the maximum number of files that may be open at
once (it does not matter if you have 1 petabyte HDD
)
Rushdi Shams, Dept of CSE, KUET 36
i-nodes
The disadvantage is if you fix the size of i-node and
your files have a tendency to grow larger (obviously
you cannot say your file will be always 6MB in size )

More Related Content

What's hot

directory structure and file system mounting
directory structure and file system mountingdirectory structure and file system mounting
directory structure and file system mounting
rajshreemuthiah
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating System
Janki Shah
 
File management
File managementFile management
File managementMohd Arif
 
File Management in Operating Systems
File Management in Operating SystemsFile Management in Operating Systems
File Management in Operating Systems
vampugani
 
File system structure
File system structureFile system structure
File system structure
sangrampatil81
 
ITFT_File system interface in Operating System
ITFT_File system interface in Operating SystemITFT_File system interface in Operating System
ITFT_File system interface in Operating System
Sneh Prabha
 
Operating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsOperating Systems - Implementing File Systems
Operating Systems - Implementing File Systems
Mukesh Chinta
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating systemtittuajay
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in Linux
Henry Osborne
 
File system
File systemFile system
File system
sonu riyana
 
File System in Operating System
File System in Operating SystemFile System in Operating System
File System in Operating System
Meghaj Mallick
 
File system
File systemFile system
File system
Harleen Johal
 
Operating system file system
Operating system file systemOperating system file system
Operating system file system
Anil Pokhrel
 
10 File System
10 File System10 File System
10 File System
Dr. Loganathan R
 
Chapter 13 file systems
Chapter 13   file systemsChapter 13   file systems
Chapter 13 file systems
Alvin Chin
 

What's hot (20)

directory structure and file system mounting
directory structure and file system mountingdirectory structure and file system mounting
directory structure and file system mounting
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating System
 
File management
File managementFile management
File management
 
File Management in Operating Systems
File Management in Operating SystemsFile Management in Operating Systems
File Management in Operating Systems
 
OSCh12
OSCh12OSCh12
OSCh12
 
File Management
File ManagementFile Management
File Management
 
File system structure
File system structureFile system structure
File system structure
 
ITFT_File system interface in Operating System
ITFT_File system interface in Operating SystemITFT_File system interface in Operating System
ITFT_File system interface in Operating System
 
Operating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsOperating Systems - Implementing File Systems
Operating Systems - Implementing File Systems
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating system
 
File system
File systemFile system
File system
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in Linux
 
File system
File systemFile system
File system
 
File System in Operating System
File System in Operating SystemFile System in Operating System
File System in Operating System
 
File system
File systemFile system
File system
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Ch11
Ch11Ch11
Ch11
 
Operating system file system
Operating system file systemOperating system file system
Operating system file system
 
10 File System
10 File System10 File System
10 File System
 
Chapter 13 file systems
Chapter 13   file systemsChapter 13   file systems
Chapter 13 file systems
 

Similar to Lecture 14,15 and 16 file systems

File Allocation Methods.ppt
File Allocation Methods.pptFile Allocation Methods.ppt
File Allocation Methods.ppt
BharathiLakshmiAAssi
 
File and fat
File and fatFile and fat
File and fat
Vimal Madhale
 
Root file system
Root file systemRoot file system
Root file system
Bindu U
 
The Storage Systems
The Storage Systems The Storage Systems
The Storage Systems
Dhaivat Zala
 
File and fat 2
File and fat 2File and fat 2
File and fat 2
Vimal Madhale
 
file management_part2_os_notes.ppt
file management_part2_os_notes.pptfile management_part2_os_notes.ppt
file management_part2_os_notes.ppt
HelalMirzad
 
file management
 file management file management
file management
Sweta Kumari Barnwal
 
Graphical user interface _ SEOSKILLS Hyderabad
Graphical user interface _ SEOSKILLS HyderabadGraphical user interface _ SEOSKILLS Hyderabad
Graphical user interface _ SEOSKILLS Hyderabad
SEO SKills
 
File System operating system operating system
File System  operating system operating systemFile System  operating system operating system
File System operating system operating system
Ethiopia Satlliet television
 
File System and File allocation tables
File System and File allocation tablesFile System and File allocation tables
File System and File allocation tables
shashikant pabari
 
File Management.ppt
File Management.pptFile Management.ppt
File Management.ppt
JeelBhanderi4
 
Ch11 file system implementation
Ch11   file system implementationCh11   file system implementation
Ch11 file system implementation
Welly Dian Astika
 
Storage Mediums and Fragmentation
Storage Mediums and FragmentationStorage Mediums and Fragmentation
Storage Mediums and FragmentationJonathan Reid
 
File systemimplementationfinal
File systemimplementationfinalFile systemimplementationfinal
File systemimplementationfinal
marangburu42
 
File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control
YuvrajWadavale
 
I/O System and Case study
I/O System and Case studyI/O System and Case study
I/O System and Case study
Lavanya G
 
File system interfacefinal
File system interfacefinalFile system interfacefinal
File system interfacefinal
marangburu42
 
Microsoft Windows File System in Operating System
Microsoft Windows File System in Operating SystemMicrosoft Windows File System in Operating System
Microsoft Windows File System in Operating System
Meghaj Mallick
 
linux file sysytem& input and output
linux file sysytem& input and outputlinux file sysytem& input and output
linux file sysytem& input and output
MythiliA5
 

Similar to Lecture 14,15 and 16 file systems (20)

File Allocation Methods.ppt
File Allocation Methods.pptFile Allocation Methods.ppt
File Allocation Methods.ppt
 
File system
File systemFile system
File system
 
File and fat
File and fatFile and fat
File and fat
 
Root file system
Root file systemRoot file system
Root file system
 
The Storage Systems
The Storage Systems The Storage Systems
The Storage Systems
 
File and fat 2
File and fat 2File and fat 2
File and fat 2
 
file management_part2_os_notes.ppt
file management_part2_os_notes.pptfile management_part2_os_notes.ppt
file management_part2_os_notes.ppt
 
file management
 file management file management
file management
 
Graphical user interface _ SEOSKILLS Hyderabad
Graphical user interface _ SEOSKILLS HyderabadGraphical user interface _ SEOSKILLS Hyderabad
Graphical user interface _ SEOSKILLS Hyderabad
 
File System operating system operating system
File System  operating system operating systemFile System  operating system operating system
File System operating system operating system
 
File System and File allocation tables
File System and File allocation tablesFile System and File allocation tables
File System and File allocation tables
 
File Management.ppt
File Management.pptFile Management.ppt
File Management.ppt
 
Ch11 file system implementation
Ch11   file system implementationCh11   file system implementation
Ch11 file system implementation
 
Storage Mediums and Fragmentation
Storage Mediums and FragmentationStorage Mediums and Fragmentation
Storage Mediums and Fragmentation
 
File systemimplementationfinal
File systemimplementationfinalFile systemimplementationfinal
File systemimplementationfinal
 
File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control
 
I/O System and Case study
I/O System and Case studyI/O System and Case study
I/O System and Case study
 
File system interfacefinal
File system interfacefinalFile system interfacefinal
File system interfacefinal
 
Microsoft Windows File System in Operating System
Microsoft Windows File System in Operating SystemMicrosoft Windows File System in Operating System
Microsoft Windows File System in Operating System
 
linux file sysytem& input and output
linux file sysytem& input and outputlinux file sysytem& input and output
linux file sysytem& input and output
 

More from Rushdi Shams

Research Methodology and Tips on Better Research
Research Methodology and Tips on Better ResearchResearch Methodology and Tips on Better Research
Research Methodology and Tips on Better Research
Rushdi Shams
 
Common evaluation measures in NLP and IR
Common evaluation measures in NLP and IRCommon evaluation measures in NLP and IR
Common evaluation measures in NLP and IR
Rushdi Shams
 
Machine learning with nlp 101
Machine learning with nlp 101Machine learning with nlp 101
Machine learning with nlp 101
Rushdi Shams
 
Semi-supervised classification for natural language processing
Semi-supervised classification for natural language processingSemi-supervised classification for natural language processing
Semi-supervised classification for natural language processing
Rushdi Shams
 
Natural Language Processing: Parsing
Natural Language Processing: ParsingNatural Language Processing: Parsing
Natural Language Processing: Parsing
Rushdi Shams
 
Types of machine translation
Types of machine translationTypes of machine translation
Types of machine translationRushdi Shams
 
L1 l2 l3 introduction to machine translation
L1 l2 l3  introduction to machine translationL1 l2 l3  introduction to machine translation
L1 l2 l3 introduction to machine translationRushdi Shams
 
Syntax and semantics
Syntax and semanticsSyntax and semantics
Syntax and semanticsRushdi Shams
 
Propositional logic
Propositional logicPropositional logic
Propositional logicRushdi Shams
 
Probabilistic logic
Probabilistic logicProbabilistic logic
Probabilistic logicRushdi Shams
 
Knowledge structure
Knowledge structureKnowledge structure
Knowledge structureRushdi Shams
 
Knowledge representation
Knowledge representationKnowledge representation
Knowledge representationRushdi Shams
 
L5 understanding hacking
L5  understanding hackingL5  understanding hacking
L5 understanding hackingRushdi Shams
 
L2 Intrusion Detection System (IDS)
L2  Intrusion Detection System (IDS)L2  Intrusion Detection System (IDS)
L2 Intrusion Detection System (IDS)Rushdi Shams
 

More from Rushdi Shams (20)

Research Methodology and Tips on Better Research
Research Methodology and Tips on Better ResearchResearch Methodology and Tips on Better Research
Research Methodology and Tips on Better Research
 
Common evaluation measures in NLP and IR
Common evaluation measures in NLP and IRCommon evaluation measures in NLP and IR
Common evaluation measures in NLP and IR
 
Machine learning with nlp 101
Machine learning with nlp 101Machine learning with nlp 101
Machine learning with nlp 101
 
Semi-supervised classification for natural language processing
Semi-supervised classification for natural language processingSemi-supervised classification for natural language processing
Semi-supervised classification for natural language processing
 
Natural Language Processing: Parsing
Natural Language Processing: ParsingNatural Language Processing: Parsing
Natural Language Processing: Parsing
 
Types of machine translation
Types of machine translationTypes of machine translation
Types of machine translation
 
L1 l2 l3 introduction to machine translation
L1 l2 l3  introduction to machine translationL1 l2 l3  introduction to machine translation
L1 l2 l3 introduction to machine translation
 
Syntax and semantics
Syntax and semanticsSyntax and semantics
Syntax and semantics
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Probabilistic logic
Probabilistic logicProbabilistic logic
Probabilistic logic
 
L15 fuzzy logic
L15  fuzzy logicL15  fuzzy logic
L15 fuzzy logic
 
Knowledge structure
Knowledge structureKnowledge structure
Knowledge structure
 
Knowledge representation
Knowledge representationKnowledge representation
Knowledge representation
 
First order logic
First order logicFirst order logic
First order logic
 
Belief function
Belief functionBelief function
Belief function
 
L5 understanding hacking
L5  understanding hackingL5  understanding hacking
L5 understanding hacking
 
L4 vpn
L4  vpnL4  vpn
L4 vpn
 
L3 defense
L3  defenseL3  defense
L3 defense
 
L2 Intrusion Detection System (IDS)
L2  Intrusion Detection System (IDS)L2  Intrusion Detection System (IDS)
L2 Intrusion Detection System (IDS)
 
L1 phishing
L1  phishingL1  phishing
L1 phishing
 

Recently uploaded

20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 

Recently uploaded (20)

20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 

Lecture 14,15 and 16 file systems

  • 1. Rushdi Shams, Dept of CSE, KUET 1 Operating SystemsOperating Systems File SystemsFile Systems Version 1.0
  • 2. Rushdi Shams, Dept of CSE, KUET 2 Introduction • Processes can store a limited amount of information within its own address space. • For some applications this size is adequate but for others (airline reservations, banking), the space is too small
  • 3. Rushdi Shams, Dept of CSE, KUET 3 Introduction • Information stored must survive the termination of the process using it. Typically, processes were designed in a way such that after their usage on variables, the values are lost when processes release them. • Inappropriate for applications like database systems
  • 4. Rushdi Shams, Dept of CSE, KUET 4 Introduction • Multiple processes must be able to access the information concurrently. Truly speaking, while a process operates on an information, it was not accessible for others
  • 5. Rushdi Shams, Dept of CSE, KUET 5 Introduction • So, we have three essential requirements for long- term information storage- 1. Store a large amount of information 2. The information must be stored for a long time 3. Multiple processes must be able to access the information concurrently • These requirements led us towards keeping the information in files
  • 6. Rushdi Shams, Dept of CSE, KUET 6 Introduction • Information in files must be persistent- process termination and creation must not affect them • Only the owner can modify/delete the information if she likes.
  • 7. Rushdi Shams, Dept of CSE, KUET 7 File Naming When a process creates a file, it gives a file name When the process terminates, the file continues to exist and can be accessed by other processes using its name. Some file systems distinguish between upper and lower case letters, whereas others do not. Are the file names cat.doc, cAt.doc, caT.doc and CAT.doc same in windows? What about in UNIX?
  • 8. Rushdi Shams, Dept of CSE, KUET 8 File Naming Many OS support two-part file names- two parts separated with a period (.). The part after the period is called file extension. Filename extensions can be considered a type of metadata. They are commonly used to infer information about the way data might be stored in the file.
  • 9. Rushdi Shams, Dept of CSE, KUET 9 File Structure  Generally, there are three kinds of files- 1. Byte Sequence 2. Record Sequence 3. Tree Sequence
  • 10. Rushdi Shams, Dept of CSE, KUET 10 File Types  Generally, there are two types of files- 1. ASCII files 2. Binary files  ASCII files are easy to understand if you use a text editor whereas binary files are completely glibberish if you print them
  • 11. Rushdi Shams, Dept of CSE, KUET 11 File Access Strategies Sequential access read all bytes/records from the beginning cannot jump around, could rewind or back up Random access bytes/records read in any order essential for data base systems read can be …  move file marker (seek), then read or …  read and then move file marker
  • 12. Rushdi Shams, Dept of CSE, KUET 12 File Access Strategies There are also several file usage patterns. Most files are small (e.g., .login and .c files), and most file references are too small files. Large files use up most of the disk space (e.g., mp3 files). Large files account for most of the bytes transferred between memory and disk.
  • 13. Rushdi Shams, Dept of CSE, KUET 13 File Access Strategies These usage patterns are bad news for file system designers.  To achieve high performance, a designer needs to make sure that small files are accessed efficiently, since there are many of them, and they are used frequently. A designer also needs to make sure that large files are accessed efficiently, since they consume most of the disk space, and account for most of the data movement.
  • 14. Rushdi Shams, Dept of CSE, KUET 14 Directories  To keep track of files, file systems normally have directories or folders  In many systems directories themselves are files!  Simply put, there are three types of directory systems- 1. Single-level directory systems 2. Two-level directory systems 3. Hierarchical directory systems
  • 15. Rushdi Shams, Dept of CSE, KUET 15 Single-level directory system Simplest form of directory system One directory contains all the files Sometimes called root directory Good choice when number of user is only one The directory in figure has two owners- A and B having four files Problem- different users may accidentally use same names for their files
  • 16. Rushdi Shams, Dept of CSE, KUET 16 Two-level directory system Each user will have separate directories containing their owned files The problem with naming is resolved. Log in procedure is required May allow one user to access others’ files
  • 17. Rushdi Shams, Dept of CSE, KUET 17 Hierarchical Directory Systems The problem of two-level directory system is the absence of grouping facility You may group your works like- games in one place, movies in the other. Hierarchical directory systems have the facility of two-level directory systems plus the organization facility
  • 18. Rushdi Shams, Dept of CSE, KUET 18 File System Layout File systems are stored on disks Disks are divided up into one or more partitions Each partition has independent file systems Sector 0 of the disk is called Master Boot Record (MBR) Computer uses MBR to boot itself The end of MBR contains the partition table- that has the start and end address of each partition
  • 19. Rushdi Shams, Dept of CSE, KUET 19 File System Layout One of the partitions in the partition table is marked as active When computer is booted, the BIOS reads in and executes MBR The first thing MBR program does is to locate the active partition The first block of this active partition is Boot Block. MBR reads and executes it. The program in Boot Block loads the OS contained in that partition
  • 20. Rushdi Shams, Dept of CSE, KUET 20 File System Layout Every partition starts with a Boot Block But only the partition having the OS will be marked as active Other partitions hold the Boot Block as you can change your mind and copy another version of the OS into one of them
  • 21. Rushdi Shams, Dept of CSE, KUET 21 File System Layout
  • 22. Rushdi Shams, Dept of CSE, KUET 22 File System Layout Super Block contains all the key parameters about the file system It is read into memory when the computer is booted or the file system is first touched Typically holds a Magic Number to identify the file system type (.exe or .bmp?), number of blocks, etc
  • 23. Rushdi Shams, Dept of CSE, KUET 23 File System Layout Free space management reveals the free blocks in the file system i-nodes is an array of data structures, one per file, simply telling about the file Root directory contains the top of the file system tree Remainder of the disk contains all other directory and files for that partition
  • 24. Rushdi Shams, Dept of CSE, KUET 24 Implementing Files: Contiguous Allocation Simplest allocation scheme to store each file as a contiguous run of disk blocks Disk with 1 KB blocks, a 50 KB file would need 50 consecutive blocks; Disk with 2 KB blocks would make it okay with 25 consecutive blocks
  • 25. Rushdi Shams, Dept of CSE, KUET 25 Implementing Files: Contiguous Allocation
  • 26. Rushdi Shams, Dept of CSE, KUET 26 Implementing Files: Contiguous Allocation Advantages Simple to implement  You only need to know the disk address of the first block and the distance of the file block from it Read performance is excellent, as you need only two seek operations (boot block and file block) and one read operation (one contiguous stream of bytes) Disadvantages Disks become fragmented Wastage of storage is possible
  • 27. Rushdi Shams, Dept of CSE, KUET 27 Implementing Files: Linked List Allocation Every block will have two sections- a pointer to next one (the first word of the block) and data (the rest of the words) Unlike contiguous allocation, every disk block can be used in this method No space is lost due to disk fragmentation
  • 28. Rushdi Shams, Dept of CSE, KUET 28 Implementing Files: Linked List Allocation Reading a file sequentially is straight forward but random access is slow. To get block n, the OS has to start at the beginning and read the n-1 blocks prior to it Overhead due to pointer information
  • 29. Rushdi Shams, Dept of CSE, KUET 29 Implementing Files: Linked List Allocation
  • 30. Rushdi Shams, Dept of CSE, KUET 30 Linked List Allocation: using Table in Memory The disadvantages are eliminated by taking the pointer word from each block and putting it into a table in memory Such a table in main memory is called FAT (File Allocation Table)
  • 31. Rushdi Shams, Dept of CSE, KUET 31 Linked List Allocation: using Table in Memory
  • 32. Rushdi Shams, Dept of CSE, KUET 32 Linked List Allocation: using Table in Memory Entire block is available for data (no pointer information) Faster random access The primary disadvantage- the table must be in memory all the time to make it work a 20 GB disk and with 1 KB block size, the table needs 20 million entries one for each of 20 million blocks each entry is 4 bytes long so, FAT will occupy 80 MB space in memory all the time
  • 33. Rushdi Shams, Dept of CSE, KUET 33 i-nodes It is a data structure that lists the attributes and disk addresses of the file’s blocks With i-nodes, it is possible to find all the blocks of a file i-nodes need only be in memory when the corresponding file is open If each i-node contains n-bytes and there are k-files are opened at a time, that instant, kn-bytes are reserved in memory
  • 34. Rushdi Shams, Dept of CSE, KUET 34 i-nodes
  • 35. Rushdi Shams, Dept of CSE, KUET 35 i-nodes This array is usually far smaller than the space occupied by the FAT Table for holding the linked list is proportional to disk itself. If the disk has n blocks, the table needs n-entries As the disks grow, the table grows linearly with them i-node requires an array whose size is proportional to the maximum number of files that may be open at once (it does not matter if you have 1 petabyte HDD )
  • 36. Rushdi Shams, Dept of CSE, KUET 36 i-nodes The disadvantage is if you fix the size of i-node and your files have a tendency to grow larger (obviously you cannot say your file will be always 6MB in size )