NETW 3005 I/O Systems. Reading For this lecture, you should have read Chapter 13 (Sections 1-4, 7). NETW3005 (Operating Systems) Lecture 10 - I/O Systems2.

Slides:



Advertisements
Similar presentations
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Advertisements

Categories of I/O Devices
CS-334: Computer Architecture
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
Lecture Objectives: 1)Explain the limitations of flash memory. 2)Define wear leveling. 3)Define the term IO Transaction 4)Define the terms synchronous.
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.
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: I/O Systems I/O Hardware Application I/O Interface
1 Today I/O Systems Storage. 2 I/O Devices Many different kinds of I/O devices Software that controls them: device drivers.
I/O Systems CSCI 444/544 Operating Systems Fall 2008.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Copyright ©: Nahrstedt, Angrave, Abdelzaher
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
INPUT/OUTPUT ARCHITECTURE By Truc Truong. Input Devices Keyboard Keyboard Mouse Mouse Scanner Scanner CD-Rom CD-Rom Game Controller Game Controller.
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
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.
Hardware Definitions –Port: Point of connection –Bus: Interface Daisy Chain (A=>B=>…=>X) Shared Direct Device Access –Controller: Device Electronics –Registers:
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 Lecture 20: I/O n I/O hardware n I/O structure n communication with controllers n device interrupts n device drivers n streams.
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.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS6: Device Management 6.1. Principles of I/O.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.
1 Comp 104: Operating Systems Concepts Devices. 2 Today Devices –Introduction –Handling I/O Device handling Buffering and caching.
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent University.
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.
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.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
Fall 2000M.B. Ibáñez Lecture 25 I/O Systems. Fall 2000M.B. Ibáñez Categories of I/O Devices Human readable –used to communicate with the user –video display.
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.
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:
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.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 13: I/O Systems Overview I/O Hardware Application.
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.
بسم الله الرحمن الرحيم MEMORY AND I/O.
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.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Part IVI/O Systems Chapter 13: I/O Systems. I/O Hardware a typical PCI bus structure 2.
Chapter 13: I/O Systems.
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
Operating Systems (CS 340 D)
CSCI 315 Operating Systems Design
I/O Systems I/O Hardware Application I/O Interface
Operating Systems Chapter 5: Input/Output Management
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
CS703 - Advanced Operating Systems
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 13: I/O Systems.
Module 12: I/O Systems I/O hardwared Application I/O Interface
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

NETW 3005 I/O Systems

Reading For this lecture, you should have read Chapter 13 (Sections 1-4, 7). NETW3005 (Operating Systems) Lecture 10 - I/O Systems2

This Lecture: I/O systems Hardware: ports, buses, controllers Application I/O interface Kernel I/O services. NETW3005 (Operating Systems) Lecture 10 - I/O Systems3

Central issues How are I/O commands actually implemented? How does the O/S manage the wide range of I/O devices that are available? –Disks, CD/DVD drives, tapes … –Modems, network cards … –Screens, keyboards, mice, joysticks … NETW3005 (Operating Systems) Lecture 10 - I/O Systems4

What is a Device Driver? Each device has its own set of specialized commands that only its driver knows. A device driver is a system program that converts the system calls of the operating system into device specific commands. printers, video adapters, network cards, sound cards A device that controls the transfer of data from a computer to a peripheral device and vice versa. Example Graphics controller SCSI ( Small Computer system Interface) Controller– IDE ( Integrated Drive Electronics) Controller-

I/O Hardware – some background An I/O device is linked to a machine via a port. The link is normally a set of wires called a bus. At the end of the link, there’s a device controller, (basically, a processor.) A signal on a bus is basically a temporal sequence of voltages for each wire. NETW3005 (Operating Systems) Lecture 10 - I/O Systems7

I/O Hardware NETW3005 (Operating Systems) Lecture 10 - I/O Systems8 I/O device device controller port CPU bus voltage time

The PCI bus NETW3005 (Operating Systems) Lecture 10 - I/O Systems9 monitor graphics controller CPU memory/ controller cache memory disc PCI bus SCSI bus IDE disc controller disc expansion bus interface parallel port keyboard serial port disc

Device controller registers How does the CPU give commands to a device via a bus? –A device controller has a number of registers for holding signals. –The CPU can effectively write to and read from these. –Some registers hold data; some hold control signals. NETW3005 (Operating Systems) Lecture 10 - I/O Systems10

Device controller registers How can the CPU specify which device it’s giving commands to? –Each different port in the system has an address range. –The CPU can issue I/O instructions to particular addresses. NETW3005 (Operating Systems) Lecture 10 - I/O Systems11

Device I/O Port Locations on PCs (partial)

Some example controller registers A controller might have the following registers: –data-out: contains a byte of data. –status: contains a busy bit (indicating the controller’s state). –command: contains a command-ready bit (indicating CPU has sent some data) and a write bit (indicating direction of data flow). NETW3005 (Operating Systems) Lecture 10 - I/O Systems13

Programmed I/O and handshaking For each byte to be transferred to device: 1.The CPU reads the busy bit until it is clear. 2.The CPU sets the write bit and writes a byte to the data-out register. 3.The CPU sets the command-ready bit NETW3005 (Operating Systems) Lecture 10 - I/O Systems14

Programmed I/O and handshaking 4.The controller reads the command-ready bit until it is set. Then it sets the busy bit. 5.The controller reads the write command from the command register and then copies the data-out register to the device. 6.The controller clears the command-ready bit and then the busy bit. NETW3005 (Operating Systems) Lecture 10 - I/O Systems15

Polling and its Problems The step where the CPU cycles waiting for the busy bit to be clear is known as polling or busy waiting. If the CPU is polling, then its wastes CPU time. An alternative to polling is interrupts. NETW3005 (Operating Systems) Lecture 10 - I/O Systems16

Interrupts The CPU hardware contains a wire called the interrupt request line. The CPU tests this line after each instruction it executes. If a signal is detected, the CPU saves its current state and transfers control to interrupt handler. Interrupt handler process the interrupt and transfers the control to the CPU. If devices uses interrupt to communicate, then CPU doesn't need to poll. NETW3005 (Operating Systems) Lecture 10 - I/O Systems17

Types of interrupt Errors (exceptions) –divide by zero, invalid memory access, … Device-generated interrupts –device has read a byte; modem buffer full. Software interrupts (traps) –system call, context switch Some of these are more urgent than others. NETW3005 (Operating Systems) Lecture 10 - I/O Systems18

Interrupt priority levels One way of dealing with differing degrees of urgency is to provide two interrupt request lines: –maskable interrupts – device-generated interrupts and traps. These can be disabled. –nonmaskable interrupts: for signalling error messages. Never disabled. NETW3005 (Operating Systems) Lecture 10 - I/O Systems19

Direct Memory Access Programmed I/O (sending data byte-by- byte to a device) is laborious. For large chunks of data, direct memory access (DMA) is used. A DMA controller is a kind of processor that transfers data between I/O devices and memory without involving main processor (CPU) NETW3005 (Operating Systems) Lecture 10 - I/O Systems20

Direct Memory Access NETW3005 (Operating Systems) Lecture 10 - I/O Systems21 DMA operation needs the 1.channel number (which I/O device requires the DMA), 2.a beginning address in memory for the transfer, 3.the number of bytes to transfer, and 4.the direction of transfer (I/O to memory, or vice-versa) The processor starts the DMA activity with an ordinary I/O write to a control register in the DMA controller, then continues its work as usual When DMA activity is finished, DMA controller interrupts the processor

What is a Device Driver? Each device has its own set of specialized commands that only its driver knows. A device driver is a system program that converts the system calls of the operating system into device specific commands. printers, video adapters, network cards, sound cards A device that controls the transfer of data from a computer to a peripheral device and vice versa. Example Graphics controller SCSI ( Small Computer system Interface) Controller– IDE ( Integrated Drive Electronics) Controller-

The kernel-device interface How does the O/S manage the huge range of possible I/O devices? Clearly, we don’t want to rewrite the kernel every time we add a new device. We therefore need to impose a standard interface protocol on devices. NETW3005 (Operating Systems) Lecture 10 - I/O Systems23

The kernel-device interface The method for doing this is to encapsulate device-specific information in special kernel modules called device drivers. These device drivers translate system calls into device-specific commands. NETW3005 (Operating Systems) Lecture 10 - I/O Systems24

Device drivers and controllers There’s a one-to-one mapping between device drivers and device controllers. –Device drivers are software. –Device controllers are hardware. NETW3005 (Operating Systems) Lecture 10 - I/O Systems25

Types of I/O device I/O devices vary widely, along several dimensions. –Character stream versus block. –Sequential versus random access. –Synchronous versus asynchronous. –Shareable versus dedicated. OSs work with a small set of device types which can execute a standard set of commands. NETW3005 (Operating Systems) Lecture 10 - I/O Systems26

Character devices character devices relate to devices through which the system transmits data one character at a time. (Get and Put) Example Key boards serial modem

Block devices Block devices correspond to devices through which the system moves data in the form of blocks. Example : addressable devices hard disks, CD-ROM drives, or memory-regions. The standard commands necessary for a block device are: –Read block, –Write block, –Seek block (for random-access block devices). NETW3005 (Operating Systems) Lecture 10 - I/O Systems28

Network devices, e.g. sockets The standard commands for a socket: –Create socket –Connect local socket to remote socket –Listen for remote applications to local socket –Send information to a socket –Receive information from a socket Select – monitors a set of sockets. NETW3005 (Operating Systems) Lecture 10 - I/O Systems29 A socket is one endpoint of a two-way communication link between two programs running on the network.

Ip address +port Of server Ip address +port Of client

Blocking and nonblocking I/O There’s an important distinction between blocking and nonblocking I/O system calls. –If a process issues a blocking I/O system call, it waits until the I/O is completed. –If a process issues a nonblocking I/O call, it waits for a fixed interval, and then returns. –If a process issues an asynchronous I/O call, the I/O operation occurs in full, but the process doesn’t wait for it. NETW3005 (Operating Systems) Lecture 10 - I/O Systems31

Differences? In nonblocking I/O, you know how long the I/O is going to take, but you don’t know if all the data will be transferred. In asynchronous I/O, you know all the data will be transferred but you don’t know how long it will take, so you don’t know where you’ll be in your program when it comes back. NETW3005 (Operating Systems) Lecture 10 - I/O Systems32

Examples? Blocking I/O –disk reads. (The standard situation.) Non-blocking I/O –reads from a mouse, joystick, real-time video. Asynchronous I/O –printing something. NETW3005 (Operating Systems) Lecture 10 - I/O Systems33

Kernel I/O services So far, we have demonstrated the use of device drivers for the kernel. But we haven’t really explained why there should be an I/O subsystem. Why not just interface straight to the device drivers? NETW3005 (Operating Systems) Lecture 10 - I/O Systems34

Kernel I/O services In fact, there are several services performed by the I/O subsystem before the device drivers are called. –I/O Scheduling, –I/O Buffering, –Spooling. NETW3005 (Operating Systems) Lecture 10 - I/O Systems35

I/O scheduling At any one time, there might be several requests for I/O waiting to be serviced. We could just do these in first-come- first-served order. Disadvantages with this scheme? –Let’s say the disk arm is currently near the beginning of a disk, and there are 5 I/O requests: 3 for places near the beginning and 2 for places near the end. NETW3005 (Operating Systems) Lecture 10 - I/O Systems36

I/O buffering A buffer is used to provide communication between two processes with different speeds. In the consumer/producer problem, assume that the consumer process is faster than the producer process. –Producer fills up the buffer, switches to a second buffer and signals the consumer; –Consumer reads full buffer, then waits. NETW3005 (Operating Systems) Lecture 10 - I/O Systems37

Spooling A spool is a buffer that holds output for a device that cannot accept interleaved data streams - e.g. a printer. Rather than sending data straight to the printer, the O/S stores the data in buffers. The printer can then process the output from one buffer at a time. NETW3005 (Operating Systems) Lecture 10 - I/O Systems38