Docsity

Mass Storage Systems: File System Implementation and Free-Space Management, Slides of Operating Systems

Partial preview of the text

Download Mass Storage Systems: File System Implementation and Free-Space Management and more Slides Operating Systems in PDF only on Docsity!

Lecture 19

Ch 11: File System Implementation

Ch. 12: Mass Storage Structure

Free-Space Management

  • Bit vector ( n blocks)

…

0 1 2 n-

bit[ i ] = 

0 ⇒ block[ i ] free 1 ⇒ block[ i ] occupied Block number calculation (number of bits per word) * (number of 0-value words) + offset of first 1 bit

Linked Free Space List on Disk

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[bit[ i ] = 1 in memory and bit[ i ] to have a situation where i ] = 0 on disk
    • Solution:
      • Set bit[ i ] = 1 in disk
      • Allocate block[ i ]
      • Set bit[ i ] = 1 in memory

Page Cache

  • A page cache caches 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

Unified Buffer Cache

  • A unified buffer cache uses the same page cache to cache both memory-mapped pages and ordinary file system I/O

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

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

NFS (Cont.)

  • NFS is designed to operate in a heterogeneous environment of different machines, operating systems, and network architectures; - the NFS specifications independent of these media
  • This independence is achieved through the use of RPC primitives built on top of an External Data Representation (XDR) protocol used between two implementation- Docsity.com

Three Independent File Systems

NFS Mount Protocol

  • Establishes initial 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 themDocsity.com

NFS Protocol

  • Provides a set of remote procedure calls 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 toDocsity.com

Schematic View of NFS

Architecture

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 Docsity.com