I/O Devices. Characteristics of I/O Devices  Block Devices  Information are stored and accessed in fixed-size blocks  Addressable, can have sequential.

Slides:



Advertisements
Similar presentations
I/O Systems & Mass-Storage Systems
Advertisements

I/O Management and Disk Scheduling
I/O Management and Disk Scheduling
Chapter 4 Device Management and Disk Scheduling DEVICE MANAGEMENT Content I/O device overview I/O device overview I/O organization and architecture I/O.
I/O Management and Disk Scheduling
Input and Output CS 215 Lecture #20.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Disks and RAID.
File Systems.
OPERATING SYSTEMS CS3530 Summer 2014 OPERATING SYSTEMS CS3530 Summer 2014 Input/Output System Chapter 9.
Day 30 I/O Management and Disk Scheduling. I/O devices Vary in many ways Vary in many ways –Data rate –Application –Complexity of control –Unit of transfer.
Input/Output Management and Disk Scheduling
Operating Systems Input/Output Devices (Ch , 12.7; , 13.7)
Disk Drivers May 10, 2000 Instructor: Gary Kimura.
CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (4) File Management & Input/Out Systems 10/14/2008 Yang Song (Prepared.
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
Ceng Operating Systems 5-1 Chapter 5 : Input & Output I/O hardware (classification, device drivers) I/O techniques (programmed, interrupt driven,
1 Storage Hierarchy Cache Main Memory Virtual Memory File System Tertiary Storage Programs DBMS Capacity & Cost Secondary Storage.
I/O Management and Disk Scheduling (Chapter 10) Perhaps the messiest aspect of operating system design is input/output A wide variety of devices and many.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
Disks.
Device Management.
Avishai Wool lecture Introduction to Systems Programming Lecture 9 Input-Output Devices.
04/21/2004CSCI 315 Operating Systems Design1 Disk Scheduling.
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.
1 Today I/O Systems Storage. 2 I/O Devices Many different kinds of I/O devices Software that controls them: device drivers.
Operating Systems Input/Output Devices (Ch 5: )
Secondary Storage Management Hank Levy. 8/7/20152 Secondary Storage • Secondary Storage is usually: –anything outside of “primary memory” –storage that.
Disk and I/O Management
CS4432: Database Systems II Data Storage (Better Block Organization) 1.
Device Management. Serial Port Serial Device Serial Device Memory CPU Printer Terminal Modem Mouse etc.
Device Management. So far… We have covered CPU and memory management Computing is not interesting without I/Os Device management: the OS component that.
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.
Chapter 5 : Input & Output
I/O – Chapter 8 Introduction Disk Storage and Dependability – 8.2 Buses and other connectors – 8.4 I/O performance measures – 8.6.
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.
1 Lecture 8: Secondary-Storage Structure 2 Disk Architecture Cylinder Track SectorDisk head rpm.
Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13+14: I/O Systems and Mass- Storage Structure I/O Hardware Application I/O.
1 I/O Management and Disk Scheduling Chapter Categories of I/O Devices Human readable Used to communicate with the user Printers Video display terminals.
1 IO Management and Disk Scheduling Chapter Categories of I/O Devices n Human readable u used to communicate with the user u video display terminals.
1 I/O Management and Disk Scheduling Chapter
1 Module 12: I/O Systems n I/O hardware n Application I/O Interface n Kernel I/O Subsystem n Transforming I/O Requests to Hardware Operations n Performance.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
I/O Management and Disk Structure Introduction to Operating Systems: Module 14.
OSes: 11. FS Impl. 1 Operating Systems v Objectives –discuss file storage and access on secondary storage (a hard disk) Certificate Program in Software.
1 I/O Management and Disk Scheduling Chapter Categories of I/O Devices Human readable –Used to communicate with the user –Printers –Video display.
I/O and Disk Scheduling CS Spring Overview Review of I/O Techniques I/O Buffering Disk Geometry Disk Scheduling Algorithms RAID.
Computer Organization. This module surveys the physical resources of a computer system.  Basic components  CPU  Memory  Bus  I/O devices  CPU structure.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
I/O Management and Disk Scheduling Chapter 11. Categories of I/O Devices Human readable Used to communicate with the user  Printers, Display terminals,
Processor Memory Processor-memory bus I/O Device Bus Adapter I/O Device I/O Device Bus Adapter I/O Device I/O Device Expansion bus I/O Bus.
Device Management Mark Stanovich Operating Systems COP 4610.
Chapter 9 I/O System. 2 Input/Output System I/O Major objectives are: Take an application I/O request and send it to the physical device. Then, take whatever.
Chapter 101 I/O Management and Disk Scheduling Chapter 11.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Device Management Andy Wang Operating Systems COP 4610 / CGS 5765.
10/15: Lecture Topics Input/Output –Types of I/O Devices –How devices communicate with the rest of the system communicating with the processor communicating.
Chapter 11 I/O Management and Disk Scheduling Dave Bremer Otago Polytechnic, NZ ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
1 Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and.
Memory Management.
Sarah Diesburg Operating Systems CS 3430
Multiple Platters.
Operating System I/O System Monday, August 11, 2008.
Lecture 45 Syed Mansoor Sarwar
Persistence: hard disk drive
File Storage and Indexing
Andy Wang Operating Systems COP 4610 / CGS 5765
Presentation transcript:

I/O Devices

Characteristics of I/O Devices  Block Devices  Information are stored and accessed in fixed-size blocks  Addressable, can have sequential or random accesses  E.g., disks  Character Devices  Can only be accessed character by character  Sequential accesses only  E.g., terminals, printers, mouse

I/O Communication Techniques  General Cycle  CPU issues an I/O request to a device controller  I/O AR is used to address the I/O module  Wait for the operation to complete  How to know whether the operation is completed  Read from or write to I/O module  Where to fetch or store I/O data  Various Techniques  Programmed I/O  Interrupt-Driven I/O  Direct Memory Access  Memory Mapped I/O I/O BR - Used by some I/O

I/O Cycle – CPU’s Roll CPU starts I/O - This is for read op CPU periodically checks whether I/O has completed - No interrupt I/O device has put the info in I/O BR CPU take it from I/O BR and put it in memory CPU after initiating I/O, just “ignores” it I/O device interrupts when completes - Used in current systems - The rest is the same Not only uses interrupt, but also uses DMA - Direct memory access - Previous schemes for block I/O  CPU takes the input word by word  Too much work for CPU - I/O device directly put input in memory - Interrupt after I/O fully completes - E.g., disk I/O are handled this way DMA and cycle stealing - Single bus: DMA-MM and CPU-MM share the same bus - DMA needs the bus to put the input in memory (or take the output from memory) while CPU continues to use it - I/O device needs to steal cycles from CPU - Bus supports cycle stealing and will give I/O priority

I/O Communication Techniques  Programmed I/O  CPU cycles are wasted to keep on checking I/O status  Interrupt-Driven I/O  CPU can do useful work while I/O is in operation  For each data transfer (word by word), the CPU need to intervene  Data transfer from I/O module to CPU then to memory (for read, vice versa for write)  the interrupt handling cost is still high

I/O Communication Techniques  Direct Memory Access  Need to support “cycle stealing”  CPU gets interrupted at the end of the entire data transfers, but not each data transfer  Most suitable for block devices  Memory Mapped I/O  Each controller has fixed registers and these registers are part of memory address space  CPU writes to registers the access command and parameters  When I/O is done the results are stored in the registers  Can be used for character devices

Devices  Disk Device  Block device, block I/O  Keyboard and displays  Character device, stream I/O  Clock device  Character device

Disk Device  Disk Hardware  Tracks and sectors  A disk has many tracks  Each track contains many sections –Some has fixed number of sectors per track –Some has variant number of sectors per track (Zoned)  Disk is accessed by sectors (corresponding to blocks)  Platters  Some disk system has multiple disk platters  Cylinders  The same track on multiple disk platters form a cylinder

Sample Disk Device A platter of a 5.25" hard disk - 20 tracks -16 sectors per track bytes per sector - ECC for each sector

Sample Disk Device Problem in large sized disks - Internal tracks and external tracks have very different sizes - cannot divide each track to same number of sectors Zoned bit recording - Divide the disk to different zones - Have the same number of sector in each zone This sample disk - Has 20 tracks - Divided into five zones - The outermost blue zone has 5 tracks, each has 16 sectors - The innermost red zone has 3 tracks of 9 sectors - The sizes of the sectors are fairly uniform

Sample Disk Device ZoneTracks in Zone Sectors Per Track Data Transfer Rate (Mbits/s) , , , , , , , , , , , , , , Sample disk format data - 20 GB disk platter - Zones, tracks, sectors

Disk Device  How to read/write disk  Disk head (disk arm) moves to the correct track  Disk rotates to the correct sector  Disk rotates constantly  Fixed head versus movable head  Most disks have movable head  Fixed head has one head per track  Single/double sided  Single/multiple platter(s)

Sample Disk Device 8 tracks per cylinder - Double sided disk

Disk Device  Disk Addressing  Only address the sectors, no need for offset within a sector  Old style: physical address  Addressed by: (platter #, track #, sector #)  BIOS limitation: only address up to tracks  New addressing scheme: logical address  Number the sectors contiguously  28 bits are used to address the sector number  Still can only address 128GB disk

Disk Device  On each sector  Sync: some fixed bytes to indicate the starting of a sector  Otherwise, how to recognize the sectors on a disk  ID: sector address (e.g., volume #, sector #, etc.)  Data: always 512B (up to now)  ECC code  Gap: to separate important fields

Disk Access Time  Seek Time - disk head moves to proper track  T s = nm + s  n: number of tracks to be traversed  m: traverse time per track  s: start up time  Generally, the average seek time is given  Rotational Delay - rotate to proper sector  T r : determined by the revolutionary speed  Consider a 3600 rpm disk  One revolution takes 16.7msec  Average rotational delay = 1/2 revolution = 8.3msec

Disk Access Time  Transfer Time - transfer data  T t = r * (b / N)  b: number of bytes to be transferred  N: number of bytes per track  r: rotation speed  Total access time  = T s + T r + T t

Disk Access Time (Example)  Disk spec  512 bytes per sector  256 sectors per track  3600 rpm  Traverse time per track = 1 msec  Startup time = 3msec  Read a file  File size: 1MB  Consecutively allocated  Starting track = 15  Current track = 5 Rotational delay: 3600 rpm  60 rps  1/60 sec per revolution  16.7 msec per revolution Rotational delay = 1/2 revolution time = 8.3msec Transfer rate: Transfer a track in 16.7 msec 256 sectors/track, 0.5KB/sector  Transfer 128KB per 16.7msec 1MB file requires 8 tracks Transfer time = 16.7 * 8 = msec Seek time = (15  5)*1ms + 3ms = 13 msec Total time required = msec = msec

Disk Access Time (Example)  Disk spec  512 bytes per sector  256 sectors per track  7200 rpm  Average seek time = 10 msec  Read a file  File size: 1MB  Dynamically allocated Rotational delay: 7200 rpm  120 rps  1/120 sec per revolution  8.3 msec per revolution Rotational delay = 4.2 msec Transfer rate: Transfer a track in 8.3 msec One sector requires 8.3 / 256 msec = 32.4  sec per 512 bytes Total time required = ( ) * 2048 = msec = 29 sec

Disk Access Time Samples SeriesSeagate U6 Maxtor DiamondMax VL40 Western Digital WDx00AB Formatted Capacity (GB) 80/60/4040/30/20/1080/60/40/30 Internal Transfer Rate (max) (Mbits/sec) Average Seek Time, Read (ms) Track-to-Track Seek, Read (ms) Average Latency (ms) Buffer Size2 MB2 MBs2 MB Spindle Speed (RPM)5400

OS Issues for Disk Devices  Disk Allocation Strategies  Allocation for files  Try to put data blocks of a file close together  To avoid additional seek time and rotational delay  Discussed with the file systems  Disk-arm Scheduling Algorithms  Try to read closest track next  To reduce seek time

Disk-arm Scheduling Algroithms  First-Come-First-Served  simple, but less efficient  Scan  Serve the request closest to current track toward the current arm direction  C-Scan  Always consider forward direction of arm movement  FScan  Problem in other Scan algorithms: Arm-stickiness (starvation problem)  Use two queues, when one queue is served, all new requests go to the other queue

Disk-arm Scheduling Algroithms  Consider the scenario  Request sequence: 5, 102, 95, 102, 210, 80, 45, 200, 105  Current arm location: 90 with forward direction  First-Come-First-Served  90 – 5 – 102 – 210 – 80 – 45 – 200 – 105  Total tracks traversed: =705  Scan  90 – 95 – 102 – 102 – 105 – 200 – 210 – 80 – 45 – 5  Total tracks traversed: = 325  C-Scan  90 – 95 – 102 – 102 – 105 – 200 – 210 – 5 – 45 – 80  Total tracks traversed: = 400

Clock Device  Clock device  Hold register  Every clock has a different speed (quartz oscillation)  Hold register holds the count = # oscillations per unit time  Counter  At the beginning of each time unit, set to hold register  Decremented the counter  When counter = 0, generate an interrupt signal  Each interrupt period is called a clock tick

Clock Device  Clock device  Clock register  At each clock tick, increase the clock value  Consists of 2 words  Record time since 1/1/1970, in # seconds  Another register to keep finer readings  Clock device  Keep track of time  Provide alarm service  Every clock tick  Check whether any alarm is up  User or OS can “setTimer”

Clock Device  Alarm service by OS  OS maintain a list of timer requests  Requests from OS and users  E.g., refresh monitor every 1/30 seconds  E.g., CPU time quantum expiration  E.g., sleep (5)  List is in sorted order  Each entry:  Time is kept in terms of # clock ticks from previous entry  First entry is copied to a register  The register decremented at every clock tick  When the register = 0, an timer interrupt is generated

Timer Requests Example  Example:  Each clock tick = 1  sec  Current time: 15:59:59 and  sec  Current request and list of requests as follows  Requests  Next time quantum: 100  sec after, issued at current time  User request: usleep (35), set at 3 time units after  User request: alarm at 16:00 exact, set at the same time as above –Convert: 147  sec after 10 Current timer List of timers

Terminal Device  Include keyboard and display  Use RS-232 protocol transmits 1-bit at a time  Transmission rate: Kbps  CPU gets interrupted for every character typed  Echo whatever being typed  Overhead for CPU  New intelligent terminal system directly route the typed character from keyboard to monitor  CPU only gets interrupted after the

Readings  Sections , 11.5  Section 1.7