Input/Output The messiest part of O.S.

Slides:



Advertisements
Similar presentations
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Advertisements

Chapter 5 Input/Output 5.4 Disks
Principles of I/O Hardware I/O Devices Block devices, Character devices, Others Speed Device Controllers Separation of electronic from mechanical components.
Mehdi Naghavi Spring 1386 Operating Systems Mehdi Naghavi Spring 1386.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Chapter 5 Input/Output 5.1 Principles of I/O hardware
INPUT-OUTPUT ORGANIZATION
1 Pertemuan 19 Disk Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5 OFFCLASS03.
Avishai Wool lecture Introduction to Systems Programming Lecture 8 Input-Output.
Part 5 (Stallings) Input/Output 5.1 Principles of I/O hardware
1 Input/Output Chapter Principles of I/O hardware 5.2 Principles of I/O software 5.3 I/O software layers 5.4 Disks 5.5 Clocks 5.6 Character-oriented.
EEE 435 Principles of Operating Systems Principles and Structure of I/O Software (Modern Operating Systems 5.2 & 5.3) 5/22/20151Dr Alain Beaulieu.
Lecture 7b I/O. I/O devices  Device (mechanical hardware)  Device controller (electrical hardware)  Device driver (software)
Chapter 5 Input/Output Clocks User Interfaces: Keyboard, Mouse Power.
Operating Systems Input/Output Devices (Ch , 12.7; , 13.7)
1 Pertemuan 18 Input / Output (lanjutan) Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5.
Operating System - Overview Lecture 2. OPERATING SYSTEM STRUCTURES Main componants of an O/S Process Management Main Memory Management File Management.
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.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Pertemuan 20 Character oriented terminal
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.
Chapter 5 Input/Output I/O Hardware I/O Software Software Layers Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights.
Input/Output and Communication
Operating Systems Input/Output Devices (Ch 5: )
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 ORGANIZATION
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.
1 Input/Output. 2 Principles of I/O Hardware Some typical device, network, and data base rates.
Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved OPERATING SYSTEMS DESIGN.
Chapter 8 Input/Output. Busses l Group of electrical conductors suitable for carrying computer signals from one location to another l Each conductor in.
IO and RAID.
1 I/O and Filesystems. 2 How to provide interfaces Rough reading guide (no exam guarantee): Tanenbaum Ch. 5.1 – 5.5 & Silberschatz Ch. 13 & ,
Cpr E 308 Input/Output Recall: OS must abstract out all the details of specific I/O devices Today –Block and Character Devices –Hardware Issues – Programmed.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Segmentation & O/S Input/Output Chapter 4 & 5 Tuesday, April 3, 2007.
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.
Sistem Operasi IKH311 Masukan Luaran (Input/Output)
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.
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.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent University.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 9-2: Disk Scheduling Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
12/8/20151 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
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.
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 9-1: Disk Scheduling Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Input/Output Chapter 5 Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
1 Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and.
Introduction to Operating Systems Concepts
I/O Management.
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
Multiple Platters.
Operating Systems (CS 340 D)
CS 286 Computer Organization and Architecture
CS703 - Advanced Operating Systems
Operating Systems Chapter 5: Input/Output Management
CS703 - Advanced Operating Systems
Clock hardware Chapter 5 CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)
Chapter 5: I/O Systems.
Chapter 13: I/O Systems.
Presentation transcript:

Input/Output The messiest part of O.S. Chap11 Input/Output The messiest part of O.S.

Speed difference of I/O Hardware

Device Controllers I/O devices have components: mechanical component electronic component The electronic component is the device controller may be able to handle multiple devices Controller's tasks convert serial bit stream to block of bytes perform error correction as necessary make available to main memory

Memory-Mapped I/O (1) Separate I/O and memory space Memory-mapped I/O Hybrid

Memory-Mapped I/O (2) (a) A single-bus architecture (b) A dual-bus memory architecture

I/O Architecture Several types of bus,such as ISA, EISA,PCI and MCA, are currently in use. data bus – the pentium has 64 bit wide data bus Address bus – Control bus – a group of lines that transmit control information to the connected circuits. The Pentium uses control lines to specify, for example, whether the bus is used to allow data transfers between a processor and the RAM, or alternatively, between a processor and an I/O device.

PC’s I/O architecture CPU I/O bus I/O Port I/O Port I/O Interface I/O Controller

PC’s I/O architecture When a bus connects to the CPU to an I/O device, it is called an I/O bus. 80x86 use 16 out of the 32 address lines to address I/O devices and 8,16, or 32 out of the 64 data lines to transfer data

I/O ports Each device connected to the I/O bus has its own I/O address, which are usually called I/O ports PC provides up to 65536 8-bits I/O ports. Two consecutive 8-bit ports may be regarded as a single 16-bit port. Four assembly instructions in,ins,out,outs allow CPU to read and write into an I/O port

Memory mapped I/O ports in PC PC’s device I/O ports may also be mapped into address of physical address space. O.S. can use mov instruction that operate directly on memory. Modern hardware devices are more suited to mapped I/O, since it is faster and can be combined with DMA

I/O and registers The I/O ports of each device are actually structured into a set of specialized registers CPU write commands to control registers CPU reads a value that represents the internal state of the device from status register CPU fetch data from a device by reading input register CPU push data to device by writing bytes into output registers

Specialized I/O ports Control register Device’s Status register CPU I/O Interface CPU Status register input register Output register

To lower costs, the same I/O port is often used for different purposes To lower costs, the same I/O port is often used for different purposes. e.g., some bits describe the device state and others are used to specify commands. e.g., the same I/O ports may be used as an input register or an output register

What is an I/O interface? An I/O interface is a hardware circuit inserted between a group of I/O ports and the corresponding device controller. It acts as an interpreter that translates the values in the I/O ports into commands and data for the device.

Types of I/O interfaces Custom I/O interfaces devoted to one specific hardware device usually, the device controller is on the same card of I/O interfaces. General-purpose I/O interface used to connect several different hardware devices

Custom I/O interfaces Keyboard interface Graphic interface Disk interface Network interface

General –purpose I/O interface Parallel port traditionally connected to printers, but can also be connected to removable disks, scanners Serial port one bit at a time use UART chip (Universal Asynchronous Receiver and Transmitter) to string out the bytes into a sequence of bits. Universal serial bus (USB) PCMCIA interface SCSI (Small Computer System Interface) Interface

Device Controller It interprets the high-level commands received from the I/O interface and force the device to execute specific actions by sending proper sequence of electrical signals It converts and properly interprets the electrical signals received from the device and modifies (through the I/O interface) the value of the status register

I/O shared memory Several hardware device sometimes include their own memory, which is often called I/O shared memory. E.g. graphic cards.

PC’s mapping addresses of I/O shared memory For device connected to ISA bus mapped into physical address from 0xa0000 to 0xfffff: a hole between 640K-1MB. These are reserved page frames For some old devices using VESA Local bus 0xe00000 to 0xffffff : 14MB-16MB going out of production For device connected to PCI bus is mapped into very large physical address, well above the end of RAM’s physical address. Much simpler to handle AGP (Accelerated Graphics Port) use a special hardware circuit GART (Graphics Address Remapping Table) GART enables AGP to sustain much higher data transfer rate.

Direct Memory Access (DMA) Operation of a DMA transfer

Interrupts Revisited How interrupts happens. Connections between devices and interrupt controller actually use interrupt lines on the bus rather than dedicated wires

Principles of I/O Software Goals of I/O Software (1) Device independence programs can access any I/O device without specifying device in advance (floppy, hard drive, or CD-ROM) Uniform naming name of a file or device a string or an integer not depending on which machine Error handling handle as close to the hardware as possible

Goals of I/O Software (2) Synchronous vs. asynchronous transfers blocked transfers vs. interrupt-driven Buffering data coming off a device cannot be stored in final destination Sharable vs. dedicated devices disks are sharable tape drives would not be

Steps in printing a string Programmed I/O (1) Steps in printing a string

Writing a string to the printer using programmed I/O

Interrupt-Driven I/O Writing a string to the printer using interrupt-driven I/O Code executed when print system call is made Interrupt service procedure

I/O Using DMA Printing a string using DMA code executed when the print system call is made interrupt service procedure

Layers of the I/O Software System I/O Software Layers Layers of the I/O Software System

Interrupt Handlers (1) Interrupt handlers are best hidden have driver starting an I/O operation block until interrupt notifies of completion Interrupt procedure does its task then unblocks driver that started it Steps must be performed in software after interrupt completed Save regs not already saved by interrupt hardware Set up context for interrupt service procedure

Interrupt Handlers (2) Set up stack for interrupt service procedure Ack interrupt controller, reenable interrupts Copy registers from where saved Run service procedure Set up MMU context for process to run next Load new process' registers Start running the new process

Device Drivers Logical position of device drivers is shown here Communications between drivers and device controllers goes over the bus

Device-Independent I/O Software (1) Uniform interfacing for device drivers Buffering Error reporting Allocating and releasing dedicate devices Providing a device-independent block size Functions of the device-independent I/O software

Device-Independent I/O Software (2) (a) Without a standard driver interface (b) With a standard driver interface

Device-Independent I/O Software (3) (a) Unbuffered input (b) Buffering in user space (c) Buffering in the kernel followed by copying to user space (d) Double buffering in the kernel

Device-Independent I/O Software (4) Networking may involve many copies

User-Space I/O Software Layers of the I/O system and the main functions of each layer

UNIX I/O (1)/Device Driver Some of the fields of a typical cdevsw table

The UNIX I/O system in BSD

An example of streams in System V

Disk Hardware (1) Disk parameters for the original IBM PC floppy disk and a Western Digital WD 18300 hard disk

Disk Hardware (2) Physical geometry of a disk with two zones A possible virtual geometry for this disk

Disk Hardware (3) Raid levels 0 through 2 Backup and parity drives are shaded

Disk Hardware (4) Raid levels 3 through 5 Backup and parity drives are shaded

Disk Hardware (5) Recording structure of a CD or CD-ROM

Logical data layout on a CD-ROM Disk Hardware (6) Logical data layout on a CD-ROM

Disk Hardware (7) Cross section of a CD-R disk and laser not to scale Silver CD-ROM has similar structure without dye layer with pitted aluminum layer instead of gold

A double sided, dual layer DVD disk Disk Hardware (8) A double sided, dual layer DVD disk

Disk Formatting (1) A disk sector

An illustration of cylinder skew Disk Formatting (2) An illustration of cylinder skew

Disk Formatting (3) No interleaving Single interleaving Double interleaving

Disk Arm Scheduling Algorithms (1) Time required to read or write a disk block determined by 3 factors Seek time Rotational delay Actual transfer time Seek time dominates Error checking is done by controllers

Disk Arm Scheduling Algorithms (2) Initial position Pending requests Shortest Seek First (SSF) disk scheduling algorithm

Disk Arm Scheduling Algorithms (3) The elevator algorithm for scheduling disk requests

Error Handling A disk track with a bad sector Substituting a spare for the bad sector Shifting all the sectors to bypass the bad one

Analysis of the influence of crashes on stable writes Stable Storage Analysis of the influence of crashes on stable writes

Clocks Clock Hardware A programmable clock

Three ways to maintain the time of day Clock Software (1) Three ways to maintain the time of day

Simulating multiple timers with a single clock Clock Software (2) Simulating multiple timers with a single clock

Soft Timers A second clock available for timer interrupts specified by applications no problems if interrupt frequency is low Soft timers avoid interrupts kernel checks for soft timer expiration before it exits to user mode how well this works depends on rate of kernel entries

Character Oriented Terminals RS-232 Terminal Hardware An RS-232 terminal communicates with computer 1 bit at a time Called a serial line – bits go out in series, 1 bit at a time Windows uses COM1 and COM2 ports, first to serial lines Computer and terminal are completely independent

Input Software (1) Central buffer pool Dedicated buffer for each terminal

Characters handled specially in canonical mode Input Software (2) Characters handled specially in canonical mode

Output Software The ANSI escape sequences accepted by terminal driver on output ESC is ASCII character (0x1B) n,m, and s are optional numeric parameters

Display Hardware (1) Memory-mapped displays Parallel port Memory-mapped displays driver writes directly into display's video RAM

Display Hardware (2) A video RAM image Corresponding screen simple monochrome display character mode Corresponding screen the xs are attribute bytes

Input Software Keyboard driver delivers a number driver converts to characters uses a ASCII table Exceptions, adaptations needed for other languages many OS provide for loadable keymaps or code pages

Output Software for Windows (1) Sample window located at (200,100) on XGA display

Output Software for Windows (2) Skeleton of a Windows main program (part 1)

Output Software for Windows (3) Skeleton of a Windows main program (part 2)

Output Software for Windows (4) An example rectangle drawn using Rectangle

Output Software for Windows (5) Copying bitmaps using BitBlt. before after

Output Software for Windows (6) Examples of character outlines at different point sizes

Network Terminals X Windows (1) Clients and servers in the M.I.T. X Window System

Skeleton of an X Windows application program

The SLIM Network Terminal (1) The architecture of the SLIM terminal system

The SLIM Network Terminal (2) Messages used in the SLIM protocol from the server to the terminals

Power consumption of various parts of a laptop computer Power Management (1) Power consumption of various parts of a laptop computer

Power management (2) The use of zones for backlighting the display

Power Management (3) Running at full clock speed Cutting voltage by two cuts clock speed by two, cuts power by four

Power Management (4) Telling the programs to use less energy Examples may mean poorer user experience Examples change from color output to black and white speech recognition reduces vocabulary less resolution or detail in an image