SlideShare a Scribd company logo
Prof. Bushra Shaikh
Chapter 5: Storage Management-
File System Implementation
Lecture No. 31
IT – SE – OS
Prof. Bushra Shaikh
Asistant Professor
Dept. of InformationTechnology,
SIES Graduate School of Technology
1
Prof. Bushra Shaikh
Learning Objectives
• To explain File-System Structure
• To explain File System Implementation
• To explain Directory Implementation
• To explain Allocation Methods & Free-Space Management
2
Prof. Bushra Shaikh
File-System Structure
• File structure concept:
– A logical storage unit
– A collection of related information
• File system implements file structures
– File system resides on secondary
storage (disks)
– File system structure is organized into
layers
Layered file system structure
Prof. Bushra Shaikh
File-System Structure (cont’d)
• Logical file system - manages meta-data
about the file-system structure in file-
control blocks
• File organization module - maintains
information about files and translates
logical block addresses into physical block
addresses
• Basic file system - issues generic
commands to the driver, e.g. read drive1,
cylinder 73, track 2, sector 10
• Device drivers - lowest level of I/O
control with interrupt handlers to
transfer data between memory and disk,
e.g. read block 123
Layered file system structure
Prof. Bushra Shaikh
File-Control Blocks
• The logical file system maintains structures consisting of
information about a file: file-control block (FCB)
Typical FCB
Prof. Bushra Shaikh
File System Implementation –
Data Structure
• There are also several key data structures stored in memory :
• An in-memory mount table : info about each volume.
• An in-memory directory cache of recently accessed directory
information.
• A system-wide open file table, containing a copy of the FCB for
every currently open file in the system, as well as some other
related information.
• A per-process open file table, containing a pointer to the
system open file table as well as some other information.
Prof. Bushra Shaikh
In-Memory File System Structures
Operations
performed when
opening a file
Operations
performed when
reading the file
after opening
Prof. Bushra Shaikh
Virtual File Systems
• Virtual File Systems (VFS) provide an object-
oriented way of implementing file systems
– VFS allows the same system call interface
(the API) to be used for different types of
file systems
– VFS architecture supports different object
types, e.g. file objects, directory objects,
whole file system
– The API is to the VFS interface, e.g.:
open()
read()
write()
mmap()
Prof. Bushra Shaikh
Directory Implementation
How to
efficiently
implement
directory
structures?
Prof. Bushra Shaikh
Directory Implementation (cont’d)
• Linear list of file names with pointer to the data blocks
– Simple to program
– Time-consuming to search for file name in (long) lists
• Hash Table – linear list with hash data structure
– Decreases directory search time
– Collisions – situations where two file names hash to the same location
• Enlarge the hash table
• Or use fixed size with overflow chains
Prof. Bushra Shaikh
Chapter 5: Storage Management-
File System Implementation
Lecture No. 32
IT – SE – OS
Prof. Bushra Shaikh
Asistant Professor
Dept. of InformationTechnology,
SIES Graduate School of Technology
11
Prof. Bushra Shaikh
Learning Objectives
• To explain Allocation Methods
• To explain Free-Space Management
12
Prof. Bushra Shaikh
Allocation Methods
How to
efficiently
allocate data
blocks for files
on disk?
Prof. Bushra Shaikh
Allocation Methods (cont’d)
• Three allocation methods:
1. Contiguous allocation
2. Linked allocation
3. Indexed allocation
Prof. Bushra Shaikh
Contiguous Allocation
• Each file occupies a set of contiguous
blocks on the disk
• Pros:
– Simple – only starting location
(block #) and length (number of
blocks) are required
– Random access
• Cons:
– Wasteful of space (dynamic
storage-allocation problem)
• External fragmentation: may
need to compact space
– Files cannot grow
Prof. Bushra Shaikh
LA/512
Quotient Q
Remainder R
Contiguous Allocation (cont’d)
• Mapping from logical address LA to physical address (B,D) with block number B and displacement D
• Suppose block size is 512 bytes:
• B = Q + starting address
• D = R
Prof. Bushra Shaikh
Linked Allocation
• Each file is a linked list of disk blocks
• Blocks may be scattered anywhere on the
disk
• Pros:
– Simple – need only starting address
– Free-space management system – no
waste of space
• Cons:
– No efficient random access
pointer
block =
Prof. Bushra Shaikh
LA/508
Quotient Q
Remainder R
Linked Allocation (Cont.)
• Mapping logical address LA to physical address (B,D) with block number B and displacement D
• Suppose block size is 512 bytes and each block contains 4 bytes reserved for pointer to next block:
• B = Qth block in the linked chain of blocks
• D = R + 4
Prof. Bushra Shaikh
File-Allocation Table (FAT)
• Variation on linked list allocation
• FAT is located in contiguous
space on disk
• Each entry corresponds to disk
block number
• Each entry contains a pointer to
the next block or 0
• Used by MS-DOS and OS/2
Prof. Bushra Shaikh
Indexed Allocation
• Brings all pointers together into
the index block
• Pros:
– Efficient random access
– Dynamic access without
external fragmentation
• Cons:
– Index table storage overhead
Prof. Bushra Shaikh
Combined Scheme: UNIX (4K bytes per block)
UNIX Inode Structure
Prof. Bushra Shaikh
…
0 1 2 n-1
bit[i] =
0  block[i] free
1  block[i] occupied
Block number calculation:
(number of bits per word) x (number of 0-value words) + offset of first 1 bit
We scan the bitmap sequentially for the first non-zero word.
The first group of 8 bits (00001110) constitute a non-zero word since all bits are not 0.
After the non-0 word is found, we look for the first 1 bit. This is the 4th bit of the non-zero word.
So, offset = 4.Therefore, the first free block number = 8*0+4 = 4.
Free-Space Management - Bit Vector
• Bit vector (for n blocks)
Prof. Bushra Shaikh
Bit Vector (cont’d)
• Pro:
– Easy to find space to allocate contiguous files
• Cons:
– Bit map requires extra space, which can be huge
– Example:
• Given that, Total Memory = 1.3 GB = (1.3*2^27) bytes
• Block size = 512 Byte = (2^9) bytes
• Number of Block = (1.3*(2^27))/(2^9) = (1.3*(2^18))
• We need (1.3*(2^18)) bit to store all the information about bitmap,
• Hence size of Bitmap = (1.3*(2^18)) bit = 1.3*256 KB = 332.8 KB
Prof. Bushra Shaikh
Free-Space Management
• Linked list of free blocks
• Pros:
– No waste of space
• Cons:
– Difficult to allocate contiguous
blocks
• Other methods :
– Grouping
– Counting
Prof. Bushra Shaikh
End of Chapter 11
Prof. Bushra Shaikh
Efficiency and Performance
• Efficiency dependent on:
– Disk allocation and directory algorithms
– Types of data kept in file’s directory entry
• Performance enhancements:
– Disk cache – separate section of main memory for frequently used blocks
– Free-behind and read-ahead – techniques to optimize sequential access
– Improve PC performance by dedicating section of memory as virtual disk, or RAM disk
Prof. Bushra Shaikh
Page Cache
• A page cache caches file data as
pages rather than disk blocks
using virtual memory techniques
• Memory-mapped I/O uses a page
cache
• Routine I/O through the file
system uses the buffer (disk)
cache
I/O without a unified buffer cache
Prof. Bushra Shaikh
Unified Buffer Cache
• A unified buffer cache uses the
same page cache to cache both
memory-mapped pages and
ordinary file system I/O
Prof. Bushra Shaikh
Recovery
• Consistency checking – compares data in directory structure with data blocks on disk, and tries to fix
inconsistencies (Eg. Fsck(Linux) or chkdsk (Windows))
• Use system programs to back up data from disk to another storage device (floppy disk, magnetic
tape, other magnetic disk, optical)
• Recover lost file or disk by restoring data from backup
Prof. Bushra Shaikh
Log Structured File Systems
• Log structured (or journaling) file systems record each update to
the file system as a transaction
• All transactions are written to a log
– A transaction is considered committed once it is written to
the log
– However, the file system may not yet be updated
• The transactions in the log are asynchronously written to the file
system
– When the file system is modified, the transaction is removed
from the log
• If the file system crashes, all remaining transactions in the log
must still be performed
Prof. Bushra Shaikh
The Sun Network File System (NFS)
• NFS is an implementation and a specification of a software system for accessing remote files across
LANs (or WANs)
• The implementation is part of the Solaris and SunOS operating systems running on Sun workstations
using an unreliable datagram protocol UDP/IP protocol e.g. over Ethernet
• NFS is now widely used
Prof. Bushra Shaikh
NFS Design
• NFS is designed to operate in a heterogeneous environment of different machines, operating
systems, and network architectures
– Allows sharing among file systems on different machines in a transparent manner
– NFS specifications are independent of these media
– Independence is achieved through the use of RPC (Remote Procedure Calling) primitives built on
top of an External Data Representation (XDR) protocol used between two implementation-
independent interfaces
• The NFS specification distinguishes between the services provided by a mount mechanism and the
actual remote-file-access services
Prof. Bushra Shaikh
NFS Protocol
• Provides RPC for remote file operations
• The procedures support the following operations:
– Searching for a file within a directory
– Reading a set of directory entries
– Manipulating links and directories
– Accessing file attributes
– Reading and writing files
• NFS servers are stateless; each request has to provide a full set of arguments (NFS V4 is stateful)
• Modified data must be committed to the server’s disk before results are returned to the client (lose
advantages of caching)
• The NFS protocol does not provide concurrency-control mechanisms
Prof. Bushra Shaikh
NFS Remote Operations
• Nearly one-to-one correspondence between regular UNIX system
calls and the NFS protocol RPCs (except opening and closing files)
• NFS adheres to the remote-service paradigm, but employs
buffering and caching techniques for the sake of performance
• File-blocks cache – when a file is opened, the kernel checks with
the remote server whether to fetch or revalidate the cached
attributes
– Cached file blocks are used only if the corresponding cached
attributes are up to date
• File-attribute cache – the attribute cache is updated whenever
new attributes arrive from the server
• Clients do not free delayed-write blocks until the server confirms
that the data have been written to disk
Prof. Bushra Shaikh
NFS Mounting
• A remote directory is mounted over a local file system directory
– The mounted directory looks like an integral subtree of the local file system, replacing the
subtree descending from the local directory
– Specification of the remote directory for the mount operation is nontransparent
• The host name of the remote directory has to be provided
– Subject to access-rights accreditation, potentially any file system (or directory within a file
system), can be mounted remotely on top of any local directory
Prof. Bushra Shaikh
Three Independent File Systems - Mounting
After
NFS mount
Cascading mounts
User Server1 Server2
Prof. Bushra Shaikh
NFS Mount Protocol
• Establishesinitial logical connection between server and
client
• Mount operation includes name of remote directory to be
mounted and name of server machine storing it
– Mount request is mapped to corresponding RPC and
forwarded to mount server running on server machine
– Export list – specifies local file systems that server
exports for mounting, along with names of machines
that are permitted to mount them
• Following a mount request that conforms to its export list,
the server returns a file handle—a key for further accesses
• File handle – a file-system identifier, and an inode number
to identify the mounted directory within the exported file
system
Prof. Bushra Shaikh
Three Major Layers of NFS Architecture
• UNIX file-system interface (based on the open, read, write, and close calls, and file descriptors)
• Virtual File System (VFS) layer – distinguishes local files from remote ones, and local files are further
distinguished according to their file-system types
– The VFS activates file-system-specific operations to handle local requests according to their file-
system types
– Calls the NFS protocol procedures for remote requests
• NFS service layer – bottom layer of the architecture
– Implements the NFS protocol
Prof. Bushra Shaikh
Schematic View of NFS Architecture
Prof. Bushra Shaikh
NFS Path-Name Translation
• Performed by breaking the path into component names and performing a separate NFS lookup call
for every pair of component name and directory vnode
• To make lookup faster, a directory name lookup cache on the client’s side holds the vnodes for
remote directory names
Ad

More Related Content

What's hot (20)

Virtual memory
Virtual memoryVirtual memory
Virtual memory
Anuj Modi
 
Memory management
Memory managementMemory management
Memory management
Rajni Sirohi
 
Data transfer and manipulation
Data transfer and manipulationData transfer and manipulation
Data transfer and manipulation
Sanjeev Patel
 
File access method
File access methodFile access method
File access method
GayathriS578276
 
Paging.ppt
Paging.pptPaging.ppt
Paging.ppt
infomerlin
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43
myrajendra
 
Swapping | Computer Science
Swapping | Computer ScienceSwapping | Computer Science
Swapping | Computer Science
Transweb Global Inc
 
File system structure
File system structureFile system structure
File system structure
sangrampatil81
 
Cache memory
Cache memoryCache memory
Cache memory
Anuj Modi
 
Free space managment46
Free space managment46Free space managment46
Free space managment46
myrajendra
 
Distributed file system
Distributed file systemDistributed file system
Distributed file system
Anamika Singh
 
Demand paging
Demand pagingDemand paging
Demand paging
Trinity Dwarka
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
J.T.A.JONES
 
Mass Storage Structure
Mass Storage StructureMass Storage Structure
Mass Storage Structure
Vimalanathan D
 
Semophores and it's types
Semophores and it's typesSemophores and it's types
Semophores and it's types
Nishant Joshi
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
Akhil Kaushik
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
sangrampatil81
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
sanjana mun
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipelining
Mazin Alwaaly
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
NEERAJ BAGHEL
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
Anuj Modi
 
Data transfer and manipulation
Data transfer and manipulationData transfer and manipulation
Data transfer and manipulation
Sanjeev Patel
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43
myrajendra
 
Cache memory
Cache memoryCache memory
Cache memory
Anuj Modi
 
Free space managment46
Free space managment46Free space managment46
Free space managment46
myrajendra
 
Distributed file system
Distributed file systemDistributed file system
Distributed file system
Anamika Singh
 
Mass Storage Structure
Mass Storage StructureMass Storage Structure
Mass Storage Structure
Vimalanathan D
 
Semophores and it's types
Semophores and it's typesSemophores and it's types
Semophores and it's types
Nishant Joshi
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
sangrampatil81
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipelining
Mazin Alwaaly
 

Similar to chapter5-file system implementation.ppt (20)

Ch11 file system implementation
Ch11   file system implementationCh11   file system implementation
Ch11 file system implementation
Welly Dian Astika
 
OS Unit5.pptx
OS Unit5.pptxOS Unit5.pptx
OS Unit5.pptx
DHANABALSUBRAMANIAN
 
Operating System File System IMpl lecture19.pptx
Operating System File System IMpl lecture19.pptxOperating System File System IMpl lecture19.pptx
Operating System File System IMpl lecture19.pptx
SuryaBasnet3
 
file management_part2_os_notes.ppt
file management_part2_os_notes.pptfile management_part2_os_notes.ppt
file management_part2_os_notes.ppt
HelalMirzad
 
Allocation and free space management
Allocation and free space managementAllocation and free space management
Allocation and free space management
rajshreemuthiah
 
File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control
YuvrajWadavale
 
AOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksAOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocks
Zubair Nabi
 
operating system File - System Interface
operating system File - System Interfaceoperating system File - System Interface
operating system File - System Interface
Dr. Chandrakant Divate
 
Ch10 file system interface
Ch10   file system interfaceCh10   file system interface
Ch10 file system interface
Welly Dian Astika
 
File system implementation
File system implementationFile system implementation
File system implementation
Rotract CLUB of BSAU
 
FILE Implementation Introduction imp .pptx
FILE Implementation Introduction imp .pptxFILE Implementation Introduction imp .pptx
FILE Implementation Introduction imp .pptx
pranilArunJadhav
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
Cahaya Penyayang
 
file system overview in oerating system .
file system overview in oerating system .file system overview in oerating system .
file system overview in oerating system .
pavanm6360
 
File system
File systemFile system
File system
Navin Royal Achakkagari
 
Ext filesystem4
Ext filesystem4Ext filesystem4
Ext filesystem4
Neha Kulkarni
 
OS_Ch12
OS_Ch12OS_Ch12
OS_Ch12
Supriya Shrivastava
 
OSCh12
OSCh12OSCh12
OSCh12
Joe Christensen
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OS
C.U
 
Ch11
Ch11Ch11
Ch11
tech2click
 
10 File System
10 File System10 File System
10 File System
Dr. Loganathan R
 
Ch11 file system implementation
Ch11   file system implementationCh11   file system implementation
Ch11 file system implementation
Welly Dian Astika
 
Operating System File System IMpl lecture19.pptx
Operating System File System IMpl lecture19.pptxOperating System File System IMpl lecture19.pptx
Operating System File System IMpl lecture19.pptx
SuryaBasnet3
 
file management_part2_os_notes.ppt
file management_part2_os_notes.pptfile management_part2_os_notes.ppt
file management_part2_os_notes.ppt
HelalMirzad
 
Allocation and free space management
Allocation and free space managementAllocation and free space management
Allocation and free space management
rajshreemuthiah
 
File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control
YuvrajWadavale
 
AOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksAOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocks
Zubair Nabi
 
operating system File - System Interface
operating system File - System Interfaceoperating system File - System Interface
operating system File - System Interface
Dr. Chandrakant Divate
 
FILE Implementation Introduction imp .pptx
FILE Implementation Introduction imp .pptxFILE Implementation Introduction imp .pptx
FILE Implementation Introduction imp .pptx
pranilArunJadhav
 
file system overview in oerating system .
file system overview in oerating system .file system overview in oerating system .
file system overview in oerating system .
pavanm6360
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OS
C.U
 
Ad

More from BUSHRASHAIKH804312 (7)

Andrew and Zac RVA-Beyond-Automated-Testing-2016.ppt
Andrew and Zac RVA-Beyond-Automated-Testing-2016.pptAndrew and Zac RVA-Beyond-Automated-Testing-2016.ppt
Andrew and Zac RVA-Beyond-Automated-Testing-2016.ppt
BUSHRASHAIKH804312
 
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
BUSHRASHAIKH804312
 
Direct infection: virus can infect files every time a user opens that specif...
Direct infection: virus can infect files every time a user  opens that specif...Direct infection: virus can infect files every time a user  opens that specif...
Direct infection: virus can infect files every time a user opens that specif...
BUSHRASHAIKH804312
 
1-SoftwareEngineeringandBestPractices.ppt
1-SoftwareEngineeringandBestPractices.ppt1-SoftwareEngineeringandBestPractices.ppt
1-SoftwareEngineeringandBestPractices.ppt
BUSHRASHAIKH804312
 
Ch4-ControlFlowTesting.ppt
Ch4-ControlFlowTesting.pptCh4-ControlFlowTesting.ppt
Ch4-ControlFlowTesting.ppt
BUSHRASHAIKH804312
 
knowledge-portal-150406070618-conversion-gate01.pdf
knowledge-portal-150406070618-conversion-gate01.pdfknowledge-portal-150406070618-conversion-gate01.pdf
knowledge-portal-150406070618-conversion-gate01.pdf
BUSHRASHAIKH804312
 
SQA.ppt
SQA.pptSQA.ppt
SQA.ppt
BUSHRASHAIKH804312
 
Andrew and Zac RVA-Beyond-Automated-Testing-2016.ppt
Andrew and Zac RVA-Beyond-Automated-Testing-2016.pptAndrew and Zac RVA-Beyond-Automated-Testing-2016.ppt
Andrew and Zac RVA-Beyond-Automated-Testing-2016.ppt
BUSHRASHAIKH804312
 
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
BUSHRASHAIKH804312
 
Direct infection: virus can infect files every time a user opens that specif...
Direct infection: virus can infect files every time a user  opens that specif...Direct infection: virus can infect files every time a user  opens that specif...
Direct infection: virus can infect files every time a user opens that specif...
BUSHRASHAIKH804312
 
1-SoftwareEngineeringandBestPractices.ppt
1-SoftwareEngineeringandBestPractices.ppt1-SoftwareEngineeringandBestPractices.ppt
1-SoftwareEngineeringandBestPractices.ppt
BUSHRASHAIKH804312
 
knowledge-portal-150406070618-conversion-gate01.pdf
knowledge-portal-150406070618-conversion-gate01.pdfknowledge-portal-150406070618-conversion-gate01.pdf
knowledge-portal-150406070618-conversion-gate01.pdf
BUSHRASHAIKH804312
 
Ad

Recently uploaded (20)

Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 

chapter5-file system implementation.ppt

  • 1. Prof. Bushra Shaikh Chapter 5: Storage Management- File System Implementation Lecture No. 31 IT – SE – OS Prof. Bushra Shaikh Asistant Professor Dept. of InformationTechnology, SIES Graduate School of Technology 1
  • 2. Prof. Bushra Shaikh Learning Objectives • To explain File-System Structure • To explain File System Implementation • To explain Directory Implementation • To explain Allocation Methods & Free-Space Management 2
  • 3. Prof. Bushra Shaikh File-System Structure • File structure concept: – A logical storage unit – A collection of related information • File system implements file structures – File system resides on secondary storage (disks) – File system structure is organized into layers Layered file system structure
  • 4. Prof. Bushra Shaikh File-System Structure (cont’d) • Logical file system - manages meta-data about the file-system structure in file- control blocks • File organization module - maintains information about files and translates logical block addresses into physical block addresses • Basic file system - issues generic commands to the driver, e.g. read drive1, cylinder 73, track 2, sector 10 • Device drivers - lowest level of I/O control with interrupt handlers to transfer data between memory and disk, e.g. read block 123 Layered file system structure
  • 5. Prof. Bushra Shaikh File-Control Blocks • The logical file system maintains structures consisting of information about a file: file-control block (FCB) Typical FCB
  • 6. Prof. Bushra Shaikh File System Implementation – Data Structure • There are also several key data structures stored in memory : • An in-memory mount table : info about each volume. • An in-memory directory cache of recently accessed directory information. • A system-wide open file table, containing a copy of the FCB for every currently open file in the system, as well as some other related information. • A per-process open file table, containing a pointer to the system open file table as well as some other information.
  • 7. Prof. Bushra Shaikh In-Memory File System Structures Operations performed when opening a file Operations performed when reading the file after opening
  • 8. Prof. Bushra Shaikh Virtual File Systems • Virtual File Systems (VFS) provide an object- oriented way of implementing file systems – VFS allows the same system call interface (the API) to be used for different types of file systems – VFS architecture supports different object types, e.g. file objects, directory objects, whole file system – The API is to the VFS interface, e.g.: open() read() write() mmap()
  • 9. Prof. Bushra Shaikh Directory Implementation How to efficiently implement directory structures?
  • 10. Prof. Bushra Shaikh Directory Implementation (cont’d) • Linear list of file names with pointer to the data blocks – Simple to program – Time-consuming to search for file name in (long) lists • Hash Table – linear list with hash data structure – Decreases directory search time – Collisions – situations where two file names hash to the same location • Enlarge the hash table • Or use fixed size with overflow chains
  • 11. Prof. Bushra Shaikh Chapter 5: Storage Management- File System Implementation Lecture No. 32 IT – SE – OS Prof. Bushra Shaikh Asistant Professor Dept. of InformationTechnology, SIES Graduate School of Technology 11
  • 12. Prof. Bushra Shaikh Learning Objectives • To explain Allocation Methods • To explain Free-Space Management 12
  • 13. Prof. Bushra Shaikh Allocation Methods How to efficiently allocate data blocks for files on disk?
  • 14. Prof. Bushra Shaikh Allocation Methods (cont’d) • Three allocation methods: 1. Contiguous allocation 2. Linked allocation 3. Indexed allocation
  • 15. Prof. Bushra Shaikh Contiguous Allocation • Each file occupies a set of contiguous blocks on the disk • Pros: – Simple – only starting location (block #) and length (number of blocks) are required – Random access • Cons: – Wasteful of space (dynamic storage-allocation problem) • External fragmentation: may need to compact space – Files cannot grow
  • 16. Prof. Bushra Shaikh LA/512 Quotient Q Remainder R Contiguous Allocation (cont’d) • Mapping from logical address LA to physical address (B,D) with block number B and displacement D • Suppose block size is 512 bytes: • B = Q + starting address • D = R
  • 17. Prof. Bushra Shaikh Linked Allocation • Each file is a linked list of disk blocks • Blocks may be scattered anywhere on the disk • Pros: – Simple – need only starting address – Free-space management system – no waste of space • Cons: – No efficient random access pointer block =
  • 18. Prof. Bushra Shaikh LA/508 Quotient Q Remainder R Linked Allocation (Cont.) • Mapping logical address LA to physical address (B,D) with block number B and displacement D • Suppose block size is 512 bytes and each block contains 4 bytes reserved for pointer to next block: • B = Qth block in the linked chain of blocks • D = R + 4
  • 19. Prof. Bushra Shaikh File-Allocation Table (FAT) • Variation on linked list allocation • FAT is located in contiguous space on disk • Each entry corresponds to disk block number • Each entry contains a pointer to the next block or 0 • Used by MS-DOS and OS/2
  • 20. Prof. Bushra Shaikh Indexed Allocation • Brings all pointers together into the index block • Pros: – Efficient random access – Dynamic access without external fragmentation • Cons: – Index table storage overhead
  • 21. Prof. Bushra Shaikh Combined Scheme: UNIX (4K bytes per block) UNIX Inode Structure
  • 22. Prof. Bushra Shaikh … 0 1 2 n-1 bit[i] = 0  block[i] free 1  block[i] occupied Block number calculation: (number of bits per word) x (number of 0-value words) + offset of first 1 bit We scan the bitmap sequentially for the first non-zero word. The first group of 8 bits (00001110) constitute a non-zero word since all bits are not 0. After the non-0 word is found, we look for the first 1 bit. This is the 4th bit of the non-zero word. So, offset = 4.Therefore, the first free block number = 8*0+4 = 4. Free-Space Management - Bit Vector • Bit vector (for n blocks)
  • 23. Prof. Bushra Shaikh Bit Vector (cont’d) • Pro: – Easy to find space to allocate contiguous files • Cons: – Bit map requires extra space, which can be huge – Example: • Given that, Total Memory = 1.3 GB = (1.3*2^27) bytes • Block size = 512 Byte = (2^9) bytes • Number of Block = (1.3*(2^27))/(2^9) = (1.3*(2^18)) • We need (1.3*(2^18)) bit to store all the information about bitmap, • Hence size of Bitmap = (1.3*(2^18)) bit = 1.3*256 KB = 332.8 KB
  • 24. Prof. Bushra Shaikh Free-Space Management • Linked list of free blocks • Pros: – No waste of space • Cons: – Difficult to allocate contiguous blocks • Other methods : – Grouping – Counting
  • 25. Prof. Bushra Shaikh End of Chapter 11
  • 26. Prof. Bushra Shaikh Efficiency and Performance • Efficiency dependent on: – Disk allocation and directory algorithms – Types of data kept in file’s directory entry • Performance enhancements: – Disk cache – separate section of main memory for frequently used blocks – Free-behind and read-ahead – techniques to optimize sequential access – Improve PC performance by dedicating section of memory as virtual disk, or RAM disk
  • 27. Prof. Bushra Shaikh Page Cache • A page cache caches file data as pages rather than disk blocks using virtual memory techniques • Memory-mapped I/O uses a page cache • Routine I/O through the file system uses the buffer (disk) cache I/O without a unified buffer cache
  • 28. Prof. Bushra Shaikh Unified Buffer Cache • A unified buffer cache uses the same page cache to cache both memory-mapped pages and ordinary file system I/O
  • 29. Prof. Bushra Shaikh Recovery • Consistency checking – compares data in directory structure with data blocks on disk, and tries to fix inconsistencies (Eg. Fsck(Linux) or chkdsk (Windows)) • Use system programs to back up data from disk to another storage device (floppy disk, magnetic tape, other magnetic disk, optical) • Recover lost file or disk by restoring data from backup
  • 30. Prof. Bushra Shaikh Log Structured File Systems • Log structured (or journaling) file systems record each update to the file system as a transaction • All transactions are written to a log – A transaction is considered committed once it is written to the log – However, the file system may not yet be updated • The transactions in the log are asynchronously written to the file system – When the file system is modified, the transaction is removed from the log • If the file system crashes, all remaining transactions in the log must still be performed
  • 31. Prof. Bushra Shaikh The Sun Network File System (NFS) • NFS is an implementation and a specification of a software system for accessing remote files across LANs (or WANs) • The implementation is part of the Solaris and SunOS operating systems running on Sun workstations using an unreliable datagram protocol UDP/IP protocol e.g. over Ethernet • NFS is now widely used
  • 32. Prof. Bushra Shaikh NFS Design • NFS is designed to operate in a heterogeneous environment of different machines, operating systems, and network architectures – Allows sharing among file systems on different machines in a transparent manner – NFS specifications are independent of these media – Independence is achieved through the use of RPC (Remote Procedure Calling) primitives built on top of an External Data Representation (XDR) protocol used between two implementation- independent interfaces • The NFS specification distinguishes between the services provided by a mount mechanism and the actual remote-file-access services
  • 33. Prof. Bushra Shaikh NFS Protocol • Provides RPC for remote file operations • The procedures support the following operations: – Searching for a file within a directory – Reading a set of directory entries – Manipulating links and directories – Accessing file attributes – Reading and writing files • NFS servers are stateless; each request has to provide a full set of arguments (NFS V4 is stateful) • Modified data must be committed to the server’s disk before results are returned to the client (lose advantages of caching) • The NFS protocol does not provide concurrency-control mechanisms
  • 34. Prof. Bushra Shaikh NFS Remote Operations • Nearly one-to-one correspondence between regular UNIX system calls and the NFS protocol RPCs (except opening and closing files) • NFS adheres to the remote-service paradigm, but employs buffering and caching techniques for the sake of performance • File-blocks cache – when a file is opened, the kernel checks with the remote server whether to fetch or revalidate the cached attributes – Cached file blocks are used only if the corresponding cached attributes are up to date • File-attribute cache – the attribute cache is updated whenever new attributes arrive from the server • Clients do not free delayed-write blocks until the server confirms that the data have been written to disk
  • 35. Prof. Bushra Shaikh NFS Mounting • A remote directory is mounted over a local file system directory – The mounted directory looks like an integral subtree of the local file system, replacing the subtree descending from the local directory – Specification of the remote directory for the mount operation is nontransparent • The host name of the remote directory has to be provided – Subject to access-rights accreditation, potentially any file system (or directory within a file system), can be mounted remotely on top of any local directory
  • 36. Prof. Bushra Shaikh Three Independent File Systems - Mounting After NFS mount Cascading mounts User Server1 Server2
  • 37. Prof. Bushra Shaikh NFS Mount Protocol • Establishesinitial logical connection between server and client • Mount operation includes name of remote directory to be mounted and name of server machine storing it – Mount request is mapped to corresponding RPC and forwarded to mount server running on server machine – Export list – specifies local file systems that server exports for mounting, along with names of machines that are permitted to mount them • Following a mount request that conforms to its export list, the server returns a file handle—a key for further accesses • File handle – a file-system identifier, and an inode number to identify the mounted directory within the exported file system
  • 38. Prof. Bushra Shaikh Three Major Layers of NFS Architecture • UNIX file-system interface (based on the open, read, write, and close calls, and file descriptors) • Virtual File System (VFS) layer – distinguishes local files from remote ones, and local files are further distinguished according to their file-system types – The VFS activates file-system-specific operations to handle local requests according to their file- system types – Calls the NFS protocol procedures for remote requests • NFS service layer – bottom layer of the architecture – Implements the NFS protocol
  • 39. Prof. Bushra Shaikh Schematic View of NFS Architecture
  • 40. Prof. Bushra Shaikh NFS Path-Name Translation • Performed by breaking the path into component names and performing a separate NFS lookup call for every pair of component name and directory vnode • To make lookup faster, a directory name lookup cache on the client’s side holds the vnodes for remote directory names