Docsity

File System Implementation: Protection, Disk Allocation, and UNIX Inodes, Study notes of Operating Systems

Partial preview of the text

Download File System Implementation: Protection, Disk Allocation, and UNIX Inodes and more Study notes Operating Systems in PDF only on Docsity!

COMP 310:

Operating Systems

Lecture 23:

File System Implementation

November 10, 2004

Christine Alvarado

Today’s goals

 File sharing and protection

 Disk Allocation

 Contiguous allocation

 Linked allocation

 Indexed allocation

 UNIX inodes

 Free space management

 NFS

File Sharing  What kind of directory structure is needed?  Key issues: Protection  File systems implement some kind of protection system

 Who can access

 How can they access

 A protection system dictates whether an action (read/write/execute) performed by a process/thread/user on a file should be allowed

File System Layout

 How do file systems use the disk to store files?

 File systems define a block size (e.g. 4KB)  Disk space allocated in terms of blocks  A “Master Block” determines location of root directory  A “Free Map” keeps track of which blocks are free or allocated  Usually a bitmap (How?)  Stored on disk—can be cached in memory  Remaining disk blocks used to store files. Disk Layout Strategies

Disk

File

Contiguous allocation

Disk

File

Contiguous allocation: Strategies  Similar to VM allocation

 First fit

 Best fit

 Worst fit

Linked Allocation

Disk

File

Linked Allocation: Pros and Cons  Positive:  Negative:

Linked Allocation variation: FAT

 FAT: File allocation table (MS-DOS)

 In linked allocation, where are pointers stored to

next block stored?

 Solution: FAT kept all in one place

FAT Benefits

Unix Inodes and Path Search

 Unix Inodes are NOT directories

 Inodes describe where on disk the blocks for a file

are placed

 Directories are files, so inodes also describe where they are placed

 Directory entries map file names to inodes

 To open /one user Master Block to find inode for /  Open /, look for entry for one  Read the inode for one into memory  The inode says where first data block is on disk  Read that block into memory to read file… Free-Space Management  Bit Vector  Linked List

NFS: Network File System

Should they each have their own FS?

  • cslab
  • cslab - cslab - cslab - cslab
    • cslab NFS: Network File System
  • cslab - cslab - cslab - cslab

Protocols  Mount protocol  NFS protocol Mount protocol

Server Client

file handle contains file system ID and inode number

NFS Protocol: Remote file operations  Files are manipulated remotely through Remote Procedure Calls  Remote procedure calls defined for:

 Searching for a file in a directory

 Reading a set of directory entries

 Manipulating links and directories

 Accessing file attributes

 Reading and writing files

 What file operations are missing?

NFS is “Stateless”

 No information about clients maintained from one

RPC to the next (server doesn’t know who clients

are—but what about the list?)

 Consequence: writes cannot be cached

 Reads and writes guaranteed to be atomic, but no

other synchronization inside NFS