Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Similar documents
Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Chapter 12: Mass-Storage Systems. Operating System Concepts 8 th Edition,

CS420: Operating Systems. Mass Storage Structure

EIDE, ATA, SATA, USB,

Chapter 12: Secondary-Storage Structure. Operating System Concepts 8 th Edition,

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

Free Space Management

Chapter 10: Mass-Storage Systems

Overview of Mass Storage Structure

V. Mass Storage Systems

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

Chapter 10: Mass-Storage Systems. Operating System Concepts 9 th Edition

CS370: Operating Systems [Fall 2018] Dept. Of Computer Science, Colorado State University

Chapter 10: Mass-Storage Systems

Module 13: Secondary-Storage Structure

CS370: Operating Systems [Fall 2018] Dept. Of Computer Science, Colorado State University

CHAPTER 12: MASS-STORAGE SYSTEMS (A) By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Chapter 12: Mass-Storage

Chapter 12: Mass-Storage

CS370 Operating Systems

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

CS3600 SYSTEMS AND NETWORKS

OPERATING SYSTEMS CS3502 Spring Input/Output System Chapter 9

Disk Scheduling. Based on the slides supporting the text

Chapter 12: Mass-Storage

Mass-Storage Systems. Mass-Storage Systems. Disk Attachment. Disk Attachment

OPERATING SYSTEMS CS3502 Spring Input/Output System Chapter 9

Chapter 12: Mass-Storage Systems. Operating System Concepts 8 th Edition,

Disk Scheduling. Chapter 14 Based on the slides supporting the text and B.Ramamurthy s slides from Spring 2001

Chapter 14: Mass-Storage Systems. Disk Structure

Mass-Storage Structure

Chapter 13: Mass-Storage Systems. Disk Scheduling. Disk Scheduling (Cont.) Disk Structure FCFS. Moving-Head Disk Mechanism

Chapter 13: Mass-Storage Systems. Disk Structure

Mass-Storage Systems

CS370 Operating Systems

Disc Allocation and Disc Arm Scheduling?

Mass-Storage Structure

Disk Scheduling COMPSCI 386

CSE325 Principles of Operating Systems. Mass-Storage Systems. David P. Duggan. April 19, 2011

Chapter 10: Mass-Storage Systems

CSE 451: Operating Systems Winter Lecture 12 Secondary Storage. Steve Gribble 323B Sieg Hall.

CSE 451: Operating Systems Winter Secondary Storage. Steve Gribble. Secondary storage

File. File System Implementation. Operations. Permissions and Data Layout. Storing and Accessing File Data. Opening a File

STORAGE SYSTEMS. Operating Systems 2015 Spring by Euiseong Seo

Silberschatz, et al. Topics based on Chapter 13

I/O Systems and Storage Devices

I/O Device Controllers. I/O Systems. I/O Ports & Memory-Mapped I/O. Direct Memory Access (DMA) Operating Systems 10/20/2010. CSC 256/456 Fall

Module 13: Secondary-Storage

Chapter 14: Mass-Storage Systems

Principles of Operating Systems CS 446/646

I/O & Storage. Jin-Soo Kim ( Computer Systems Laboratory Sungkyunkwan University

CSE 153 Design of Operating Systems

MASS-STORAGE STRUCTURE

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

Chapter 12: Mass-Storage Systems. Operating System Concepts 8 th Edition

Chapter 11: Mass-Storage Systems

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1

Chapter 12: Mass-Storage Systems. Operating System Concepts 9 th Edition

Chapter 11. I/O Management and Disk Scheduling

Today: Secondary Storage! Typical Disk Parameters!

I/O 1. Devices and I/O. key concepts device registers, device drivers, program-controlled I/O, DMA, polling, disk drives, disk head scheduling

Chapter 12: Mass-Storage Systems

Mass-Storage. ICS332 - Fall 2017 Operating Systems. Henri Casanova

CSE 451: Operating Systems Spring Module 12 Secondary Storage

CSE 451: Operating Systems Spring Module 12 Secondary Storage. Steve Gribble

Overview of Mass Storage Structure

Disk scheduling Disk reliability Tertiary storage Swap space management Linux swap space management

I/O, Disks, and RAID Yi Shi Fall Xi an Jiaotong University

CISC 7310X. C11: Mass Storage. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 4/19/2018 CUNY Brooklyn College

CSCI-GA Operating Systems. I/O : Disk Scheduling and RAID. Hubertus Franke

Tape pictures. CSE 30341: Operating Systems Principles

Hard Disk Drives (HDDs) Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

I/O 1. Devices and I/O. key concepts device registers, device drivers, program-controlled I/O, DMA, polling, disk drives, disk head scheduling

Hard Disk Drives (HDDs)

EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture)

Chapter 10: Mass-Storage Systems. Operating System Concepts 9 th Edition

Hard Disk Drives. Nima Honarmand (Based on slides by Prof. Andrea Arpaci-Dusseau)

Disks: Structure and Scheduling

CSE 153 Design of Operating Systems Fall 2018

Lecture 16: Storage Devices

Chapter 5: Input Output Management. Slides by: Ms. Shree Jaswal

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 420, York College. November 21, 2006

COS 318: Operating Systems. Storage Devices. Vivek Pai Computer Science Department Princeton University

File. File System Implementation. File Metadata. File System Implementation. Direct Memory Access Cont. Hardware background: Direct Memory Access

Operating Systems. Operating Systems Professor Sina Meraji U of T

Discussion Week 10. TA: Kyle Dewey. Tuesday, November 29, 11

Access time based on initial head position in disk scheduling

CS370 Operating Systems

Lecture 9. I/O Management and Disk Scheduling Algorithms

Devices and Device Controllers. secondary storage (disks, tape) and storage controllers

Secondary storage. CS 537 Lecture 11 Secondary Storage. Disk trends. Another trip down memory lane

Operating Systems. V. Input / Output. Eurecom

CSE 120. Operating Systems. March 27, 2014 Lecture 17. Mass Storage. Instructor: Neil Rhodes. Wednesday, March 26, 14

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

COS 318: Operating Systems. Storage Devices. Jaswinder Pal Singh Computer Science Department Princeton University

Introduction to I/O and Disk Management

Mass-Storage. ICS332 Operating Systems

Introduction to I/O and Disk Management

u Covered: l Management of CPU & concurrency l Management of main memory & virtual memory u Currently --- Management of I/O devices

Block Device Driver. Pradipta De

Transcription:

Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto Slides based on the book Operating System Concepts, 9th Edition, Abraham Silberschatz, Peter B. Galvin and Greg Gagne, Wiley Chapter 12

Hard Disk Drive (HDD) DCC-FCUP # 1

HDD Overview Data is stored on HDDs by recording it magnetically on a set of platters Common platter diameters range from 1.8 to 3.5 inches A platter is logically divided into (thousands of) circular tracks consisting of (hundreds of) sectors A set of tracks that are at one arm position makes up a cylinder DCC-FCUP # 2

Operating Systems 2015/2016 Solid State Disk (SSD) DCC-FCUP #3

SSD Overview An SSD is nonvolatile memory that is used like a hard drive Many technology variations SSDs have the same characteristics as traditional HDDs but: Can be more reliable because they have no moving parts Can be faster because they have no seek or latency time Can consume less power On the other hand, SSDs: Have less capacity and are more expensive per megabyte May have shorter life spans, so their use is somewhat limited (some systems, e.g. laptops, use them as a direct replacement for disk drives, while others use them as a new cache tier, moving data between HDDs, SSDs and memory to optimize performance) DCC-FCUP # 4

Data Transfers A disk drive is attached to a computer via a set of wires called an I/O bus Busses vary, including EIDE, ATA, SATA, USB, SCSI, Firewire, Data transfers are carried out by special hardware called controllers The host controller is the controller at the computer end of the bus The disk controller is the controller built into each disk drive To perform a disk I/O operation: The operating system starts by placing a command into the host controller The host controller then sends the command to the disk controller The disk controller operates the HDD hardware to carry out the command Data transfer at the HDD happens between the disk surface and a built-in cache in the disk controller Data transfer to the host occurs between the cache and the host controller DCC-FCUP # 5

Latency Times Any I/O operation is a five-stage process: Queuing time is the time for the device driver to process the desired request Controller time is the time for the disk controller to carry out the desired operation Seek time is the time to move the disk arm to the desired cylinder Rotational latency is the time for the desired sector to rotate under the disk head Transfer time is the time to transfer the desired data between the drive and the computer Disk latency is the sum of all times above and corresponds to the total amount of time between a request and the result be available DCC-FCUP # 6

Typical Numbers Queueing time depends on device driver Controller time depends on controller hardware Average seek time typically 3 12 milliseconds Average rotational latency depends on RPM (rotations per minute) speed 15,000 RPM = 250 RPS = 4ms per rotation = 2ms average rotational latency 10,000 RPM = 167 RPS = 6ms per rotation = 3ms average rotational latency Transfer time typically 50-100 MB per second (depends on transfer size, RPM speed and bits density on track) DCC-FCUP # 7

Assumptions: Performance Example Ignoring queuing and controller times for now Transfer rate of 100 MB/s, sector size of 1 KB 15,000 RPM disk 2ms average rotational latency, 3ms average seek time Read sector from random place on disk: 3ms (seek) + 2ms (rotational latency) + 0.01ms (transfer) = 5.01ms Effective transfer rate: approximately 200 KB per second Read sector from random place in same cylinder: 2ms (rotational latency) + 0.01ms (transfer) = 2.01ms Effective transfer rate: approximately 500 KB per second (2.5 times better!) DCC-FCUP # 8

Assumptions: Performance Example Ignoring queuing and controller times for now Transfer rate of 100 MB/s, sector size of 1 KB 15,000 RPM disk 2ms average rotational latency, 3ms average seek time Read next sector in same track: 0.01ms (transfer) Effective transfer rate: 100 MB per second (200 times better!!!) Key to use disks effectively is to minimize seek and rotational delays DCC-FCUP # 9

Disk Structure Modern disk drives are addressed as large one-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 one-dimensional array of logical blocks is mapped onto 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 through the rest of the tracks in that cylinder, and then through the rest of the cylinders from outermost to innermost DCC-FCUP # 10

Disk Structure Logical to physical address conversion should be easy Conversion consists of a cylinder number, a track number within that cylinder, and a sector number within that track In practice, it is difficult to perform this translation, for two reasons: Disks might have bad sectors The number of sectors per track is not constant DCC-FCUP # 11

Disk Scheduling One of the responsibilities of the operating system is to use the hardware efficiently for the disk drives this means having a fast access time and large disk bandwidth Access time includes seek time and rotational latency Disk bandwidth is the total number of bytes transferred divided by the total time between the first request for service and the completion of the last transfer Whenever a process needs I/O to or from the disk, it issues a system call to the operating system Both access time and disk bandwidth can be improved by managing the order in which disk I/O requests are serviced DCC-FCUP # 12

Disk Scheduling An I/O request specifies several pieces of information: The type of operation (input or output) The disk and memory addresses for the transfer The number of sectors to be transferred Operating system maintains a queue of pending requests per disk When one request completes, OS chooses which request to service next How does the operating system schedules the servicing of disk requests? Several optimization algorithms exist (most of them only consider the tracks being requested, ignoring the sectors) Optimization algorithms only make sense when a queue exists, otherwise a pending request can be serviced immediately DCC-FCUP # 13

First-Come First-Served (FCFS) FCFS services requests in the order they arrive Total head movements: 640 cylinders DCC-FCUP # 14

Shortest Seek Time First (SSTF) SSTF services the request closest to the current head position Total head movements: 236 cylinders DCC-FCUP # 15

SCAN (or Elevator Algorithm) SCAN behaves like an elevator in a building, first servicing requests in one way and then reversing to service requests in the other way Total head movements: 236 cylinders DCC-FCUP # 16

Circular SCAN (C-SCAN) C-SCAN works like SCAN but only services requests in one direction Total head movements: 382 cylinders DCC-FCUP # 17

C-LOOK (and LOOK) Version of C-SCAN (and SCAN) that reverses direction after servicing the last request in each direction, thus avoiding going until the end of the disk Total head movements: 322 cylinders DCC-FCUP # 18

FCFS (+) Fair among requesters Pros and Cons ( ) Order of arrival may lead to very long seeks SSTF (+) Reduce seeks ( ) May lead to starvation SCAN (+) Low seeks and no starvation ( ) Favors middle tracks (when the head reverses direction, the higher number of pending requests assuming a uniform distribution of requests is at the other end of the disk and those requests will have to wait the longest) DCC-FCUP # 19

C-SCAN Pros and Cons (+) Provides a more uniform wait time than SCAN ( ) Longer seeks on the way back LOOK & C-LOOK (+) Avoids useless seeks ( ) Same as corresponding SCAN version DCC-FCUP # 20

Disk Scheduling Discussion Given so many algorithms, how do we choose the best one? SSTF is common and has a natural appeal, since it increases performance over FCFS LOOK and C-LOOK perform better for systems that place a heavy load on the disk, since they avoid starvation However, performance depends on the number and types of requests Requests are also greatly influenced by the file allocation method A program reading a contiguously allocated file will generate several requests that are close together on the disk, resulting in limited head movement In contrast, a linked or indexed file may include blocks that are widely scattered on the disk, resulting in greater head movement DCC-FCUP # 21

Disk Scheduling Discussion All these algorithms focus on minimizing seek time but, for modern disks, the rotational latency can be nearly as large as the average seek time For the OS it is difficult to schedule for improved rotational latency, because modern disks do not disclose the physical location of logical blocks Disk manufacturers have been alleviating this problem by implementing disk scheduling algorithms in the controller hardware (OS just needs to send batch of requests to the controller, the controller then queues and schedules them to improve both the seek time and the rotational latency) If I/O performance is the only consideration, the OS can turn over the responsibility of disk scheduling to the disk hardware In practice, however, the OS has constraints on the service order for requests (for instance, demand paging may take priority over application I/O; writes are more urgent than reads if the cache is running out of free pages; ) DCC-FCUP # 22

SSD Scheduling Disk scheduling algorithms focus primarily on minimizing the amount of head movements, but SSDs do not contain moving disk heads! Most SSD schedulers simply use FCFS order However, the observed behavior of SSDs indicates that the time required to service reads is uniform but that the time to service writes, because of the properties of flash memory, is not uniform Some SSD schedulers exploit this characteristic by merging adjacent write requests, servicing read requests still in FCFS order DCC-FCUP # 23