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

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

Bus Architecture Example

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

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. Operating System Concepts 8 th Edition,

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

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

OPERATING SYSTEMS CS3502 Spring Input/Output System Chapter 9

CS420: Operating Systems. Mass Storage Structure

Chapter 10: Mass-Storage Systems

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

Free Space Management

EIDE, ATA, SATA, USB,

OPERATING SYSTEMS CS3502 Spring Input/Output System Chapter 9

Operating Systems Peter Pietzuch

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

Overview of Mass Storage Structure

Principles of Operating Systems CS 446/646

CSE 153 Design of Operating Systems Fall 2018

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

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

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13

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

Outline. Operating Systems: Devices and I/O p. 1/18

Module 13: Secondary-Storage Structure

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

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

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

CSE 4/521 Introduction to Operating Systems. Lecture 27 (Final Exam Review) Summer 2018

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

CSE 153 Design of Operating Systems

Hard Disk Drives (HDDs)

I/O Systems and Storage Devices

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

Secondary Storage Management Rab Nawaz Jadoon

I/O Management and Disk Scheduling. Chapter 11

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Fall 2017

Disc Allocation and Disc Arm Scheduling?

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Spring 2018

Today: Secondary Storage! Typical Disk Parameters!

CSE506: Operating Systems CSE 506: Operating Systems

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

CSE 120. Overview. July 27, Day 8 Input/Output. Instructor: Neil Rhodes. Hardware. Hardware. Hardware

Input Output (IO) Management

Chapter 12: Mass-Storage

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

V. Mass Storage Systems

Chapter 11. I/O Management and Disk Scheduling

Operating Systems. V. Input / Output. Eurecom

Module 2: Computer-System Structures. Computer-System Architecture

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

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

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

[537] I/O Devices/Disks. Tyler Harter

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

Disk Scheduling. Based on the slides supporting the text

Chapter-6. SUBJECT:- Operating System TOPICS:- I/O Management. Created by : - Sanjay Patel

Chapter 10: Mass-Storage Systems

CS370 Operating Systems

CSE 380 Computer Operating Systems

Principles of Operating Systems CS 446/646

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

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

Lecture 9. I/O Management and Disk Scheduling Algorithms

Mass Storage. 2. What are the difference between Primary storage and secondary storage devices? Primary Storage is Devices. Secondary Storage devices

CS3600 SYSTEMS AND NETWORKS

Mass-Storage Structure

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

UNIT 4 Device Management

Lecture 16: Storage Devices

Input/Output. Chapter 5: I/O Systems. How fast is I/O hardware? Device controllers. Memory-mapped I/O. How is memory-mapped I/O done?

CS162 Operating Systems and Systems Programming Lecture 17. Disk Management and File Systems

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

Disk Scheduling COMPSCI 386

Computer System Overview

Chapter 13: I/O Systems

Operating Systems. V. Input / Output

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

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

Introduction to I/O and Disk Management

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. (done)

Introduction to I/O and Disk Management

UNIT 2 Data Center Environment

The Device Driver Interface. Input/Output Devices. System Call Interface. Device Management Organization

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

CS162 Operating Systems and Systems Programming Lecture 17. Disk Management and File Systems. Review: Want Standard Interfaces to Devices

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. One OS function is to control devices

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

COS 318: Operating Systems. Storage Devices. Kai Li Computer Science Department Princeton University

Solaris I/O Management and Disk Scheduling

Computer System Overview OPERATING SYSTEM TOP-LEVEL COMPONENTS. Simplified view: Operating Systems. Slide 1. Slide /S2. Slide 2.

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

I/O Systems. 04/16/2007 CSCI 315 Operating Systems Design 1

2. Which of the following resources is not one which can result in deadlocking processes? a. a disk file b. a semaphore c. the central processor (CPU)

Input/Output Systems

Chapter 7: Mass-storage structure & I/O systems. Operating System Concepts 8 th Edition,

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

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

Chapter 13: I/O Systems

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

Transcription:

I/O 1 Devices and Device Controllers network interface graphics adapter secondary storage (disks, tape) and storage controllers serial (e.g., mouse, keyboard) sound co-processors...

I/O 2 Bus Architecture Example CPU Cache Bridge Memory PCI bus SCSI controller USB controller Bridge Graphics ISA bus keyboard mouse Modem Sound

I/O 3 Simplified Bus Architecture CPU M K K K Key M: memory K: device controller disk controller other controllers

I/O 4 Device Interactions device registers command, status, and data registers CPU accesses register access via: special I/O instructions memory mapping interrupts used by device for asynchronous notification (e.g., of request completion) handled by interrupt handlers in the operating system

I/O 5 Device Interactions: OS/161 Example /* LAMEbus mapping size per slot */ #define LB_SLOT_SIZE 65536 #define MIPS_KSEG1 0xa0000000 #define LB_BASEADDR (MIPS_KSEG1 + 0x1fe00000) /* Generate the memory address (in the uncached segment) * /* for specified offset into slot s region of the LAMEbus. * void * lamebus_map_area(struct lamebus_softc *bus, int slot, u_int3 { u_int32_t address; (void)bus; // not needed assert(slot>=0 && slot<lb_nslots); } address = LB_BASEADDR + slot*lb_slot_size + offset; return (void *)address;

I/O 6 Device Interactions: OS/161 Example /* FROM: kern/arch/mips/mips/lamebus_mips.c */ /* Read 32-bit register from a LAMEbus device. */ u_int32_t lamebus_read_register(struct lamebus_softc *bus, int slot, u_int32_t offset) { u_int32_t *ptr = lamebus_map_area(bus, slot, offset); return *ptr; } /* Write a 32-bit register of a LAMEbus device. */ void lamebus_write_register(struct lamebus_softc *bus, int slot, u_int32_t offset, u_int32_t val) { u_int32_t *ptr = lamebus_map_area(bus, slot, offset); *ptr = val; }

I/O 7 Device Interactions: OS/161 Example /* Registers (offsets within slot) */ #define LT_REG_SEC 0 /* time of day: seconds */ #define LT_REG_NSEC 4 /* time of day: nanoseconds */ #define LT_REG_ROE 8 /* Restart On countdown-timer Expiry flag * #define LT_REG_IRQ 12 /* Interrupt status register */ #define LT_REG_COUNT 16 /* Time for countdown timer (usec) */ #define LT_REG_SPKR 20 /* Beep control */ /* Get the number of seconds from the lamebus timer */ secs = bus_read_register(lt->lt_bus, lt->lt_buspos, LT_REG_SEC); /* Get the timer to beep. Doesn t matter what value is sent */ bus_write_register(lt->lt_bus, lt->lt_buspos, LT_REG_SPKR, 440);

I/O 8 Direct Memory Access (DMA) used for block data transfers between devices (e.g., disk controller) and memory CPU initiates DMA, but can do other work while the transfer occurs 3 1 2 K CPU M K K (disk) 1. CPU issues DMA request to controller 2. controller directs data transfer 3. controller interrupts CPU

I/O 9 Applications and Devices interaction with devices is normally accomplished by device drivers in the OS, so that the OS can control how the devices are used applications see a simplified view of devices through a system call interface (e.g., block vs. character devices in Unix) the OS may provide a system call interface that permits low level interaction between application programs and a device operating system often buffers data that is moving between devices and application programs address spaces benefits: solve timing, size mismatch problems drawback: performance

I/O 10 Logical View of a Disk Drive disk is an array of numbered blocks (or sectors) each block is the same size (e.g., 512 bytes) blocks are the unit of transfer between the disk and memory typically, one or more contiguous blocks can be transferred in a single operation storage is non-volatile, i.e., data persists even when the device is without power

I/O 11 A Disk Platter s Surface Track Sector

I/O 12 Physical Structure of a Disk Drive Sector Shaft Track Cylinder

I/O 13 Simplified Cost Model for Disk Block Transfer moving data to/from a disk involves: seek time: move the read/write heads to the appropriate cylinder rotational latency: wait until the desired sectors spin to the read/write heads transfer time: wait while the desired sectors spin past the read/write heads request service time is the sum of seek time, rotational latency, and transfer time t service = t seek + t rot + t transfer note that there are other overheads but they are typically small relative to these three

I/O 14 Rotational Latency and Transfer Time rotational latency depends on the rotational speed of the disk if the disk spins at ω rotations per second: expected rotational latency: 0 t rot 1 ω t rot = 1 2ω transfer time depends on the rotational speed and on the amount of data transferred if k sectors are to be transferred and there are T sectors per track: t transfer = k Tω

I/O 15 Seek Time seek time depends on the speed of the arm on which the read/write heads are mounted. a simple linear seek time model: t maxseek is the time required to move the read/write heads from the innermost cylinder to the outermost cylinder C is the total number of cylinders if k is the required seek distance (k > 0): t seek (k) = k C t maxseek

I/O 16 Disk Head Scheduling goal: reduce seek times by controlling the order in which requests are serviced disk head scheduling may be performed by the controller, by the operating system, or both for disk head scheduling to be effective, there must be a queue of outstanding disk requests (otherwise there is nothing to reorder) an on-line approach is required: the disk request queue is not static

I/O 17 FCFS Disk Head Scheduling handle requests in the order in which they arrive +: fair, simple -: no optimization of seek times Figure from Operating Systems Concepts, 6th Ed., Silberschatz, Galvin, Gagne. Wiley. 2003

I/O 18 Shortest Seek Time First (SSTF) choose closest request (a greedy approach) +: seek times are reduced -: starvation of distant requests Figure from Operating Systems Concepts, 6th Ed., Silberschatz, Galvin, Gagne. Wiley. 2003

I/O 19 SCAN and LOOK LOOK is the commonly-implemented variant of SCAN. Also known as the elevator algorithm. Under LOOK, the disk head moves in one direction until there are no more requests in front of it, then reverses direction. seek time reduction without starvation SCAN is like LOOK, except the read/write heads always move all the way to the edge of the disk in each direction.

I/O 20 SCAN Example Figure from Operating Systems Concepts, 6th Ed., Silberschatz, Galvin, Gagne. Wiley. 2003

I/O 21 Circular SCAN (C-SCAN) and Circular LOOK (C-LOOK) C-LOOK is the commonly-implemented variant of C-SCAN Under C-LOOK, the disk head moves in one direction until there are no more requests in front of it, then it jumps back and begins another scan in the same direction as the first. C-LOOK avoids bias against edge cylinders

I/O 22 C-LOOK Example Figure from Operating Systems Concepts, 6th Ed., Silberschatz, Galvin, Gagne. Wiley. 2003