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.

Slides:



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

Principles of I/O Hardware I/O Devices Block devices, Character devices, Others Speed Device Controllers Separation of electronic from mechanical components.
EEE 435 Principles of Operating Systems Structure of I/O Software Pt II (Modern Operating Systems & 5.3.4)
EEE 435 Principles of Operating Systems Operating System Concepts (Modern Operating Systems 1.5)
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.
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.
Operating Systems Input/Output Devices (Ch , 12.7; , 13.7)
Operating System - Overview Lecture 2. OPERATING SYSTEM STRUCTURES Main componants of an O/S Process Management Main Memory Management File Management.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
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)
OS Spring’03 Introduction Operating Systems Spring 2003.
1 I/O Devices Controller: physically controls the devices Devices are diverse and complicated Present simpler interface to OS E.g, convert a linear sector.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Memory Management, File Systems, I/O How Multiprogramming Issues Mesh ECEN 5043 Software Engineering of Multiprogram Systems University of Colorado, Boulder.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output – 3 I/O Software CS 342 – Operating Systems Ibrahim Korpeoglu.
CHAPTER 9: Input / Output
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.
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.
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
1 Input/Output. 2 Principles of I/O Hardware Some typical device, network, and data base rates.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
CHAPTER 9: Input / Output
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.
Sistem Operasi IKH311 Masukan Luaran (Input/Output)
CSC 322 Operating Systems Concepts Lecture - 25: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
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:
I/O Systems I/O Hardware Application I/O Interface
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.
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.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.
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.
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.
12/8/20151 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Silberschatz, Galvin and Gagne  Operating System Concepts Six Step Process to Perform DMA Transfer.
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.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output – 2 I/O Software CS 342 – Operating Systems Ibrahim Korpeoglu.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 13: I/O Systems Overview I/O Hardware Application.
Input/Output Chapter 5 Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Fall 2000M.B. Ibáñez Lecture 26 I/O Systems II. Fall 2000M.B. Ibáñez Application I/O Interface I/O system calls encapsulate device behaviors in generic.
I/O Software CS 537 – Introduction to Operating Systems.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
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.
Processes and threads.
Lesson Objectives Aims Key Words Interrupt, Buffer, Priority, Stack
CS703 - Advanced Operating Systems
Operating Systems Chapter 5: Input/Output Management
CS703 - Advanced Operating Systems
Chapter 5: I/O Systems.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Chapter 5 Input/Output Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
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:

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

5/22/2015Dr Alain Beaulieu Quick Review What is burst mode? On which stack is the state of the system saved when an interrupt occurs? 2

5/22/2015Dr Alain Beaulieu Outline Principles and goals of I/O software I/O Methods I/O Software Structure (Part I) 3

5/22/2015Dr Alain Beaulieu Principles/Goals of I/O Software Device Independence Should be possible to write programs that can access any I/O device without having to specify the device in advance For example: your program should not be substantially different (if at all!) if you open a file on floppy, hard drive, or CD-ROM 4

5/22/2015Dr Alain Beaulieu Principles/Goals of I/O Software Uniform Naming The name of a file or device should be a string or integer and not depend on the device in any way Does the Windows system achieve this goal? Error Handling Errors should be handled as close to the hardware as possible ie: controller->device driver->and upwards Many I/O errors are transient; trying again will generally remove the error 5

5/22/2015Dr Alain Beaulieu Principles/Goals of I/O Software Synchronous vs Asynchronous transfers At the physical level, most I/O is asynchronous The device signals an interrupt when ready For the user, the program is usually much easier to create if the I/O is synchronous (ie: blocking) It is up to the operating system to make asynchronous transfers appear blocking to the user 6

5/22/2015Dr Alain Beaulieu Principles/Goals of I/O Software Buffering Data that comes off a device must often be collected before being given to its final destination For example, a packet from a network must be examined to determine which process requested the packet Data going to a device might also be buffered. For example: mp3 player must have data ready to read at all times This decouples the fill rate from the empty rate 7

5/22/2015Dr Alain Beaulieu Principles/Goals of I/O Software Sharable vs. Dedicated Devices Some devices, such as disks, can be shared by multiple processes simultaneously. Multiple files can be opened at the same time without problem Other devices, such as tape drives or CD burners may only have a single user until their job is complete Dedicated devices also introduce the problem of deadlocks 8

5/22/2015Dr Alain Beaulieu How is I/O Performed? Three methods: Programmed I/O Interrupt-Driven I/O DMA This is from the point of view of the software, although it may involve some hardware issues... 9

5/22/2015Dr Alain Beaulieu How is I/O Performed? Programmed I/O This is I/O through busy waiting The OS has a process sitting in a loop, checking to see if the device is ready to communicate and sending/receiving information as required 10

5/22/2015Dr Alain Beaulieu How is I/O Performed? Programmed I/O This method is simple to implement, but ties up the CPU full time (if not using a process to print) or a lot of CPU cycles If wait time is short (ie: printing goes to a buffer inside the printer) this could be acceptable 11

5/22/2015Dr Alain Beaulieu How is I/O Performed? Interrupt-Driven I/O This method allows the CPU to do other work while I/O is pending As before, the information to be printed is copied to kernel space The printer is then fed the first character and the scheduler called to run another process (part of system call) When the printer is ready for a character, an interrupt is generated and the printer interrupt service procedure executed 12

5/22/2015Dr Alain Beaulieu How is I/O Performed? Interrupt-Driven I/O If the ISP notes that there are no characters left to print the user process is unblocked Could be through a message, semaphore, etc 13

5/22/2015Dr Alain Beaulieu How is I/O Performed? I/O Using DMA Big gain: this allows only one interrupt per transfer – when the I/O is complete! It is essentially using programmed I/O again, but the DMA controller is doing the work instead of the CPU If the CPU is usually idle, then this method is less efficient than interrupts. Why? 14

5/22/2015Dr Alain Beaulieu I/O Software has Layers (like Ogres) How is I/O software organized? Four levels, each more abstract from the hardware than the previous Each layer has a well defined interface to its adjacent layer 15

5/22/2015Dr Alain Beaulieu I/O Software has Layers (like Ogres) Interrupt Handlers Interrupts must be used for at least part of dealing with I/O and should be hidden as far away from the user as possible, “in the bowels of the operating system” Best way to deal with them is to have the driver block itself with a semaphore, a wait condition on a variable, a receive on a message, or some similar method When the interrupt arrives, the driver is unblocked/messaged/etc... 16

5/22/2015Dr Alain Beaulieu I/O Software has Layers (like Ogres) Interrupt Handlers Of course, it isn’t that simple. Much more has to be accomplished when responding to an interrupt Save any registers that were not saved by hardware Set up TLB, MMU, page table, and stack for the ISR Acknowledge the interrupt controller (or device if none) Copy the registers from where they were saved to the process table Run the ISR (get device info, unblock the driver, etc) Choose next process to run and set up the MMU, TLB, registers, PSW, PC, etc for that process Start running the newly selected process 17

5/22/2015Dr Alain Beaulieu I/O Software has Layers (like Ogres) Device Drivers Each I/O device attached to the computer requires specific code to control it known as the device driver This is because, at the hardware level, devices look radically different from one another Sometimes one driver will handle a class of closely related devices. eg: a number of mice The device driver is generally written by the device manufacturer and for a number of popular operating systems 18

5/22/2015Dr Alain Beaulieu I/O Software has Layers (like Ogres) Device Drivers Typically, drivers live in the kernel so they can access the control registers of the device This isn’t a requirement. You could have device drivers in user space and have system calls for register communication. However, it is “the state of the practice” Given that this is usually the method of implementing drivers, the standard architecture is to have the drivers “below” the bulk of the OS 19

5/22/2015Dr Alain Beaulieu I/O Software has Layers (like Ogres) Not shown, but OSs usually require all block devices to support a standard set of interfaces and all character devices to support a different set 20

5/22/2015Dr Alain Beaulieu I/O Software has Layers (like Ogres) What do device drivers do? Accept the abstract read/write commands from the layer above Assorted functions: Initialize the device Manage its power 21

5/22/2015Dr Alain Beaulieu I/O Software has Layers (like Ogres) What does a driver do on a read/write? Check input parameters & return errors Convert abstract commands (read from sector) to physical terms (head, track, sector, and cylinder) Queue requests if device is busy Bring device to running status,if required May need to get motor up to speed, etc... Control the device by issuing a number of commands to it through the control registers 22

5/22/2015Dr Alain Beaulieu I/O Software has Layers (like Ogres) What does a driver do on a read/write? Once request is issued one of two situations will occur: The driver must wait for the request to complete, so it blocks. It will be awakened later, as described in the section on interrupts The result is instantaneous(eg: writing to screen memory) so work is continued until all I/O is complete 23

5/22/2015Dr Alain Beaulieu I/O Software has Layers (like Ogres) Device Driver real-world complications: Interrupt received for driver while performing I/O May happen where a network packet being assembled and a new packet is received Driver code must be reentrant in this case Devices may be added/removed while computer is running 24

5/22/2015Dr Alain Beaulieu Quiz Time! Questions? 25