Chapter 11 – File-System Implementation (Pgs 461-499 )

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

File Management.
Part IV: Memory Management
File Management.
File Systems.
Allocation Methods - Contiguous
Chapter 10: File-System Interface
Chapter 11: File System Implementation
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
File System Implementation
File System Implementation
1 Operating Systems Chapter 7-File-System File Concept Access Methods Directory Structure Protection File-System Structure Allocation Methods Free-Space.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
File System Structure §File structure l Logical storage unit l Collection of related information §File system resides on secondary storage (disks). §File.
Chapter 12: File System Implementation
04/05/2004CSCI 315 Operating Systems Design1 File System Implementation.
File System Variations and Software Caching May 19, 2000 Instructor: Gary Kimura.
Silberschatz, Galvin and Gagne  Operating System Concepts File-System Structure File structure user view  Logical storage unit  Collection.
File System Implementation
04/07/2010CSCI 315 Operating Systems Design1 File System Implementation.
CHAPTER 12: FILE SYSTEM IMPLEMENTATION
File Systems (1). Readings r Silbershatz et al: 10.1,10.2,
CS 346 – Chapter 12 File systems –Structure –Information to maintain –How to access a file –Directory implementation –Disk allocation methods  efficient.
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.
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials– 8 th Edition Chapter 10: File System Implementation.
Chapter 8 – Main Memory (Pgs ). Overview  Everything to do with memory is complicated by the fact that more than 1 program can be in memory.
OSes: 11. FS Impl. 1 Operating Systems v Objectives –discuss file storage and access on secondary storage (a hard disk) Certificate Program in Software.
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.
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.
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 Implementation.
Module 4.0: File Systems File is a contiguous logical address space.
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.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 11 File-System Implementation Slide 1 Chapter 11: File-System Implementation.
CE Operating Systems Lecture 17 File systems – interface and implementation.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File System Implementation.
UNIX File System (UFS) Chapter Five.
I MPLEMENTING FILES. Contiguous Allocation:  The simplest allocation scheme is to store each file as a contiguous run of disk blocks (a 50-KB file would.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Lecture 10 Page 1 CS 111 Summer 2013 File Systems Control Structures A file is a named collection of information Primary roles of file system: – To store.
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.
Operating Systems 1 K. Salah Module 4.0: File Systems  File is a contiguous logical address space (of related records)  Access Methods  Directory Structure.
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]
Review CS File Systems - Partitions What is a hard disk partition?
Part III Storage Management
Day 28 File System.
File-System Management
File System Implementation
Chapter 11: File System Implementation
Chapter 12: File System Implementation
Day 27 File System.
Operating Systems (CS 340 D)
Operating Systems (CS 340 D)
Chapter 12: File System Implementation
Chapter 11: File System Implementation
Overview Continuation from Monday (File system implementation)
Outline Allocation Free space management Memory mapped files
Overview: File system implementation (cont)
File-System Structure
File System Implementation
Chapter 14: File System Implementation
The File Manager Implementation issues
Presentation transcript:

Chapter 11 – File-System Implementation (Pgs )

File System Structure  Files are predominantly stored on Disks 1. Can be rewritten in place 2. All blocks directly accessible (c.f., CD)  But really... A. Persistence B. Accessibility C. Writeability D. Access time

Layered Systems Application(s) Files, Directories: File System OS – File Manager Device Driver, Interrupt Handlers Device + Hardware

File Representation  FCB: File Control Block – the OS representation of a file  Same as PCB representation of a process  Inode – FCB in Unix

Disk Organisation  Boot control block: typically block 1, sector 1, track 1, platter 1 – boot information  Volume control block: superblock – partition details (block size, number of blocks, blocks free, location of free block list)  Directory structure: Root directory "\" in a known location  FCBs: Inodes/Data for each actual file  Data blocks: Contents of the files

OS Data  Mount table – what partitions are mounted?  Directory cache  Open file table (system wide)  Per-Process open file table  IO Buffers Aside: Many OS/FS treat a directory as another kind of file

Disks  Are divided into sections called partitions or volumes  Partitions may contain a file system ("cooked") or store "raw" data directly  E.g., page swap partition has no file system  Boot sector typically stores the boot loader  The boot loader accesses the root partition (of OS selected) which contains the OS and its root (always mounted) file system  Other partitions are mounted as required

Logical File System  Model of File System managed by OS and visible to programs/programmers  Example: Linux Components  inode: an individual file  FILE: an open file  superblock: a file system  dentry: a directory entry  Directories: May be implemented as:  Lists: Sorted, Unsorted, B-Tree  Hash Tables

Contiguous Allocation  Disk blocks are linearly ordered  Files occupy continuous sets of blocks  Problem occurs when files are deleted, shortened, or moved creating spaces on the disk  Exactly the same issue as fitting a process into memory (best fit, first fit, etc.)  Compaction removes spaces, but creates extra work  Generally a bad idea for general purpose file systems, but may be useful for specialised OSs

Linked Allocation  Files are assigned a (potentially scattered) set of available disk blocks  A tiny portion of each block is used to store a pointer (address) of the next block  Need a second pointer to support "rewind" in a file  Slow file access because a block must be read, and then the pointer used to schedule the next read

Indexed Allocation  Use the first block to store a list (an "index") of all the blocks used  Index may waste space, but data blocks do not need pointers  Multi-level or linked approaches can be used for large files that need more than one index block  Access is faster than linked allocation, but still requires reads from many different disk locations  Indices can be cached in memory to improve performance

Free-Space Management  Generally need to know if a disk block is being used or is available  Could use a bitmap stored on the disk, with one bit per block  1 TeraB disk (with 4K blocks) requires 32 MegaB bitmap  Relatively fast and simple

Other Approaches  Linked list of free blocks  Can use the empty blocks to store the pointers to the next empty block  Very space efficient -- Only need to store one pointer to the first empty block  Very simple, but time consuming to allocate large numbers of blocks  Can "group" the pointers into a single block for efficiency, and have the last pointer on the block point to the next group of empty blocks

Compression  In run-length compression, we store a value, followed by the number of occurrences of that value – saves lots of space if long "runs" exist  We can compress the free space map by storing pairs of values: A free block, and the number of consecutive free blocks that follow it  This compressed version has as many entries as there are memory holes

Efficiency and Performance  We generally desire a file system to be as small and fast as possible  However, what works best is often a factor of how it will be used and factors such as:  Disk size  Other physical properties (heads, platters, etc.)  Average file size  Read:Write ratio  Number of IO buffers  Amount of RAM available for caching tables & indices, use of cache for disk blocks as well as pages (Unified Virtual Memory)  Synchronous vs. Asynchronous access requirements  Viability of "Read-Ahead"  Redundancy requirements

Recovery  Lost data in RAM (except newly generated data not saved on disk) is usually recoverable in the event of errors, bugs, power-failures, etc. – reload it from disk  Disk data must be better protected so that errors and failures can be recovered from

Causes  Memory contents lost (power failure, crash) before disk can be updated... particularly with cached index or free space tables  Disk block failure (hardware fault)  Write failure (power loss, system crash)  Bugs in the OS, corruption of FS by applications

Consistency Checking  fsck (unix) and chkdsk (windows) checks all the tables and structures on a disk for consistency.  I.e., does the free space + used space indicated by directories = all the available space?  Can be run at mount, at boot, via chron, etc.  Can be supplemented with change flags stored on disk, access/update timestamps, etc.

Journalled (logged) FS  All disk transactions are written first to a log  Log may be stored on a different disk for redundancy  Log tends to store a considerable amount of data for a non-trivial time period  If inconsistency is found, each log entry is checked to see if it was performed  Of course, if the log is corrupted, then we are still in trouble  Uses database transaction techniques

Duplication Techniques  Modems split their EPROM in half and duplicate things so there are two copies  If one is corrupted, the other is used  Can use similar approaches with disks, but is very wasteful of space  Can also do limited duplication and avoid overwriting data until the disk is full  Complete duplication to another disk is the only possible backup in the event of a hardware failure that renders the disk inoperable

NFS  The location of a file system shouldn't really matter to the user (except that non-local data may take longer to access)  Various different protocols are available  File storage in the "Cloud" is really just a trendy term for a networked file system on a WAN (usually the Internet)

Networked File Systems  Require:  Mount Protocol  Access Protocol (for specific FS items)  Naming Protocol – to allow local vs. non-local paths to be mapped  Possible format changes to facilitate local hardware and OS needs – but this is often seen as an application-level concern

To Do:  Finish Assignment 2 (Due next week)  Complete Lab 6 (last required lab)  Read Chapter 11 (pgs ; this lecture)