Chapter 11 File System Implementation 4 File structure

  • Slides: 19
Download presentation
Chapter 11: File System Implementation 4 File structure < Logical storage unit < Collection

Chapter 11: File System Implementation 4 File structure < Logical storage unit < Collection of related information 4 File system resides on secondary storage (such as disks) 1. Boot control block - information needed to boot 2. Volume control block - information about volume/partitions (# blocks, size of blocks, free block count, free block pointers) 3. Directory structure (inode) 4. Per file control blocks 4 File system organized into layers 9/13/2021 CSE 30341: Operating Systems Principles page 1

Layered File System 9/13/2021 CSE 30341: Operating Systems Principles page 2

Layered File System 9/13/2021 CSE 30341: Operating Systems Principles page 2

A Typical File Control Block 4 File control block – storage structure consisting of

A Typical File Control Block 4 File control block – storage structure consisting of information about a file 9/13/2021 CSE 30341: Operating Systems Principles page 3

In-Memory File System Structures 9/13/2021 CSE 30341: Operating Systems Principles page 4

In-Memory File System Structures 9/13/2021 CSE 30341: Operating Systems Principles page 4

Virtual File Systems 4 There are many different file systems available on any operating

Virtual File Systems 4 There are many different file systems available on any operating systems < Windows: NTFS, FAT 32 < Linux: ext 2/ext 3, ufs, vfat, ramfs, tmpfs, reiserfs, xfs. . . 4 Virtual File Systems (VFS) provide an objectoriented way of implementing file systems 4 VFS allows the same system call interface (the API) to be used for different types of file systems 4 The API is to the VFS interface, rather than any specific type of file system 9/13/2021 CSE 30341: Operating Systems Principles page 5

Schematic View of Virtual File System 9/13/2021 CSE 30341: Operating Systems Principles page 6

Schematic View of Virtual File System 9/13/2021 CSE 30341: Operating Systems Principles page 6

Directory Implementation 4 Directories hold information about files 4 Linear list of file names

Directory Implementation 4 Directories hold information about files 4 Linear list of file names with pointer to the data blocks. < simple to program < time-consuming to execute 4 Hash Table – linear list with hash data structure. < decreases directory search time < collisions – situations where two file names hash to the same location < fixed size 9/13/2021 CSE 30341: Operating Systems Principles page 7

Allocation Methods 4 An allocation method refers to how disk blocks are allocated for

Allocation Methods 4 An allocation method refers to how disk blocks are allocated for files: 4 Contiguous allocation 4 Linked allocation 4 Indexed allocation 9/13/2021 CSE 30341: Operating Systems Principles page 8

Contiguous Allocation 4 Each file occupies a set of contiguous blocks on the disk

Contiguous Allocation 4 Each file occupies a set of contiguous blocks on the disk 4 Simple – only starting location (block #) and length (number of blocks) are required 4 Random access 4 Wasteful of space (dynamic storageallocation problem) 4 Files cannot grow 9/13/2021 CSE 30341: Operating Systems Principles page 9

Contiguous Allocation of Disk Space 9/13/2021 CSE 30341: Operating Systems Principles page 10

Contiguous Allocation of Disk Space 9/13/2021 CSE 30341: Operating Systems Principles page 10

Extent-Based Systems 4 Many newer file systems (I. e. Veritas File System) use a

Extent-Based Systems 4 Many newer file systems (I. e. Veritas File System) use a modified contiguous allocation scheme 4 Extent-based file systems allocate disk blocks in extents 4 An extent is a contiguous block of disks < Extents are allocated for file allocation < A file consists of one or more extents. 9/13/2021 CSE 30341: Operating Systems Principles page 11

Linked Allocation 4 Each file is a linked list of disk blocks: blocks may

Linked Allocation 4 Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk. block = pointer 4 Simple – need only starting address 4 Free-space management system – no waste of space 4 No random access 9/13/2021 CSE 30341: Operating Systems Principles page 12

Linked Allocation 9/13/2021 CSE 30341: Operating Systems Principles page 13

Linked Allocation 9/13/2021 CSE 30341: Operating Systems Principles page 13

File-Allocation Table (DOS FAT) 9/13/2021 CSE 30341: Operating Systems Principles page 14

File-Allocation Table (DOS FAT) 9/13/2021 CSE 30341: Operating Systems Principles page 14

Indexed Allocation 4 Brings all pointers together into the index block. 4 Logical view.

Indexed Allocation 4 Brings all pointers together into the index block. 4 Logical view. index table 9/13/2021 CSE 30341: Operating Systems Principles page 15

Example of Indexed Allocation 9/13/2021 CSE 30341: Operating Systems Principles page 16

Example of Indexed Allocation 9/13/2021 CSE 30341: Operating Systems Principles page 16

Indexed Allocation (Cont. ) 4 Need index table 4 Random access 4 Dynamic access

Indexed Allocation (Cont. ) 4 Need index table 4 Random access 4 Dynamic access without external fragmentation, but have overhead of index block. 4 Mapping from logical to physical in a file of maximum size of 256 K words and block size of 512 words. We need only 1 block for index table. 9/13/2021 CSE 30341: Operating Systems Principles page 17

Indexed Allocation – Mapping (Cont. ) � outer-index table 9/13/2021 CSE 30341: Operating Systems

Indexed Allocation – Mapping (Cont. ) � outer-index table 9/13/2021 CSE 30341: Operating Systems Principles file page 18

Combined Scheme: UNIX (4 K bytes per block) 9/13/2021 CSE 30341: Operating Systems Principles

Combined Scheme: UNIX (4 K bytes per block) 9/13/2021 CSE 30341: Operating Systems Principles page 19