SlideShare a Scribd company logo
Unit – 4




   File System Implementation
Overview

 Free Space Management
 Efficiency and Performance
 Recovery
 Log-Structured File Systems
 NFS
Free-Space Management
 How should unallocated blocks be managed?
 Need a data structure to keep track of them
    Index block
          same as for conventional file, but no info in any block
          initially very large; makes it impractical: index table too large
    Linked list
          Very large
          Hard to manage spatial locality
          want to allocate closely located blocks to a file
          this minimizes seek time
          hard to do with a linked list; have to traverse the list to find appropriate
           blocks
Linked Free Space List on Disk
Free-Space Management
 Need a data structure to keep track of them
    Grouping
          Modification of free-list (linked-list) approach
          Store the addresses of n free blocks in the first free block
          n - 1 of these are actually free; last block contains pointers to the next n
           free block. Etc.
          Can now find a large number of free blocks quickly.
    Counting
          Don’t keep the address of every free block.
          Free blocks are often consecutive
          So keep the address of the first free block and the number of following
           consecutive blocks that are free.
          Each entry in the free-space list consists of a disk address and a count.
Free-Space Management
Bit vector (block status map or “disk map”) (n blocks)

                     0 1       2                         n-1
                                               …


                         
                               0   block[i] free
                  bit[i] =
                               1    block[i] occupied
 Block number calculation

                   (number of bits per word) *
                   (number of 0-value words) +
                   offset of first 1 bit

 Most CPUs have special bit-manipulation instructions.
 Example: Intel and PowerPC have instructions that return the offset in a
    word of the first bit with the value 1
Free-Space Management (Cont.)

 Bit map requires extra space
   Example:
              block size = 212 bytes
              disk size = 230 bytes (1 gigabyte)
              n = 230/212 = 218 bits (or 32K bytes)
 Easy to get contiguous files
 Counting
Free-Space Management (Cont.)

Need to protect:
     Pointer to free list
     Bit map
          Must be kept on disk
          Copy in memory and disk may differ
          Cannot allow for block[i] to have a situation where
             bit[i] = 1 in memory and bit[i] = 0 on disk
         Solution:
                   Set bit[i] = 1 in disk
                   Allocate block[i]
                   Set bit[i] = 1 in memory
Efficiency and Performance

 Efficiency dependent on:
     disk allocation and directory algorithms
     types of data kept in file’s directory entry
         Example: keep a “last write date” and a “last access date”
          Thus whenever a file is read, a field in the directory structure must be
           written to.
          This means that the block must be read into memory, a section changed,
           and the block written back out to disk.
Efficiency and Performance

Performance
   disk cache – separate section of RAM in the disk controller for
    frequently used blocks
   Some systems maintain a separate section of main memory for a
    buffer cache.
   Keep blocks read from disk on assumption that they’ll be used again
   free-behind and read-ahead – techniques to optimize sequential
    access
   improve PC performance by dedicating section of memory as virtual
    disk, or RAM disk
Recovery
Consistency checking
Problem:
1.   Directory information kept in main memory
2.   Main memory more up to date than info on disk
What happens when computer crashes?
          Changes to directories may be lost.
          Actual state is not reflected in the directory structure.
          compares data in directory structure with data blocks on
           disk
          tries to fix inconsistencies
Recovery
Fixable problems
   Depend on free-space-management algorithms
   If linked allocation used and each block links to next block
   Then directory structure can be reconstructed from data
    block
    Example: UNIX
   Indexed system, blocks have no knowledge of one another
   Impossible to recreate files
   This is why UNIX caches read
   But any action that results in metadata changes is done
    synchronously, before data blocks are written
Recovery
 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
Backup programs take advantage of metadata about file
updates:
    Day 1 Copy all files from disk to backup drive (full backup)
    Day 2 Copy changes since day 1 (incremental backup)
    Day 3 Copy changes since day 2
    …
    Day n Copy changes since day n-1.
    Start over again.
 Allows restoration by starting with full backup, then applying all
  incremental changes.
Log Structured File Systems
  Log structured (or journaling) file systems record each update to
   the file system as a transaction
  All metadata transactions are written to a log
  Each set of operations for performing a specific task is a
   transaction
  A transaction is considered committed once it is written to the log
   (even though the operations are not yet performed)
  The transactions in the log are asynchronously written to the file
   system
  As the operations are completed, a pointer is updated to indicate
   which actions have completed and which are still incomplete
  When all operations are complete, the transaction is removed from
   the log file
  If the file system crashes, all remaining transactions in the log
   must still be performed
The Sun Network File System (NFS)

 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) and Ethernet
 Interconnected workstations viewed as a set of independent
  machines with independent file systems, which allows sharing
  among these file systems in a transparent manner
NFS
  Accesing file over a network
  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
  Files in the remote directory can then be accessed in a
   transparent manner
  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
NFS Protocol
 Provides a set of remote procedure calls for remote file
  operations.
 The procedures support the following operations:
    1.   searching for a file within a directory
    2.   reading a set of directory entries
    3.   manipulating links and directories
    4.   accessing file attributes
    5.   reading and writing files
 NFS servers are stateless; each request has to provide a full set
  of arguments
 (NFS V4 is just coming available – very different, stateful)
 The NFS protocol does not provide concurrency-control
  mechanisms
Three Major Layers of NFS
Architecture
UNIX file-system layer
 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
Hope u have learnt something !!

     Thank you

More Related Content

PPT
Chapter 12 - Mass Storage Systems
PPT
File Management in Operating Systems
PPT
Memory management
PPT
Chapter 11 - File System Implementation
PPTX
Page replacement algorithms
PPTX
file system in operating system
PPTX
File system Os
Chapter 12 - Mass Storage Systems
File Management in Operating Systems
Memory management
Chapter 11 - File System Implementation
Page replacement algorithms
file system in operating system
File system Os

What's hot (20)

PPT
ch10 Mass Storage Structure .ppt
PDF
Dbms 14: Relational Calculus
PPT
File organization 1
PPTX
Distributed Databases
PPS
Virtual memory
DOC
Lesson 2 History Of Operating System
PPTX
Code optimization
PPTX
Directory structure
PPTX
File Management in Operating System
PDF
File System Implementation - Part1
PPTX
Directory implementation and allocation methods
PPTX
Segmentation in operating systems
PPTX
Mass storage systemsos
PPTX
Advantages of DBMS
PPTX
System calls
PDF
Symbol table in compiler Design
PPT
Advanced Operating System- Introduction
PPTX
Fragmentaton
PPTX
Process in operating system
PPTX
Introduction to Unix
ch10 Mass Storage Structure .ppt
Dbms 14: Relational Calculus
File organization 1
Distributed Databases
Virtual memory
Lesson 2 History Of Operating System
Code optimization
Directory structure
File Management in Operating System
File System Implementation - Part1
Directory implementation and allocation methods
Segmentation in operating systems
Mass storage systemsos
Advantages of DBMS
System calls
Symbol table in compiler Design
Advanced Operating System- Introduction
Fragmentaton
Process in operating system
Introduction to Unix
Ad

Viewers also liked (20)

PPTX
File System Implementation
PPT
File system
PPT
Constructor and Destructor PPT
PPTX
Constructor and destructor
PPT
Ch7: Process Synchronization
PPTX
constructor & destructor in cpp
PPT
Ch11: File System Interface
PPTX
Page Replacement Algorithms
PDF
Distributed computing
PPT
Process Synchronization
PDF
Constructors and Destructors
PPT
Page Replacement
PPT
Chapter 10 - File System Interface
PPTX
Constructors & destructors
PPT
OS Process Synchronization, semaphore and Monitors
PPT
File Management Presentation
PDF
File management
PPT
Os Swapping, Paging, Segmentation and Virtual Memory
PPT
File management ppt
PPT
Chapter 9 - Virtual Memory
File System Implementation
File system
Constructor and Destructor PPT
Constructor and destructor
Ch7: Process Synchronization
constructor & destructor in cpp
Ch11: File System Interface
Page Replacement Algorithms
Distributed computing
Process Synchronization
Constructors and Destructors
Page Replacement
Chapter 10 - File System Interface
Constructors & destructors
OS Process Synchronization, semaphore and Monitors
File Management Presentation
File management
Os Swapping, Paging, Segmentation and Virtual Memory
File management ppt
Chapter 9 - Virtual Memory
Ad

Similar to File system implementation (20)

PPTX
Free Space Management, Efficiency & Performance, Recovery and NFS
PPT
distributed SYSTEMS FSnewBBIT305KCAU.ppt
PDF
Lect09
PPT
Ch12 OS
 
PPT
PDF
Ch11 file system implementation
PPTX
OS Unit5.pptx
ODP
Distributed File System
 
PPTX
Allocation and free space management
PDF
oslectureset7.pdf
PPT
file management_part2_os_notes.ppt
PPT
chapter5-file system implementation.ppt
PPTX
Report blocking ,management of files in secondry memory , static vs dynamic a...
PPTX
virtual_memory (3).pptx
PDF
Unit ivos - file systems
PPT
Unit 3 chapter 1-file management
PPT
PPT
file management_osnotes.ppt
PPT
Introduction to distributed file systems
Free Space Management, Efficiency & Performance, Recovery and NFS
distributed SYSTEMS FSnewBBIT305KCAU.ppt
Lect09
Ch12 OS
 
Ch11 file system implementation
OS Unit5.pptx
Distributed File System
 
Allocation and free space management
oslectureset7.pdf
file management_part2_os_notes.ppt
chapter5-file system implementation.ppt
Report blocking ,management of files in secondry memory , static vs dynamic a...
virtual_memory (3).pptx
Unit ivos - file systems
Unit 3 chapter 1-file management
file management_osnotes.ppt
Introduction to distributed file systems

More from Rotract CLUB of BSAU (7)

PPT
Web technology
PPTX
Security model evaluation of 3 g
PDF
Electricityconservationtips
DOCX
Security model evaluation of 3 g wireless network1 paper presentation
DOCX
word of god
DOCX
word of god
PPTX
ppt about Nokia
Web technology
Security model evaluation of 3 g
Electricityconservationtips
Security model evaluation of 3 g wireless network1 paper presentation
word of god
word of god
ppt about Nokia

Recently uploaded (20)

PPTX
master seminar digital applications in india
PDF
RMMM.pdf make it easy to upload and study
PPTX
Cell Types and Its function , kingdom of life
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Institutional Correction lecture only . . .
PDF
Classroom Observation Tools for Teachers
PDF
Insiders guide to clinical Medicine.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Cell Structure & Organelles in detailed.
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
master seminar digital applications in india
RMMM.pdf make it easy to upload and study
Cell Types and Its function , kingdom of life
Renaissance Architecture: A Journey from Faith to Humanism
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Institutional Correction lecture only . . .
Classroom Observation Tools for Teachers
Insiders guide to clinical Medicine.pdf
Anesthesia in Laparoscopic Surgery in India
TR - Agricultural Crops Production NC III.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Module 4: Burden of Disease Tutorial Slides S2 2025
VCE English Exam - Section C Student Revision Booklet
Cell Structure & Organelles in detailed.
Pharmacology of Heart Failure /Pharmacotherapy of CHF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table

File system implementation

  • 1. Unit – 4 File System Implementation
  • 2. Overview Free Space Management Efficiency and Performance Recovery Log-Structured File Systems NFS
  • 3. Free-Space Management  How should unallocated blocks be managed?  Need a data structure to keep track of them Index block  same as for conventional file, but no info in any block  initially very large; makes it impractical: index table too large Linked list  Very large  Hard to manage spatial locality  want to allocate closely located blocks to a file  this minimizes seek time  hard to do with a linked list; have to traverse the list to find appropriate blocks
  • 4. Linked Free Space List on Disk
  • 5. Free-Space Management  Need a data structure to keep track of them Grouping  Modification of free-list (linked-list) approach  Store the addresses of n free blocks in the first free block  n - 1 of these are actually free; last block contains pointers to the next n free block. Etc.  Can now find a large number of free blocks quickly. Counting  Don’t keep the address of every free block.  Free blocks are often consecutive  So keep the address of the first free block and the number of following consecutive blocks that are free.  Each entry in the free-space list consists of a disk address and a count.
  • 6. Free-Space Management Bit vector (block status map or “disk map”) (n blocks) 0 1 2 n-1 …  0 block[i] free bit[i] = 1 block[i] occupied Block number calculation (number of bits per word) * (number of 0-value words) + offset of first 1 bit Most CPUs have special bit-manipulation instructions. Example: Intel and PowerPC have instructions that return the offset in a word of the first bit with the value 1
  • 7. Free-Space Management (Cont.)  Bit map requires extra space Example: block size = 212 bytes disk size = 230 bytes (1 gigabyte) n = 230/212 = 218 bits (or 32K bytes)  Easy to get contiguous files  Counting
  • 8. Free-Space Management (Cont.) Need to protect:  Pointer to free list  Bit map  Must be kept on disk  Copy in memory and disk may differ  Cannot allow for block[i] to have a situation where bit[i] = 1 in memory and bit[i] = 0 on disk Solution: Set bit[i] = 1 in disk Allocate block[i] Set bit[i] = 1 in memory
  • 9. Efficiency and Performance  Efficiency dependent on:  disk allocation and directory algorithms  types of data kept in file’s directory entry Example: keep a “last write date” and a “last access date”  Thus whenever a file is read, a field in the directory structure must be written to.  This means that the block must be read into memory, a section changed, and the block written back out to disk.
  • 10. Efficiency and Performance Performance  disk cache – separate section of RAM in the disk controller for frequently used blocks  Some systems maintain a separate section of main memory for a buffer cache.  Keep blocks read from disk on assumption that they’ll be used again  free-behind and read-ahead – techniques to optimize sequential access  improve PC performance by dedicating section of memory as virtual disk, or RAM disk
  • 11. Recovery Consistency checking Problem: 1. Directory information kept in main memory 2. Main memory more up to date than info on disk What happens when computer crashes?  Changes to directories may be lost.  Actual state is not reflected in the directory structure.  compares data in directory structure with data blocks on disk  tries to fix inconsistencies
  • 12. Recovery Fixable problems  Depend on free-space-management algorithms  If linked allocation used and each block links to next block  Then directory structure can be reconstructed from data block Example: UNIX  Indexed system, blocks have no knowledge of one another  Impossible to recreate files  This is why UNIX caches read  But any action that results in metadata changes is done synchronously, before data blocks are written
  • 13. Recovery  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 Backup programs take advantage of metadata about file updates: Day 1 Copy all files from disk to backup drive (full backup) Day 2 Copy changes since day 1 (incremental backup) Day 3 Copy changes since day 2 … Day n Copy changes since day n-1. Start over again.  Allows restoration by starting with full backup, then applying all incremental changes.
  • 14. Log Structured File Systems  Log structured (or journaling) file systems record each update to the file system as a transaction  All metadata transactions are written to a log  Each set of operations for performing a specific task is a transaction  A transaction is considered committed once it is written to the log (even though the operations are not yet performed)  The transactions in the log are asynchronously written to the file system  As the operations are completed, a pointer is updated to indicate which actions have completed and which are still incomplete  When all operations are complete, the transaction is removed from the log file  If the file system crashes, all remaining transactions in the log must still be performed
  • 15. The Sun Network File System (NFS)  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) and Ethernet  Interconnected workstations viewed as a set of independent machines with independent file systems, which allows sharing among these file systems in a transparent manner
  • 16. NFS  Accesing file over a network  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  Files in the remote directory can then be accessed in a transparent manner  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
  • 17. NFS Protocol  Provides a set of remote procedure calls for remote file operations.  The procedures support the following operations: 1. searching for a file within a directory 2. reading a set of directory entries 3. manipulating links and directories 4. accessing file attributes 5. reading and writing files  NFS servers are stateless; each request has to provide a full set of arguments  (NFS V4 is just coming available – very different, stateful)  The NFS protocol does not provide concurrency-control mechanisms
  • 18. Three Major Layers of NFS Architecture UNIX file-system layer  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
  • 19. Hope u have learnt something !! Thank you

Editor's Notes

  • #12: A return to a normal condition.Not staying the same throughout
  • #13: A collection of items of the same type stored in a hidden or inaccessible place.
  • #14: he return of something to a former owner, place, or condition.
  • #16: Solaris is the computer operating system that Sun Microsystems Intel-based processors. Sun has historically dominated the large UNIX workstation market. Internet-oriented design.SunOS was the UNIX-based operating system for Scalable Processor Architecture-based workstations and servers from Sun Microsystems. SunOS was based on BSD. SunOS was replaced by Solaris in 1992
  • #17: allowing a user on a client computer to access files over a network in a manner similar to how local storage is accessed. implement the protocol.