Lecture 14 Page 1 CS 111 Online File Systems and Multiple Disks You can usually attach more than one disk to a machine – And often do Would it make sense.

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

Operating Systems File Management.
Free Space and Allocation Issues
File Systems.
Allocation Methods - Contiguous
1 Chapter 11: File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection  Chapter.
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 Management Systems
File System Implementation
Operating Systems File Systems (in a Day) Ch
File System Implementation CSCI 444/544 Operating Systems Fall 2008.
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
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.
Ceng Operating Systems
File Systems Implementation. 2 Recap What we have covered: –User-level view of FS –Storing files: contiguous, linked list, memory table, FAT, I-nodes.
File System Implementation
Secondary Storage Management Hank Levy. 8/7/20152 Secondary Storage • Secondary Storage is usually: –anything outside of “primary memory” –storage that.
The Design and Implementation of a Log-Structured File System Presented by Carl Yao.
File Systems (1). Readings r Silbershatz et al: 10.1,10.2,
File Implementation. File System Abstraction How to Organize Files on Disk Goals: –Maximize sequential performance –Easy random access to file –Easy.
Disk Access. DISK STRUCTURE Sector: Smallest unit of data transfer from/to disk; 512B 2/4/8 adjacent sectors transferred together: Blocks Read/write heads.
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.
Operating Systems Advanced OS - E. OS Advanced Evaluating an Operating System.
Distributed File Systems
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
File Systems CSCI What is a file? A file is information that is stored on disks or other external media.
UNIX File and Directory Caching How UNIX Optimizes File System Performance and Presents Data to User Processes Using a Virtual File System.
OSes: 11. FS Impl. 1 Operating Systems v Objectives –discuss file storage and access on secondary storage (a hard disk) Certificate Program in Software.
How to Build a CPU Cache COMP25212 – Lecture 2. Learning Objectives To understand: –how cache is logically structured –how cache operates CPU reads CPU.
File Storage Organization The majority of space on a device is reserved for the storage of files. When files are created and modified physical blocks are.
Free Space Management.
File System Implementation
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Module 4.0: File Systems File is a contiguous logical address space.
File Systems Security File Systems Implementation.
CS 153 Design of Operating Systems Spring 2015 Lecture 21: File Systems.
Lecture 3 Page 1 CS 111 Online Disk Drives An especially important and complex form of I/O device Still the primary method of providing stable storage.
Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File System Implementation.
Lecture 18 Windows – NT File System (NTFS)
CS333 Intro to Operating Systems Jonathan Walpole.
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.
COMP SYSTEM ARCHITECTURE HOW TO BUILD A CACHE Antoniu Pop COMP25212 – Lecture 2Jan/Feb 2015.
Lecture 14 Page 1 CS 111 Fall 2015 File Systems: Allocation Issues, Naming, and Performance CS 111 Operating Systems Peter Reiher.
File Systems Topics Design criteria History of file systems Berkeley Fast File System Effect of file systems on programs fs.ppt CS 105 “Tour of the Black.
Chapter 6 File Systems. Essential requirements 1. Store very large amount of information 2. Must survive the termination of processes persistent 3. Concurrent.
Lecture 19 Linux/Unix – File System
File Systems 2. 2 File 1 File 2 Disk Blocks File-Allocation Table (FAT)
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]
Hands-On Microsoft Windows Server 2008 Chapter 7 Configuring and Managing Data Storage.
Lecture 14 Page 1 CS 111 Online File Systems: Naming, Reliability, and Advanced Issues CS 111 On-Line MS Program Operating Systems Peter Reiher.
File System Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi Fujinoki CS 314.
Lecture 10 Page 1 CS 111 Summer 2015 File Systems: Memory Management, Naming, and Reliability CS 111 Operating System Principles Peter Reiher.
CS422 Principles of Database Systems Disk Access Chengyu Sun California State University, Los Angeles.
Lecture 13 Page 1 CS 111 Online Basics of File System Design Where do file systems fit in the OS? File control data structures.
Jonathan Walpole Computer Science Portland State University
Chapter 11: File System Implementation
Chapter 12: File System Implementation
File System Structure How do I organize a disk into a file system?
I/O Resource Management: Software
Chapter 11: File System Implementation
Overview Continuation from Monday (File system implementation)
Department of Computer Science
Chapter 14: File System Implementation
Lecture Topics: 11/20 HW 7 What happens on a memory reference Traps
Chapter 5 File Systems -Compiled for MCA, PU
Presentation transcript:

Lecture 14 Page 1 CS 111 Online File Systems and Multiple Disks You can usually attach more than one disk to a machine – And often do Would it make sense to have a single file system span the several disks? – Considering the kinds of disk specific information a file system keeps – Like cylinder information Usually more trouble than it’s worth – With the exception of RAID... Instead, put separate file system on each disk

Lecture 14 Page 2 CS 111 Online How About the Other Way Around? Multiple file systems on one disk Divide physical disk into multiple logical disks – Often implemented within disk device drivers – Rest of system sees them as separate disk drives Typical motivations – Permit multiple OS to coexist on a single disk E.g., a notebook that can boot either Windows or Linux – Separation for installation, back-up and recovery E.g., separate personal files from the installed OS file system – Separation for free-space Running out of space on one file system doesn't affect others

Lecture 14 Page 3 CS 111 Online Disk Partitioning Mechanisms Some are designed for use by a single OS – E.g., Unix slices (one file system per slice) Some are designed to support multiple OS – E.g., DOS FDISK partitions, and VM/370 mini-disks Important features for supporting multiple OS's – Must be possible to boot from any partition – Must be possible to keep OS A out of OS B's partition There may be hierarchical partitioning – E.g., multiple UNIX slices within an FDISK partition

Lecture 14 Page 4 CS 111 Online Example: FDISK Disk Partitioning Disk bootstrap program Physical sector 0 (Master Boot Record) 149:7:63 99:7:63 199:7:63 100:1:00 00:01:00 150:1:00 DOS linux Solaris endstarttypeA FDISK partition table linux partition DOS partition Solaris partition PBR Note that the first sector of each logical partition also contains a Partition Boot Record, which will be used to boot the operating system for that partition. 99:7:6300:01:00 149:7:63100:1:00 199:7:63150:1:00

Lecture 14 Page 5 CS 111 Online Master Boot Records and Partition Boot Records Given the Master Boot Record bootstrap, why another Partition Boot Record bootstrap per partition? The bootstrap in the MBR typically only gives the user the option of choosing a partition to boot from – And then loads the boot block from the selected (or default) partition The PBR bootstrap in the selected partition knows how to traverse the file system in that partition – And how to interpret the load modules stored in it

Lecture 14 Page 6 CS 111 Online Working With Multiple File Systems So you might have multiple independent file systems on one machine – Each handling its own disk layout, free space, and other organizational issues How will the overall system work with those several file systems? Treat them as totally independent namespaces? Or somehow stitch the separate namespaces together? Key questions: 1.How does an application specify which file it wants? 2.How does the OS find that file?

Lecture 14 Page 7 CS 111 Online Finding Files With Multiple File Systems Finding files is easy if there is only one file system – Any file we want must be on that one file system – Directories enable us to name files within a file system What if there are multiple file systems available? – Somehow, we have to say which one our file is on How do we specify which file system to use? – One way or another, it must be part of the file name – It may be implicit (e.g., same as current directory) – Or explicit (e.g., every name specifies it) – Regardless, we need some way of specifying which file system to look into for a given file name

Lecture 14 Page 8 CS 111 Online Options for Naming With Multiple Partitions Could specify the physical device it resides on – E.g., /devices/pci/pci1000,4/disk/lun1/partition2 that would get old real quick Could assign logical names to our partitions – E.g., “A:”, “C:”, “D:” You only have to think physical when you set them up But you still have to be aware multiple volumes exist Could weave a multi-file-system name space – E.g., Unix mounts

Lecture 14 Page 9 CS 111 Online Unix File System Mounts Goal: – To make many file systems appear to be one giant one – Users need not be aware of file system boundaries Mechanism: – Mount device on directory – Creates a warp from the named directory to the top of the file system on the specified device – Any file name beneath that directory is interpreted relative to the root of the mounted file system

Lecture 14 Page 10 CS 111 Online Unix Mounted File System Example file system 4 file system 2file system 3 root file system /bin /opt/export user1 user2 mount filesystem2 on /export/user1 mount filesystem3 on /export/user2 mount filesystem4 on /opt

Lecture 14 Page 11 CS 111 Online How Does This Actually Work? Mark the directory that was mounted on When file system opens that directory, don’t treat it as an ordinary directory – Instead, consult a table of mounts to figure out where the root of the new file system is Go to that device and open its root directory And proceed from there

Lecture 14 Page 12 CS 111 Online What Happened To the Real Directory? You can mount on top of any directory – Not just in some special places in the file hierarchy – Not even just empty directories Did the mount wipe out the contents of the directory mounted on? No, it just hid them – Since traversals jump to a new file system, rather than reading the directory contents It’s all still there when you unmount

Lecture 14 Page 13 CS 111 Online File System Performance Issues Key factors in file system performance – Head motion – Block size Possible optimizations for file systems – Read-ahead – Delayed writes – Caching (general and special purpose)

Lecture 14 Page 14 CS 111 Online Head Motion and File System Performance File system organization affects head motion – If blocks in a single file are spread across the disk – If files are spread randomly across the disk – If files and “meta-data” are widely separated All files are not used equally often – 5% of the files account for 90% of disk accesses – File locality should translate into head cylinder locality How do we use these factors to reduce head motion?

Lecture 14 Page 15 CS 111 Online Ways To Reduce Head Motion Keep blocks of a file together – Easiest to do on original write – Try to allocate each new block close to the last one – Especially keep them in the same cylinder Keep metadata close to files – Again, easiest to do at creation time Keep files in the same directory close together – On the assumption directory implies locality of reference If performing compaction, move popular files close together How about dynamically migrating files around to make files that are used together are also stored together? What would we need to do to make that work? Should we do it?

Lecture 14 Page 16 CS 111 Online File System Performance and Block Size Larger block sizes result in efficient transfers – DMA is very fast, once it gets started – Per request set-up and head-motion is substantial They also result in internal fragmentation – Expected waste: ½ block per file As disks get larger, speed outweighs wasted space – File systems support ever-larger block sizes Clever schemes can reduce fragmentation – E.g., use smaller block size for the last block of a file

Lecture 14 Page 17 CS 111 Online Read Early, Write Late If we read blocks before we actually need them, we don’t have to wait for them – But how can we know which blocks to read early? If we write blocks long after we told the application it was done, we don’t have to wait – But are there bad consequences of delaying those writes? Some optimizations depend on good answers to these questions

Lecture 14 Page 18 CS 111 Online Read-Ahead Request blocks from the disk before any process asked for them Reduces process wait time When does it make sense? – When client specifically requests sequential access – When client seems to be reading sequentially What are the risks? – May waste disk access time reading unwanted blocks – May waste buffer space on unneeded blocks

Lecture 14 Page 19 CS 111 Online Delayed Writes Don’t wait for disk write to complete to tell application it can proceed Written block is in a buffer in memory Wait until it’s “convenient” to write it to disk – Handle reads from in-memory buffer Benefits: – Applications don’t wait for disk writes – Writes to disk can be optimally ordered – If file is deleted soon, may never need to perform disk I/O Potential problems: – Lost writes when system crashes – Buffers holding delayed writes can’t be re-used

Lecture 14 Page 20 CS 111 Online Caching and Performance Big performance wins are possible if caches work well – They typically contain the block you’re looking for Should we have one big LRU cache for all purposes? Should we have some special-purpose caches? – If so, is LRU right for them?

Lecture 14 Page 21 CS 111 Online Common Types of Disk Caching General block caching – Popular files that are read frequently – Files that are written and then promptly re-read – Provides buffers for read-ahead and deferred write Special purpose caches – Directory caches speed up searches of same dirs – Inode caches speed up re-uses of same file Special purpose caches are more complex – But they often work much better

Lecture 14 Page 22 CS 111 Online Performance Gain For Different Types of Caches General Block Cache Special Purpose Cache Cache size (bytes) Performance

Lecture 14 Page 23 CS 111 Online Why Are Special Purpose Caches More Effective? They match caching granularity to their need – E.g., cache inodes or directory entries – Rather than full blocks Why does that help? Consider an example: – A block might contain 100 directory entries, only four of which are regularly used – Caching the other 96 as part of the block is a waste of cache space – Caching 4 entries allows more popular entries to be cached – Tending to lead to higher hit ratios Why is there a knee in the special purpose cache curve?