Chapter 11: File System Implementation. 11.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Implementation.

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

Allocation Methods - Contiguous
Chapter 10: File-System Interface
Chapter 11: File System Implementation
File System Implementation
File System Implementation
Chapter 12: File System Implementation
1 Operating Systems Chapter 7-File-System File Concept Access Methods Directory Structure Protection File-System Structure Allocation Methods Free-Space.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
File System Structure §File structure l Logical storage unit l Collection of related information §File system resides on secondary storage (disks). §File.
11.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 11: File System Implementation.
Chapter 12: File System Implementation
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
04/05/2004CSCI 315 Operating Systems Design1 File System Implementation.
File System Implementation
04/07/2010CSCI 315 Operating Systems Design1 File System Implementation.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 AE4B33OSS Chapter 11: File System Implementation Chapter 11: File System.
Operating Systems CMPSC 473 I/O Management (4) December 09, Lecture 25 Instructor: Bhuvan Urgaonkar.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials– 8 th Edition Chapter 10: File System Implementation.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Structure.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 11: File System Implementation.
Dr. T. Doom 11.1 CEG 433/633 - Operating Systems I Chapter 11: File-System Implementation File structure –Logical storage unit –Collection of related information.
Free Space Management.
Silberschatz and Galvin  Operating System Concepts File-System Implementation File-System Structure Allocation Methods Free-Space Management.
Page 111/15/2015 CSE 30341: Operating Systems Principles Chapter 11: File System Implementation  Overview  Allocation methods: Contiguous, Linked, Indexed,
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
XE33OSA Chapter 11: File System Implementation. 11.2XE33OSA Silberschatz, Galvin and Gagne ©2005 Chapter 11: File System Implementation Chapter 11: File.
File System Implementation
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
12.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 12: File System Implementation Chapter 12: File System Implementation.
Ridge Xu 12.1 Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation Directory Implementation.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 11-2: File System Implementation Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Chapter 11: Implementing File Systems Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 11: Implementing File Systems Chapter.
Operating System Concepts 7th Edition Abraham SilBerschatz Peter Baer Galvin Greg Gagne Prerequisite: CSE212.
12.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 12: File System Implementation Chapter 12: File System Implementation.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 11: File System Implementation Chapter.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 11: File System Implementation Chapter.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
10.1 CSE Department MAITSandeep Tayal 10 :File-System Implementation File-System Structure Allocation Methods Free-Space Management Directory Implementation.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 11 File-System Implementation Slide 1 Chapter 11: File-System Implementation.
Page 112/7/2015 CSE 30341: Operating Systems Principles Chapter 11: File System Implementation  Overview  File system structure – layered, block based.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Structure.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File System Implementation.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 11: File.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 11: File System Implementation Chapter.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 12: File System Implementation.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 11: File.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 11: File.
11.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 11.5 Free-Space Management Bit vector (n blocks) … 012n-1 bit[i] =  1  block[i]
FILE SYSTEM IMPLEMENTATION 1. 2 File-System Structure File structure Logical storage unit Collection of related information File system resides on secondary.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: Implementing File-Systems.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Outline n File-System.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 11: File System Implementation.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 12: File System Implementation.
File-System Management
Chapter 12: File System Implementation
File-System Implementation
Chapter 11: File System Implementation
Chapter 11: Implementing File Systems
Chapter 12: File System Implementation
Outline Allocation Free space management Memory mapped files
Overview: File system implementation (cont)
File-System Structure
Chapter 14: File-System Implementation
Presentation transcript:

Chapter 11: File System Implementation

11.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Implementation Looked at interface to file-system How users and processes access and modify files But what happens between the ones and zeros on the platter and that interface Layered approach Idea is that low-level format and layout of data should not change the way the user interacts with the file-system

11.3 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Structure File system resides on secondary storage (disks) To the operating: large 1-D array of “blocks” Address becomes a block ID One large array of blocks

11.4 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Secondary Storage File-system installed on a partition (volume) Can be multiple partitions to a disk drive MBR contains disk-level information (stage one bootloader) Boot block (boot control block, kernel or loader, first block in boot partition) Volume Control Block (called a super block in UFS and a Master File Table in NTFS file systems; contains things like the number of blocks, size of blocks, etc.) Inode list ----Data blocks Data blocks---- Master Boot Record (stage 1 bootloader) Super block Partitions (or volumes) Boot block (stage 2 bootloader) Super block Inode list

11.5 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Each file represented by… File control block (Inode in Unix) – storage structure consisting of information about a file One inode per file

11.6 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 To open a file Must locate the Inode (file-control block) Then will know where blocks are

11.7 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Open file tables OS keeps an open file table Also keeps one for each process Open() returns a file descriptor which is an index into this table Used for reads and writes

11.8 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Virtual File Systems Virtual File Systems (VFS) provide an object-oriented way of implementing file systems. VFS allows the same system call interface (the API) to be used for different types of file systems. Same syntax regardless of FS (read(), write(), open(), close())

11.9 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Directory Implementation Directory (dih-rek-tuh-ree) a book alphabetically listing persons and organizations, usually with information about how to contact them In file-systems used to organize and locate files Usually implemented as a file itself Contains  Linear list of file names with pointer to the data blocks.  Hash Table – linear list with hash data structure. File nameInode ch13io_systems.ppt0xFF3A ch2services.ppt0xA23D ch10file_system_interface.ppt0x178E ch11file_system_implementation.ppt0xADE1

11.10 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Allocation Methods An allocation method refers to how disk blocks are allocated for files: How the blocks are laid out on the drive Contiguous allocation Linked allocation Indexed allocation

11.11 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Contiguous Allocation Simple – only starting location (block #) and length (number of blocks) are required Fragmentation: dynamic storage-allocation problem

11.12 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Linked Allocation Table points to first block Each subsequent block points to next No fragmentation but disk head must jump around to collect entire file Very early versions of file allocation table (FAT)

11.13 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Indexed Allocation File-control block has list of every block used by disk. No external fragmentation Can make one sweep of the disk head to gather entire file

11.14 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Index: how large can a file be? How many blocks? Contiguous and linked no limit (except addressing limitations) However many entries will fit in an inode Triple indirection 1 st 12 blocks directly from inode 13 th points to a block that holds nothing but addresses of data blocks 14 th double indirection 15 th triple

11.15 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Index: how large can a file be? Example 12 direct-block references one single-indirection reference one double-indirection reference one triple-indirection reference How large can a file be? Assume block-size of 4096 bytes an indirection-block (a block used to hold pointers to data-blocks) can hold 1,260 entries (26 bits each).

11.16 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Free-Space Management When it is time to request a block Must have a list of “available” or “free” blocks Unix uses a bit vector (n blocks) Example: block size = 2 12 bytes disk size = 2 30 bytes (1 gigabyte) n = 2 30 /2 12 = 2 18 bits (or 32K bytes) … 012n-1 bit[i] =  0  block[i] free 1  block[i] occupied

11.17 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Bit map requires extra space 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: write ahead Set bit[i] = 1 in disk Allocate block[i] Set bit[i] = 1 in memory Disk BV ↔ Memory BV

11.18 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Linked Free Space List on Disk Could implement free-block list with a linked-list implementation Traversal expensive Often just need the first one

11.19 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Other free-list approaches Grouping Just keep track of the first free block It will have a list of n free blocks The last one in the list will have another list of free blocks Can acquire large numbers of blocks quickly Counting Exploits fact that usually several contiguous blocks are allocated or freed Keep a free-block list Each entry points to a free block and indicates the number of free contiguous blocks Grouping Counting

11.20 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 A few final issues Efficiency: buffering and caching Recovering from failures NFS Efficiency Recovery Networked File System

11.21 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Efficiency and Performance Disk cache (buffer cache) – main memory can act as cache for disk (much like hi-speed cache does for memory) Would this be useful to a Web Server? Can piggy-back off of demand paging system by using memory- mapped IO for file access Unified virtual memory Can lead to double caching …

11.22 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Unified Buffer Cache A unified buffer cache uses the same page cache to cache both memory-mapped pages and ordinary file system I/O

11.23 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Recovery Consistency checking – compares data in directory structure with data blocks on disk, and tries to fix inconsistencies 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 backup fsck Backup Restore

11.24 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Log Structured File Systems Log structured (or journaling) file systems record each update to the file system as a transaction Journaling Similar to DB techniques covered in synchronization chapter Example of Log-Based File Systems Linux ext3 Windows NTFS Easy to recover from failures Simply Redo completed transactions Undo uncompleted transactions Easy to recover from failures Simply Redo completed transactions Undo uncompleted transactions

11.25 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 The Sun Network File System (NFS) Ability to mount a remote file-system into a local file-system NFS instructions and protocols carried over TCP/IP (UDP) Server serving up a shared FS must maintain an export list / bin usr mnt Remote files-system

11.26 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 NFS Protocol File-system appears local Commands are interpreted and sent as Remote Procedure Calls to remote system The same Virtual File System (VFS) layer that allows interfacing with different file-system implementations is used for NFS

End of Chapter 11