CS 333 Introduction to Operating Systems Class 16 – Secondary Storage Management Jonathan Walpole Computer Science Portland State University.

Slides:



Advertisements
Similar presentations
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Advertisements

Disks Disk Hardware (1) Disk parameters for the original IBM PC floppy disk and a Western Digital WD hard disk.
Chapter 5 Input/Output 5.4 Disks
Mass-Storage Structure
- Dr. Kalpakis CMSC Dr. Kalpakis 1 Outline In implementing DBMS we need to answer How should the system store and manage very large amounts of data?
CS 6560: Operating Systems Design
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Disks and RAID.
1 Pertemuan 19 Disk Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5 OFFCLASS03.
RAID and Other Disk Details
Other Disk Details. 2 Disk Formatting After manufacturing disk has no information –Is stack of platters coated with magnetizable metal oxide Before use,
CS 333 Introduction to Operating Systems Class 16 – Secondary Storage Management Jonathan Walpole Computer Science Portland State University.
Lecture 17 I/O Optimization. Disk Organization Tracks: concentric rings around disk surface Sectors: arc of track, minimum unit of transfer Cylinder:
1 Chapter 6 Storage and Multimedia: The Facts and More.
Disk Drivers May 10, 2000 Instructor: Gary Kimura.
Based on the slides supporting the text
Fig 5-5 Interrupts Handling
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output – 5 Disks CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent.
Disks.
12: IO Systems1 I/O SYSTEMS This Chapter is About Processor I/O Interfaces: Connections exist between processors, memory, and IO devices. The OS must manage.
Jonathan Walpole Computer Science Portland State University
Disks CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Avishai Wool lecture Introduction to Systems Programming Lecture 9 Input-Output Devices.
Secondary Storage CSCI 444/544 Operating Systems Fall 2008.
1 Input/Output Chapter 3 TOPICS Principles of I/O hardware Principles of I/O software I/O software layers Disks Clocks Reference: Operating Systems Design.
Secondary Storage Management Hank Levy. 8/7/20152 Secondary Storage • Secondary Storage is usually: –anything outside of “primary memory” –storage that.
Operating Systems COMP 4850/CISG 5550 Disks, Part II Dr. James Money.
12.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 12: Mass-Storage Systems.
CS4432: Database Systems II Data Storage (Better Block Organization) 1.
CS 346 – Chapter 10 Mass storage –Advantages? –Disk features –Disk scheduling –Disk formatting –Managing swap space –RAID.
CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Storage Systems.
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 Operating Systems Part VI: Mass- Storage Structure.
Physical Storage and File Organization COMSATS INSTITUTE OF INFORMATION TECHNOLOGY, VEHARI.
I/O – Chapter 8 Introduction Disk Storage and Dependability – 8.2 Buses and other connectors – 8.4 I/O performance measures – 8.6.
Lecture 9 of Advanced Databases Storage and File Structure (Part II) Instructor: Mr.Ahmed Al Astal.
Topic: Disks – file system devices. Rotational Media Sector Track Cylinder Head Platter Arm Access time = seek time + rotational delay + transfer time.
Disk Structure Disk drives are addressed as large one- dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer.
Sistem Operasi IKH311 Masukan Luaran (Input/Output)
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.
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.
Disks Chapter 5 Thursday, April 5, Today’s Schedule Input/Output – Disks (Chapter 5.4)  Magnetic vs. Optical Disks  RAID levels and functions.
Reliability and Recovery CS Introduction to Operating Systems.
Chapter 12 – Mass Storage Structures (Pgs )
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.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 9-2: Disk Scheduling Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 10: Mass-Storage Structure.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 9-1: Disk Scheduling Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Chapter 14: Mass-Storage
CS399 New Beginnings Jonathan Walpole. Disk Technology & Secondary Storage Management.
Part IV I/O System Chapter 12: Mass Storage Structure.
Disks. ●Circular-shaped storage medium ●Two main types: Magnetic and Optical ●Random access to memory ●The hardware must be controlled by driver software.
Magnetic Disks Have cylinders, sectors platters, tracks, heads virtual and real disk blocks (x cylinders, y heads, z sectors per track) Relatively slow,
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems DISK I/0.
Multiple Platters.
Disks and RAID.
CS 554: Advanced Database System Notes 02: Hardware
Secondary Storage Secondary storage typically: Characteristics:
Operating System I/O System Monday, August 11, 2008.
Mass-Storage Structure
Disks.
CS510 Operating System Foundations
Jonathan Walpole Computer Science Portland State University
CSE 451: Operating Systems Autumn 2003 Lecture 12 Secondary Storage
Disks and scheduling algorithms
CSE 451: Operating Systems Winter 2003 Lecture 12 Secondary Storage
CS333 Intro to Operating Systems
CSE451 File System Introduction and Disk Drivers Autumn 2002
Disks Magnetic (hard) Disk arrays are used for reliable storage (RAID)
Presentation transcript:

CS 333 Introduction to Operating Systems Class 16 – Secondary Storage Management Jonathan Walpole Computer Science Portland State University

Disk geometry  Disk head, surfaces, tracks, sectors …

Comparison of disk technology

Disk zones Constant rotation speed Want constant bit density Inner tracks: Fewer sectors per track Outer tracks: More sectors per track

Disk geometry  Physical Geometry  The actual layout of sectors on the disk may be complicated  The controller does the translation  The CPU sees a “virtual geometry”.

Disk geometry  virtual geometryphysical geometry (192 sectors in each view)

Disk formatting  A disk sector  Typically  512 bytes / sector  ECC = 16 bytes

Cylinder skew

Disk capacity  For communication...  1 Kbps = 1,000 bits per second (10 3 )  1 Mbps = 1,000,000 bits per second (10 6 )  1 Gbps = 1,000,000,000 bits per second (10 9 )  For disks and memories...  K = kilo = 2 10 = 1024  M = mega = 2 20 = 1024 * 1024 = 1,048,576  G= giga = 2 30 = = 1,073,741,824  1 GB = 2 30 bytes = 1,073,741,824 bytes

Sector interleaving  No Interleaving Single Interleaving Double Interleaving

Disk scheduling algorithms  Time required to read or write a disk block determined by 3 factors  Seek time  Rotational delay  Actual transfer time  Seek time dominates  Schedule disk heads to minimize it

Disk scheduling algorithms  First-come first serve  Shortest seek time first  Scan  back and forth to ends of disk  C-Scan  only one direction  Look  back and forth to last request  C-Look  only one direction

Shortest seek first (SSF) Initial position Pending requests

Shortest seek first (SSF)  Cuts arm motion in half  Fatal problem:  Starvation is possible!

The elevator algorithm  One bit: which direction the arm is moving  Up  Down  Keep moving in that direction  Service the next pending request in that direction  When there are no more requests in the current direction, reverse direction

The elevator algorithm 

Other disk scheduling algorithms  First-come first serve  Shortest seek time first  Scan  back and forth to ends of disk  C-Scan  only one direction  Look  back and forth to last request  C-Look  only one direction

Errors on disks  Transient errors v. hard errors  Manufacturing defects are unavoidable  Some will be masked with the ECC (error correcting code) in each sector  Dealing with bad sectors  Allocate several spare sectors per track  At the factory, some sectors are remapped to spares  Errors may occur during the disk lifetime  The sector must be remapped to a spare  By the OS  By the device controller

Using spare sectors  Substituting a new sector Shifting sectors

Handling bad sectors in the OS  Add all bad sectors to a special file  The file is hidden; not in the file system  Users will never see the bad sectors There is never an attempt to access the file  Backups  Some backup programs copy entire tracks at a time Efficient  Problem: May try to copy every sector Must be aware of bad sectors

Stable storage  The model of possible errors:  Disk writes a block  If there is an error during a write... It will probably be detected upon reading the block  Disk blocks can go bad spontaneously But subsequent reads will detect the error  CPU can fail (just stops) Disk writes in progress are detectable errors  Highly unlikely to loose the same block on two disks (on the same day)

Stable storage  Use two disks for redundancy  Each write is done twice  Each disk has N blocks.  Each disk contains exactly the same data.  To read the data...  you can read from either disk  To perform a write...  you must update the same block on both disks  If one disk goes bad...  You can recover from the other disk

Stable storage  Stable write  Write block on disk # 1  Read back to verify  If problems... Try again several times to get the block written Then declare the sector bad and remap the sector Repeat until the write to disk #1 succeeds  Write same data to corresponding block on disk #2 Read back to verify Retry until it also succeeds

Stable storage  Stable Read  Read the block from disk # 1  If problems... Try again several times to get the block  If the block can not be read from disk #1... Read the corresponding block from disk #2  Our Assumption: The same block will not simultaneously go bad on both disks

Stable storage  Crash Recovery  Scan both disks  Compare corresponding blocks  For each pair of blocks...  If both are good and have same data... Do nothing; go on to next pair of blocks  If one is bad (failed ECC)... Copy the block from the good disk  If both are good, but contain different data... (CPU must have crashed during a “Stable Write”) Copy the data from disk #1 to disk #2

Crashes during a stable write 

Stable storage  Disk blocks can spontaneously decay  Given enough time...  The same block on both disks may go bad Data could be lost!  Must scan both disks to watch for bad blocks (e.g., every day)  Many variants to improve performance  Goal: avoid scanning entire disk after a crash.  Goal: improve performance Every stable write requires: 2 writes & 2 reads Can do better...

RAID  Redundant Array of Independent Disks  Redundant Array of Inexpensive Disks  Goals:  Increased reliability  Increased performance

RAID 

CDs & CD-ROMs 

CD-ROMs  7203 bytes to encode 2048 (2K) data bytes  32x CD-ROM = 5,000,000 Bytes/Sec  SCSI-2 is twice as fast.

CD-R (CD-Recordable) 

Updating write-once media  VTOC = Volume Table of Contents  When writing, an entire track is written at once  Each track has its own VTOC

Updating write-once media  VTOC = Volume Table of Contents  When writing, an entire track is written at once.  Each track has its own VTOC.  Upon inserting a CD-R,  Find the last track  Obtain the most recent VTOC This can refer to data in earlier tracks  This tells which files are on the disk  Each VTOC supercedes the previous VTOC

Updating write-once media  VTOC = Volume Table of Contents  When writing, an entire track is written at once.  Each track has its own VTOC.  Upon inserting a CD-R,  Find the last track  Obtain the most recent VTOC This can refer to data in earlier tracks  This tells which files are on the disk  Each VTOC supercedes the previous VTOC  Deleting files?

CD-RW  Uses a special alloy  Alloy has two states, with different reflectivities  Crystalline (highly reflective) - Looks like “land”  Amorphous (low reflectivity) - Looks like a “pit”  Laser has 3 powers  Low power: Sense the state without changing it  High power: Change to amorphous state  Medium power: Change to crystalline state

DVDs  “Digital Versatile Disk”  Smaller Pits  Tighter Spiral  Laser with different frequency  Transfer speed  1X = 1.4MB/sec (about 10 times faster than CD)  Capacity  4.7 GBSingle-sided, single-layer (7 times a CD-ROM)  8.5 GBSingle-sided, double-layer  9.4 GBDouble-sided, single-layer  17 GBDouble-sided, double-layer

DVDs 0.6mm Single-sided disk 0.6mm Single-sided disk