Chapter 13: I/O Systems- 6th ed

Slides:



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

Chapter 6 I/O Systems.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
I/O and Networking Fred Kuhns
I/O Systems.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface.
04/14/2008CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 2, 2005 Chapter 13: I/O Systems I/O Hardware.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 13: I/O Systems.
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)
04/16/2010CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying an earlier edition.
I/O Systems CS 3100 I/O Hardware1. I/O Hardware Incredible variety of I/O devices Common concepts ◦Port ◦Bus (daisy chain or shared direct access) ◦Controller.
Chapter 13 Input/Output (I/O) Systems
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 13: I/O Systems.
I/O Systems CSCI 444/544 Operating Systems Fall 2008.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
CHAPTER 13: I/O SYSTEMS Overview Overview I/O Hardware I/O Hardware I/O API I/O API I/O Subsystem I/O Subsystem Transforming I/O Requests to Hardware Operations.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13+14: I/O Systems and Mass- Storage Structure I/O Hardware Application I/O.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 2, 2005 Chapter 13: I/O Systems I/O Hardware.
Operating Systems CMPSC 473 I/O Management (1) November Lecture 23 Instructor: Bhuvan Urgaonkar.
Hardware Definitions –Port: Point of connection –Bus: Interface Daisy Chain (A=>B=>…=>X) Shared Direct Device Access –Controller: Device Electronics –Registers:
Silberschatz, Galvin and Gagne  Operating System Concepts I/O Hardware Incredible variety of I/O devices.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-2: I/O Management (Review) Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 AE4B33OSS Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O.
I/O Systems I/O Hardware Application I/O Interface
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.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 13: I/O Systems.
I/O management is a major component of operating system design and operation Important aspect of computer operation I/O devices vary greatly Various methods.
Cosc 4740 Chapter 12 I/O Systems. I/O Hardware Incredible variety of I/O devices –Storage –Transmission –Human-interface.
Chapter 13: I/O Systems. 13.2/34 Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 13: I/O Systems I/O Hardware Application I/O Interface.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Six Step Process to Perform DMA Transfer.
XE33OSA Chapter 13: I/O Systems. 13.2XE33OSA Silberschatz, Galvin and Gagne ©2005 Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel.
CENG334 Introduction to Operating Systems Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:
I/O Management.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 2, 2005 Chapter 13: I/O Systems I/O Hardware.
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 13: I/O Systems.
1 Chapter 13 Input/Output (I/O) Systems Dr. İbrahim Körpeoğlu Bilkent University Department of Computer Engineering.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 13: I/O Systems.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 13: I/O Systems Overview I/O Hardware Application.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 13: I/O Systems.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 2, 2005 I/O through system calls Protection.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 13: I/O Systems.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
CMSC 421 Section 0202 I/O Systems Chapter 13: I/O Systems.
Module 11: I/O Systems Reading: Chapter 13 Objectives  Explore the structure of the operating system’s I/O subsystem.  Discuss the principles of I/O.
Chapter 13: I/O Systems.
Lecture 13 Input/Output (I/O) Systems (chapter 13)
Module 12: I/O Systems I/O hardware Application I/O Interface
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 13: I/O Systems.
CSCI 315 Operating Systems Design
I/O Systems.
I/O Systems I/O Hardware Application I/O Interface
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
Selecting a Disk-Scheduling Algorithm
CS703 - Advanced Operating Systems
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 13: I/O Systems.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Operating Systems I/O System Alok Kumar Jagadev.
Chapter 13: I/O Systems.
Module 12: I/O Systems I/O hardwared Application I/O Interface
Presentation transcript:

Chapter 13: I/O Systems- 6th ed I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Streams Performance Review Chapters 2 and 3, and instructors notes on: “Interrupt schemes and DMA” This chapter gives more focus to these chapters and topics. Instructor’s annotations in blue Updated 12/5/03 Operating System Concepts

I/O Hardware Incredible variety of I/O devices Common concepts Port - basic interface to CPU - status, control, data Bus (daisy chain or shared direct access) - main and specialized local (ex: PCI for main and SCSI for disks) Controller (host adapter) - HW interface between Device and Bus - an adapter card or mother board module Controller has special purposes registers (commands, etc.) which when written to causes actions to take place - may be memory mapped I/O instructions control devices - ex: in, out for Intel Devices have addresses, used by Direct I/O instructions - uses I/O instructions Memory-mapped I/O - uses memory instructions Operating System Concepts

A Typical PC Bus Structure Operating System Concepts

Device I/O Port Locations on PCs (partial) Various ranges for a device includes both control and data ports Operating System Concepts

Polling Handshaking Determines state of device command-ready busy Error Busy-wait cycle to wait for I/O from device When not busy - set data in data port, set command in control port and let ‘er rip Not desirable if excessive - since it is a busy wait which ties up CPU & interferes with productive work Remember CS220 LABs Operating System Concepts

Interrupts CPU Interrupt request line (IRQ) triggered by I/O device Interrupt handler receives interrupts Maskable to ignore or delay some interrupts Interrupt vector to dispatch interrupt to correct handler Based on priority Some unmaskable Interrupt mechanism also used for exceptions Application can go away after I/O request, but is til responsible for transferring data to memory when it becomes available from the device. Can have “nested” interrupts (with Priorities) See Instructors notes: “Use of Interrupts and DMA” Soft interrupts or “traps” generated from OS in system calls. Operating System Concepts

Interrupt-Driven I/O Cycle Go away & do Something else ==> Operating System Concepts

Intel Pentium Processor Event-Vector Table Interrupts 0-31 are non-maskable - cannot be disabled Operating System Concepts

Direct Memory Access With pure interrupt scheme, CPU was still responsible for transferring data from controller to memory (on interrupt) when device mad it available. Now DMA will do this - all CPU has to do is set up DMA and user the data when the DMA-complete interrupt arrives. … Interrupts still used - but only to signal DMA Complete. Used to avoid programmed I/O for large data movement Requires DMA controller Bypasses CPU to transfer data directly between I/O device and memory Cycle stealing: interference with CPU memory instructions during DMA transfer. - DMA takes priority - CPU pauses on memory part of word. Operating System Concepts

Six Step Process to Perform DMA Transfer Operating System Concepts

Application I/O Interface The OS software interface to the I/O devices (an API to the programmer) Attempts to abstract the characteristics of the many I/o devices into a few general classes. I/O “system calls” encapsulate device behaviors in generic classes Device-driver layer hides differences among I/O controllers from kernel Devices vary in many dimensions Character-stream or block units for data transfer bytes vs blocks Sequential or random-access - access methods Synchronous (predictable response times) vs asynchronous (unpredictable response times) Sharable or dedicated - implications on deadlock Speed of operation - device/software issue read-write, read only, or write only - permissions Operating System Concepts

A Kernel I/O Structure Fig. 13.6 System calls ==> … “user” API ==> Example: ioctl(…) generic call (roll your own) in UNIX (p. 468), and other more specific commands or calls open, read, ... Fig. 13.6 Operating System Concepts

Characteristics of I/O Devices Device driver must deal with these at a low level Use of I/O buffering Operating System Concepts

Block and Character Devices Block devices include disk drives example sectors or sector clusters on a disk Commands/calls include read, write, seek Access is typically through a file-system interface Raw I/O or file-system access - “binary xfr” of file data - interpretation is in application (personality of file lost) Memory-mapped (to VM) file access possible - use memory instructions rather than I/O instructions - very efficient (ex: swap space for disk). Device driver xfr’s blocks at a time - as in paging DMA transfer is block oriented Character devices include keyboards, mice, serial ports Device driver xfr’s byte at a time Commands include get, put - character at a time Libraries layered on top allow line editing - ex: keyboard input could be beefed up to use a line at a time (buffering) Block & character devices also determine the two general device driver catagories Operating System Concepts

Network Devices Varying enough from block and character to have own interface - OS makes network device interface distinct from disk interface - due to significant differences between the two Unix and Windows NT/9i/2000 include socket interface Separates network protocol from network operation Encapsulates details of various network devices for application … analogous to a file and the disk??? Includes select functionality - used to manage and access sockets - returns info on packets waiting or ability to accept packets - avoids polling Approaches vary widely (pipes, FIFOs, streams, queues, mailboxes) … you saw some of these! Operating System Concepts

Clocks and Timers Provide current time, elapsed time, timer If programmable, interval time used for timings, periodic interrupts ioctl (on UNIX) covers odd aspects of I/O such as clocks and timers - a back door for device driver writers (roll your own). Can implement “secret” calls which may not be documented in a users or programming manual Operating System Concepts

Blocking and Nonblocking I/O Blocking - process (making the request blocks - lets other process execute) suspended until I/O completed Easy to use and understand Insufficient for some needs multi-threading - depends on role of OS in thread management Nonblocking - I/O call returns as much as available User interface, data copy (buffered I/O) Implemented via multi-threading Returns quickly with count of bytes read or written - ex: read a “small” portion of a file very quickly, use it, and go back for more, ex: displaying video “continuously from a disk” Asynchronous - process (making the asynch request) runs while I/O executes Difficult to use - can it continue without the results of the I/O? I/O subsystem signals process when I/O completed - via interrupt (soft), or setting of shared variable which is periodically tasted. Operating System Concepts

Kernel I/O Subsystem See A Kernel I/O Structure slide - Fig 13.6 Scheduling Some I/O request ordering via per-device queue Some OSs try fairness Buffering - store data in memory while transferring between devices To cope with device speed mismatch - de-couples application from device action To cope with device transfer size mismatch To maintain “copy semantics” - guarantee that the version of data written to device from a buffer is identical to that which was there at the time of the “write call” - even if on return of the system call, the user modifies buffer - OS copies data to kernel buffer before returning control to user. Double or “ping-pong” buffers - write in one and read from another - decouples devices and applications … idea can be extended to multiple buffers accesses in a circular fashion Operating System Concepts

Sun Enterprise 6000 Device-Transfer Rates Operating System Concepts

Kernel I/O Subsystem - (continued) Caching - fast memory holding copy of data Always just a copy Key to performance How does this differ from a buffer? Spooling - a buffer holding output/(input too) for a device If device can serve only one request at a time Avoids queuing applications making requests. Data from an application is saved in a unique file associated with the application AND the particular request. Could be saved in files on a disk, or in memory. Example: Printing Device reservation - provides exclusive access to a device System calls for allocation and deallocation Watch out for deadlock - why? Operating System Concepts

Error Handling OS can recover from disk read, device unavailable, transient write failures Most return an error number or code when I/O request fails System error logs hold problem reports CRC checks - especially over network transfers of a lot of data, for example video in real time. Operating System Concepts

Kernel Data Structures Kernel keeps state info for I/O components, including open file tables, network connections, character device state used by device drivers in manipulating devices and data transfer, and in for error recovery data that has images on the disk must be kept in synch with disk copy. Many, many complex data structures to track buffers, memory allocation, “dirty” blocks Some use object-oriented methods and message passing to implement I/O Make data structures object oriented classes to encapsulate the low level nature of the “device” - UNIX provides a seamless interface such as this. Operating System Concepts

UNIX I/O Kernel Data Structure Refer to chapter 11 and 12 on files Fig. 13.9 Operating System Concepts

Mapping I/O Requests to Hardware Operations Consider reading a file from disk for a process: How is connection made from file-name to disk controller: Determine device holding file Translate name to device representation Physically read data from disk into buffer Make data available to requesting process Return control to process See the 10 step scenario on pp. 479-481 (Silberschatz, 6th ed.) for a clear description. Operating System Concepts

Life Cycle of An I/O Request Data already in buffer Ex read ahead Operating System Concepts

STREAMS (?) STREAM – a full-duplex communication channel between a user-level process and a device A STREAM consists of: - STREAM head interfaces with the user process - driver end interfaces with the device - zero or more STREAM modules between them. Each module contains a read queue and a write queue Message passing is used to communicate between queues Operating System Concepts

The STREAMS Structure Operating System Concepts

Performance sect 13.7 I/O a major factor in system performance: Places demands on CPU to execute device driver, kernel I/O code resulting in context switching interrupt overhead Data copying - loads down memory bus Network traffic especially stressful See bulleted list on page 485 (Silberschatz, 6th ed.) Improving Performance See bulleted list on page 485 (Silberschatz, 6th ed.) Reduce number of context switches Reduce data copying Reduce interrupts by using large transfers, smart controllers, polling Use DMA Move proccessing primitives to hardware Balance CPU, memory, bus, and I/O performance for highest throughput Operating System Concepts

Intercomputer Communications- omit for now Operating System Concepts

Device-Functionality Progression Where should I/O functionality be implemented? Application level … device hardware Decision depends on trade-offs in the design layers: Operating System Concepts