EECE.4810/EECE.5730 Operating Systems

Slides:



Advertisements
Similar presentations
Overview of Mass Storage Structure
Advertisements

Operating Systems Disk Scheduling A. Frank - P. Weisberg.
CS 6560: Operating Systems Design
Disk Scheduling Based on the slides supporting the text 1.
1 File Systems Chapter Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 12: Mass-Storage Systems.
Based on the slides supporting the text
Disks.
1 Disk Scheduling Chapter 14 Based on the slides supporting the text.
Disks CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Secondary Storage CSCI 444/544 Operating Systems Fall 2008.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Mass-Storage Systems Revised Tao Yang.
Storage Systems. Main Points File systems – Useful abstractions on top of physical devices Storage hardware characteristics – Disks and flash memory File.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 12: Mass-Storage Systems.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 12: Mass-Storage Systems.
12.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 12: Mass-Storage Systems.
Disk and I/O Management
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 14: Mass-Storage Systems Disk Structure Disk Scheduling Disk Management Swap-Space.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 10: Mass-Storage Systems.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 12: Mass-Storage Systems.
Disk Structure Disk drives are addressed as large one- dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13+14: I/O Systems and Mass- Storage Structure I/O Hardware Application I/O.
Chapter 12: Mass-Storage Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 12: Mass-Storage Systems Overview of Mass.
Chapter 12: Mass-Storage Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 12: Mass-Storage.
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.
CS 6502 Operating Systems Dr. J.. Garrido Device Management (Lecture 7b) CS5002 Operating Systems Dr. Jose M. Garrido.
CE Operating Systems Lecture 20 Disk I/O. Overview of lecture In this lecture we will look at: Disk Structure Disk Scheduling Disk Management Swap-Space.
I/O Management and Disk Structure Introduction to Operating Systems: Module 14.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 14: Mass-Storage Systems Disk Structure Disk Scheduling Disk Management Swap-Space.
Operating Systems (CS 340 D) Princess Nora University Faculty of Computer & Information Systems Computer science Department.
1.  Disk Structure Disk Structure  Disk Scheduling Disk Scheduling  FCFS FCFS  SSTF SSTF  SCAN SCAN  C-SCAN C-SCAN  C-LOOK C-LOOK  Selecting a.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 13 Mass-Storage Systems Slide 1 Chapter 13 Mass-Storage Systems.
Chapter 14: Mass-Storage Systems Disk Structure. Disk Scheduling. RAID.
1 Chapter 13 Mass-Storage Structure. 2 Disk Structure Disk drives are addressed as large 1- dimensional arrays of logical blocks, where the logical block.
M ASS S TORAGE S TRUCTURES Lecture: Operating System Concepts Lecturer: Pooja Sharma Computer Science Department, Punjabi University, Patiala.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Chapter 9: Mass-Storage Systems.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 10: Mass-Storage Systems.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 11: File System Implementation.
Mass Storage Structure
Unit V part 2.
Chapter 10: Mass-Storage Systems
Operating System (013022) Dr. H. Iwidat
Introduction to Operating Systems
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
Chapter 12: Mass-Storage Structure
Operating System I/O System Monday, August 11, 2008.
Disk Scheduling Algorithms
Mass-Storage Structure
DISK SCHEDULING FCFS SSTF SCAN/ELEVATOR C-SCAN C-LOOK.
Lecture 45 Syed Mansoor Sarwar
Chapter 10: Mass-Storage Systems
Chapter 14 Based on the slides supporting the text
Chapter 12: Mass-Storage Systems
Operating Systems (CS 340 D)
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
EECE.4810/EECE.5730 Operating Systems
Overview Continuation from Monday (File system implementation)
Disks and scheduling algorithms
Secondary Storage Management Brian Bershad
Mass-Storage Systems.
CSE 451: Operating Systems Secondary Storage
Lecture 11: Flash Memory and File System Abstraction
Chapter 12: Mass-Storage Structure
Secondary Storage Management Hank Levy
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
Lecture 10: Magnetic Disks
Mass-Storage Systems (Disk Scheduling)
Introduction to Operating Systems
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
Introduction to Operating Systems
Presentation transcript:

EECE.4810/EECE.5730 Operating Systems Instructor: Dr. Michael Geiger Spring 2017 Lecture 14: File systems and mass storage

Operating Systems: Lecture 14 Lecture outline Announcements/reminders Project 1 coming … … and there probably won’t be a Project 2 … … since, at this point, you don’t have Project 1 ... Today’s lecture File system intro Mass storage structures File system details 11/30/2018 Operating Systems: Lecture 14

Operating Systems: Lecture 14 I/O and file systems OS-provided abstractions for storage Heterogeneous devices treated as uniform Few storage media (disks) used for many storage objects (files) Simple naming mapped to rich naming HW: numeric; SW: symbolic HW: flat space; SW: structured Provides flexible block assignment (Appearance of) Fast access Consistency even with crashes Provided via device drivers Processes used to interface with hardware For applications, interface looks same HW-specific details hidden inside drivers 11/30/2018 Operating Systems: Lecture 14

Storage Devices Magnetic disks Solid state disks Flash memory Storage that rarely becomes corrupted Large capacity at low cost Block level random access (but slow) Better performance for streaming access Solid state disks Non-volatile memory used like hard drive More reliable, faster than magnetic disks More expensive, shorter life span than magnetic disks Much faster—sometimes too fast for busses! Flash memory Capacity at intermediate cost (50x disk) Block level random access Good performance for reads; worse for random writes

Magnetic Disk Mentioned that disk and flash device has a CPU in it – it needs it for the complex reasoning it needs to make; e.g., disk head scheduling is now done by the disk device itself, as is remapping. Disks in very olden times very smart – because the CPU was insanely expensive. When CPU’s were moderately expensive, then I/O devices became dumb – so that you could build a cheaper overall system, the file system had to do more work. Now, the CPU is very cheap, so can include more intelligence on the device.

Head and track are not to scale – head is actually much much bigger than a track. Track ~ 1 micron wide Wavelength of light is ~ 0.5 micron Resolution of human eye: 50 microns Outer edge of disk is travelling at 30 mph, with the head riding on top of the disk surface with a cushion of a few atoms

Disk Tracks ~ 1 micron wide Separated by unused guard regions Wavelength of light is ~ 0.5 micron Resolution of human eye: 50 microns 100K tracks on a typical 2.5” disk Separated by unused guard regions Reduces likelihood neighboring tracks are corrupted during writes (still a small non-zero chance) Track length varies across disk Outside: More sectors per track, higher bandwidth Disk is organized into regions of tracks with same # of sectors/track Only outer half of radius is used Most of the disk area in the outer regions of the disk

Disk Performance Disk Latency = Seek Time + Rotation Time + Transfer Time Seek Time: time to move disk arm over track (1-20ms) Fine-grained position adjustment necessary for head to “settle” Head switch time ~ track switch time (on modern disks) Rotation Time: time to wait for disk to rotate under disk head Disk rotation: 4 – 15ms (depending on price of disk) On average, only need to wait half a rotation Transfer Time: time to transfer data onto/off of disk Disk head transfer rate: 50-100MB/s (5-10 usec/sector) Host transfer rate dependent on I/O connector (USB, SATA, …)

Disk Structure Disk drives are addressed as large 1-dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer Low-level formatting creates logical blocks on physical media The 1-dimensional array of logical blocks is mapped into the sectors of the disk sequentially Sector 0 is the first sector of the first track on the outermost cylinder Mapping proceeds in order through that track, then the rest of the tracks in that cylinder, and then through the rest of the cylinders from outermost to innermost Logical to physical address should be easy Except for bad sectors Non-constant # of sectors per track via constant angular velocity

Disk Scheduling Disks are slow, so to increase perfomance Avoid doing I/O Reduce overhead Amortize overhead over larger request Can reduce overhead through disk scheduling Only necessary if multiple requests Scheduling metrics First-come, first-served (FCFS) Shortest seek time first (SSTF) SCAN / C-SCAN LOOK / C-LOOK

Illustration shows total head movement of 640 cylinders FCFS Illustration shows total head movement of 640 cylinders

SSTF Shortest Seek Time First selects the request with the minimum seek time from the current head position SSTF scheduling is a form of SJF scheduling; may cause starvation of some requests Illustration shows total head movement of 236 cylinders Downsides? What if cluster of requests at far side of disk?

SCAN SCAN: move disk arm in one direction, until all requests satisfied, then reverse direction Also called “elevator scheduling”

SCAN (cont.) Illustration shows total head movement of 208 cylinders But note that if requests are uniformly dense, largest density at other end of disk and those wait the longest

C-SCAN C-SCAN: move disk arm in one direction, until all requests satisfied, then start again from farthest request More uniform wait time than SCAN

C-LOOK LOOK a version of SCAN, C-LOOK a version of C-SCAN Arm only goes as far as the last request in each direction, then reverses direction immediately, without first going all the way to the end of the disk

C-LOOK (Cont.)

Selecting a Disk-Scheduling Algorithm SSTF is common and has a natural appeal SCAN and C-SCAN perform better for systems that place a heavy load on the disk Less starvation Requests for disk service can be influenced by the file-allocation method And metadata layout The disk-scheduling algorithm should be written as a separate module of the operating system, allowing it to be replaced with a different algorithm if necessary Either SSTF or LOOK is a reasonable choice for the default algorithm What about scheduling on SSD? FCFS—no seek time, rotational latency to worry about Can improve performance by merging adjacent writes

Disk Management Low-level formatting, or physical formatting — Dividing a disk into sectors that the disk controller can read and write Each sector can hold header information, plus data, plus error correction code (ECC) Usually 512 bytes of data but can be selectable To use a disk to hold files, the operating system still needs to record its own data structures on the disk Partition the disk into one or more groups of cylinders, each treated as a logical disk Logical formatting or “making a file system” To increase efficiency most file systems group blocks into clusters Disk I/O done in blocks File I/O done in clusters

Disk Management (Cont.) Boot block initializes system The bootstrap is stored in ROM Bootstrap loader program stored in boot blocks of boot partition

Booting from a Disk in Windows

File System Abstraction File system: data structure stored on persistent medium Persistent, named data Hierarchical organization (directories, subdirectories) Access control on data File: named collection of data Linear sequence of bytes (or a set of sequences) Read/write or memory mapped Crash and storage error tolerance Operating system crashes (and disk errors) leave file system in a valid state Performance Achieve close to the hardware limit in the average case

File System Workload How are files used? Most files are read/written sequentially Some files are read/written randomly Ex: database files, swap files Some files have a pre-defined size at creation Some files start small and grow over time Ex: program stdout, system logs

File System Design For small files: For large files: Small blocks for storage efficiency Concurrent ops more efficient than sequential Files used together should be stored together For large files: Storage efficient (large blocks) Contiguous allocation for sequential access Efficient lookup for random access May not know at file creation Whether file will become small or large Whether file is persistent or temporary Whether file will be used sequentially or randomly

File System Abstraction Directory Group of named files or subdirectories Mapping from file name to file metadata location Path String that uniquely identifies file or directory Ex: /cse/www/education/courses/cse451/12au Links Hard link: link from name to metadata location Soft link: link from name to alternate name Mount Mapping from name in one file system to root of another

File System Interface UNIX file open is a Swiss Army knife: Open the file, return file descriptor Options: if file doesn’t exist, return an error If file doesn’t exist, create file and open it If file does exist, return an error If file does exist, open file If file exists but isn’t empty, nix it then open If file exists but isn’t empty, return an error …

Operating Systems: Lecture 14 Final notes Next time: Continue with file systems 11/30/2018 Operating Systems: Lecture 14

Operating Systems: Lecture 14 Acknowledgements These slides are adapted from the following sources: Silberschatz, Galvin, & Gagne, Operating Systems Concepts, 9th edition Anderson & Dahlin, Operating Systems: Principles and Practice, 2nd edition Chen & Madhyastha, EECS 482 lecture notes, University of Michigan, Fall 2016 11/30/2018 Operating Systems: Lecture 14