File system implementation
Upcoming SlideShare
Loading in...5
×
 

File system implementation

on

  • 491 views

 

Statistics

Views

Total Views
491
Views on SlideShare
491
Embed Views
0

Actions

Likes
0
Downloads
8
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • A return to a normal condition.Not staying the same throughout
  • A collection of items of the same type stored in a hidden or inaccessible place.
  • he return of something to a former owner, place, or condition.
  • 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
  • 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.

File system implementation File system implementation Presentation Transcript

  • 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 ManagementBit 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 PerformancePerformance  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
  • RecoveryConsistency checkingProblem:1. Directory information kept in main memory2. Main memory more up to date than info on diskWhat 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
  • RecoveryFixable 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 backupBackup programs take advantage of metadata about fileupdates: 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 NFSArchitectureUNIX 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 requestsNFS service layer bottom layer of the architecture Implements the NFS protocol
  • Hope u have learnt something !! Thank you