1 of 14

Chapter 10: File-System Interface

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition,

2 of 14

Chapter 10: File-System Interface

  • File Concept
  • Access Methods
  • Directory Structure

10.*

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition

3 of 14

Objectives

  • To explain the function of file systems
  • To describe the interfaces to file systems
  • To discuss file-system design tradeoffs, including access methods, file sharing, file locking, and directory structures

10.*

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition

4 of 14

File Concept

  • Contiguous logical address space�
  • Types:
    • Data
      • numeric
      • character
      • binary
    • Program

10.*

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition

5 of 14

File Structure

  • None - sequence of words, bytes
  • Simple record structure
    • Lines
    • Fixed length
    • Variable length
  • Complex Structures
    • Formatted document
    • Relocatable load file

10.*

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition

6 of 14

File Attributes

  • Name – only information kept in human-readable form
  • Identifier – unique tag (number) identifies file within file system
  • Type – needed for systems that support different types
  • Location – pointer to file location on device
  • Size – current file size
  • Protection – controls who can do reading, writing, executing
  • Time, date, and user identification – data for protection, security, and usage monitoring
  • Information about files are kept in the directory structure, which is maintained on the disk

10.*

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition

7 of 14

File Operations

  • File is an abstract data type
  • Create
  • Write
  • Read
  • Reposition within file
  • Delete
  • Truncate
  • Open(Fi) – search the directory structure on disk for entry Fi, and move the content of entry to memory
  • Close (Fi) – move the content of entry Fi in memory to directory structure on disk

10.*

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition

8 of 14

File Types – Name, Extension

10.*

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition

9 of 14

Access Methods

  • Sequential Access

read next

write next

reset

no read after last write

(rewrite)

  • Direct Access

read n

write n

position to n

read next

write next

rewrite n

n = relative block number

10.*

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition

10 of 14

Sequential-access File

10.*

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition

11 of 14

Simulation of Sequential Access on Direct-access File

10.*

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition

12 of 14

Directory Structure

  • A collection of nodes containing information about all files

F 1

F 2

F 3

F 4

F n

Directory

Files

Both the directory structure and the files reside on disk

Backups of these two structures are kept on tapes

10.*

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition

13 of 14

Operations Performed on Directory

  • Search for a file
  • Create a file
  • Delete a file
  • List a directory
  • Rename a file
  • Traverse the file system

10.*

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition

14 of 14

End of Chapter 10

Silberschatz, Galvin and Gagne ©2009

Operating System Concepts – 8th Edition,