Lecture Topics: 11/22 HW 7 File systems –block allocation Unix and NT –disk scheduling –file caches –RAID.

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

Chapter 4 : File Systems What is a file system?
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Disks and RAID.
File Systems.
File Management Lecture 3.
File Systems Examples.
COS 318: Operating Systems File Layout and Directories
1 Advanced Database Technology February 12, 2004 DATA STORAGE (Lecture based on [GUW ], [Sanders03, ], and [MaheshwariZeh03, ])
1 Storing Data: Disks and Files Yanlei Diao UMass Amherst Feb 15, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
Lecture 17 I/O Optimization. Disk Organization Tracks: concentric rings around disk surface Sectors: arc of track, minimum unit of transfer Cylinder:
File System Implementation
File System Implementation CSCI 444/544 Operating Systems Fall 2008.
1 Storage Hierarchy Cache Main Memory Virtual Memory File System Tertiary Storage Programs DBMS Capacity & Cost Secondary Storage.
Cse Feb-001 CSE 451 Section February 24, 2000 Project 3 – VM.
1 Outline File Systems Implementation How disks work How to organize data (files) on disks Data structures Placement of files on disk.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
Secondary Storage CSCI 444/544 Operating Systems Fall 2008.
CPSC 231 Secondary storage (D.H.)1 Learning Objectives Understanding disk organization. Sectors, clusters and extents. Fragmentation. Disk access time.
Secondary Storage Management Hank Levy. 8/7/20152 Secondary Storage • Secondary Storage is usually: –anything outside of “primary memory” –storage that.
File Systems. Main Points File layout Directory layout.
Introduction to Database Systems 1 The Storage Hierarchy and Magnetic Disks Storage Technology: Topic 1.
CS 346 – Chapter 10 Mass storage –Advantages? –Disk features –Disk scheduling –Disk formatting –Managing swap space –RAID.
1 Recitation 8 Disk & File System. 2 Disk Scheduling Disks are at least four orders of magnitude slower than main memory –The performance of disk I/O.
1 File System Implementation Operating Systems Hebrew University Spring 2010.
File Systems (1). Readings r Silbershatz et al: 10.1,10.2,
COSC 3407: Operating Systems Lecture 18: Disk Management and File System.
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.
Topic: Disks – file system devices. Rotational Media Sector Track Cylinder Head Platter Arm Access time = seek time + rotational delay + transfer time.
1 File Systems Chapter Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
Disks and Storage Systems
1Fall 2008, Chapter 12 Disk Hardware Arm can move in and out Read / write head can access a ring of data as the disk rotates Disk consists of one or more.
Disks Chapter 5 Thursday, April 5, Today’s Schedule Input/Output – Disks (Chapter 5.4)  Magnetic vs. Optical Disks  RAID levels and functions.
OSes: 11. FS Impl. 1 Operating Systems v Objectives –discuss file storage and access on secondary storage (a hard disk) Certificate Program in Software.
CSCI-375 Operating Systems Lecture Note: Many slides and/or pictures in the following are adapted from: slides ©2005 Silberschatz, Galvin, and Gagne Some.
CS 153 Design of Operating Systems Spring 2015 Lecture 22: File system optimizations.
CS 153 Design of Operating Systems Spring 2015 Lecture 21: File Systems.
Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.
12/18/20151 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam.
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.
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.
CS 3204 Operating Systems Godmar Back Lecture 21.
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.
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]
Lecture Topics: 12/1 File System Implementation –Space allocation –Free Space –Directory implementation –Caching Disk Scheduling File System/Disk Interaction.
File Systems.  Issues for OS  Organize files  Directories structure  File types based on different accesses  Sequential, indexed sequential, indexed.
CPSC 231 Secondary storage (D.H.)1 Learning Objectives Understanding disk organization. Sectors, clusters and extents. Fragmentation. Disk access time.
W4118 Operating Systems Instructor: Junfeng Yang.
CS422 Principles of Database Systems Disk Access Chengyu Sun California State University, Los Angeles.
FileSystems.
File System Structure How do I organize a disk into a file system?
CS703 - Advanced Operating Systems
Filesystems.
Lecture 45 Syed Mansoor Sarwar
EECE.4810/EECE.5730 Operating Systems
Chapter 11: File System Implementation
File Systems Implementation
UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department
CS510 Operating System Foundations
Introduction to Operating Systems
Secondary Storage Management Brian Bershad
File System Implementation
Chapter 14: File-System Implementation
Secondary Storage Management Hank Levy
SE350: Operating Systems Lecture 12: File Systems.
CS 105 “Tour of the Black Holes of Computing”
Lecture Topics: 11/20 HW 7 What happens on a memory reference Traps
Lecture 29: File Systems (cont'd)
Presentation transcript:

Lecture Topics: 11/22 HW 7 File systems –block allocation Unix and NT –disk scheduling –file caches –RAID

HW 7 Comments? What you should have learned:

HW 6 It was too easy (graded out of extra credit) –mean 75 –median 80

Anatomy of a Magnetic Disk spindle platters arm read/write heads tracks sectors cylinder: all tracks at the same radius, two per platter

File System Overview A disk block (aka cluster) is a fixed-size contiguous group of disk sectors You can imagine a file is simply a sequence of disk blocks –may not be contiguous A directory is just a file that points to other files (or directories) File system issues –how many sectors per block? –how do you keep track of which blocks a file is using? –how do you keep track of which blocks are free? –most files are small, but most I/O is to big files. Must optimize both

Sectors per Block What if there are many sectors per block –a file might fit in a single block (faster access) –internal fragmentation (FAT16 b/c can only have 64K blocks) What if there is only one sector per block –increases access time because files are spread over multiple blocks

Contiguous Allocation Allocating a file in contiguous blocks (e.g. blocks on the same track) makes accessing it fast, why? Random access is easy What does the directory need to store? Pain to make files bigger. Often, must copy whole files.

Linked Allocation Each block contains a pointer to the next block in the file (the last block is NULL) What does the directory need to store? Advantages –easy to grow files Disadvantages –poor random access –pay seek penalty many times

Indexed Allocation An array lists where each block of the file is stored Try to allocate blocks contiguously But can allocate a blocks anywhere Where is this array list stored? Is the array fixed size?

Unix Inodes In Unix this list of blocks is stored in an inode –for each file a directory stores an the file name and a inode Some entries point directly to a file block –these are sufficient for small files (up to 1KB) Some entries point to a list of block entries –these are sufficient for medium sized files (up to 256KB) Some entries point to lists of lists of block entries –these are sufficient for large files (up to 64MB) Some entries point to lists of lists of lists of block entries –these are sufficient for humongous files (up to 16GB) Advantages –number of pointers grows dynamically –can have sparse files

Inode Example other file information direct blocks singly indirect doubly indirect triply-indirect data

NTFS The MFT (master file table) stores information about each file This is stored at a well known location so you can always find it Each entry is 1KB and stores –name, attribute, security info, data –a small file’s data fits in the MFT entry (don’t even need to allocate another block) –or data can be list of block ranges (similar to inodes) A directory in NT is like any other file –it stores the MFT numbers of the files (or subdirectories) in that directory The root directory of a volume is stored at a fixed location in the MTF so you always know where to start

Free Space How do you find free disk blocks? Bitmap: One long string of bits represents the disk, one bit per block –Unix and NT Linked list: each free block points to the next one (slow!) Grouping: list free blocks in the first free block Counting: keep a list of streaks of free blocks and their lengths

Making Disks Faster If a program reads one byte from a file and does some processing, then reads the next byte from a file and does some processing? What if a program writes results to a file in the same way Ways to make disks faster –minimize seeks –caching

Disk Layout Prevent fragmentation –allocate files to contiguous blocks Put directories and their files (and the files' inodes) near each other –improves locality, don’t have to seek far Put commonly used directories in center track Thanksgiving directory on same track as Thanksgiving files

Disk Scheduling The disk has requests to read tracks –0, 10, 4, 7 (0 is on the outside) If the disk head is at track 1, how should we order these reads to minimize how far the disk head moves?

Disk Scheduling Evaluate these scheduling algorithms FIFO--First In First Out –what's the problem? SSTF--Shortest Seek Time First –pick the request closest to the disk head –what's the problem SCAN –also known as an elevator algorithm –take the closest request in the direction of travel –head moves back and forth from the center to the edge, to the center, to the edge… –does this solve SSTF's problem?

Disk Buffers Most files are read sequentially When one block is read, the disk reads the blocks that follow it because they will likely be read too These blocks are stored in a memory buffer on the disk Reads to the next blocks don’t have to pay seek and rotational delay

File Caches File accesses exhibit locality just like everything else Therefore cache frequently-used file blocks in main memory –modern file systems wouldn't work without this File cache should be write-through not write- back? Why? It's a little ironic that we use memory to store frequently-used disk blocks and disk to store infrequently used memory pages

File Cache A portion of memory is devoted to storing frequently used files The amount of memory changes based on the workload –if more files are being accessed then use more memory Virtual pages that are evicted from physical memory often go to the file cache before the page file –gives a virtual page a second chance –doesn't require a copy because file cache can be stored anywhere in memory Memory Virtual memory pages File cache Frequently used file blocks

A Case for RAID If CPU and memory speeds increase But IO does not improve at the same rate All IO applications will become IO bound How do we fix this?

1984 Disk Comparison SLED (Single Large Expensive Magnetic Disk) IBM 3380 –14” diameter –24 cubic feet –7.5 GB –200 IO’s per second –3 MB/sec transfer rate Conners CP3100 –3.5” diameter –.03 cubic feet –100 MB –.2 IO’s per second –.3 MB/sec transfer rate

2000 Disk Comparison Today there are no longer two sets of disks (expensive and inexpensive) –there are also no longer two sets of CPUs How do we make these small inexpensive disks fast and reliable?

AID Array of Inexpensive Disks –use a lot of small inexpensive disks instead of one big expensive disk Advantages –lower cost –improved data rate (pieces of a file on multiple disks) –improved IO rate (increase xput by how many disks you have) Disadvantages –reliability is terrible Mean Time to Failure changes from 4 years to 2 weeks

RAID Redundant Array of Inexpensive Disks Use extra disks to improve reliability –data disks –check disks (parity) Can provide any level of reliability But we still want –efficient disk usage –good performance RAID1 – RAID5

RAID4 Use one disk to store the parity of the the other disks –parity bit is 1 if the sum of the other bits is odd –parity bit is 0 if the sum of the other bits is even –allows you to determine if any single bit is wrong –can recreate a disk if one disk fails by using the parity disk –Example, Disk3 crashes, what was stored there? Disk0Disk1Disk2 Disk3 Disk4Parity Disk 101 ? 01

RAID6 Continued Striping a file with 16 blocks across 5 disks + 1 parity disk P P P P Disk 0Disk 1Disk 2Disk 3Disk 4Parity Disk Can read file in ¼ of the time