CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output – 2 I/O Software CS 342 – Operating Systems Ibrahim Korpeoglu.

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.
Categories of I/O Devices
EEE 435 Principles of Operating Systems Structure of I/O Software Pt II (Modern Operating Systems & 5.3.4)
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)
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.
Architectural Support for Operating Systems. Announcements Most office hours are finalized Assignments up every Wednesday, due next week CS 415 section.
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)
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Memory Management CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent University.
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.
Memory Management, File Systems, I/O How Multiprogramming Issues Mesh ECEN 5043 Software Engineering of Multiprogram Systems University of Colorado, Boulder.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output – 5 Disks CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent.
Device Management.
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.
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.
UQC113S2 Interrupt driven IO. We have already seen the hardware support required to facilitate interrupts We will now look at the higher levels of software.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
Input / Output CS 537 – Introduction to Operating Systems.
1 Input/Output. 2 Principles of I/O Hardware Some typical device, network, and data base rates.
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.
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)
Hardware Definitions –Port: Point of connection –Bus: Interface Daisy Chain (A=>B=>…=>X) Shared Direct Device Access –Controller: Device Electronics –Registers:
ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-2: I/O Management (Review) Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
I/O Systems I/O Hardware Application I/O Interface
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.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent University.
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,
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.
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.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
I/O Software CS 537 – Introduction to Operating Systems.
1 Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and.
Input/Output (I/O) Important OS function – control I/O
Lecture 13 Input/Output (I/O) Systems (chapter 13)
I/O Management.
Module 12: I/O Systems I/O hardware Application I/O Interface
Input/Output.
CS703 - Advanced Operating Systems
CSCI 315 Operating Systems Design
© CHAROTAR INSTITUTE OF TECHNOLOGY, CHANGA
CPSC 457 Operating Systems
Module 2: Computer-System Structures
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 5: I/O Systems.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Module 2: Computer-System Structures
Chapter 13: I/O Systems.
Module 12: I/O Systems I/O hardwared Application I/O Interface
Presentation transcript:

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output – 2 I/O Software CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent University Department of Computer Engineering

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 2 Goals of I/O Software Device Independence  It should be possible to write programs that can access any I/O device without having to specify the device in advance and without knowing the internal details of the device. A program reading a file should be able to read that file  From a floppy drive  From a hard disk  From a tape drive  From a CD-ROM The programmer should not remodify its program for each device

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 3 Goals of I/O Software Uniform Naming  Access to all files and devices should be done by a uniform naming scheme. /usr/home/ali/project.c is a pathname and filename that specifies a file which can be read and written. /mnt/floppy is a pathname that specifies the floppy drive which can be read and written.  Therefore pathnames are uniform naming schemes that can be used to refer to any device or file.

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 4 Goals of I/O Software Error handling  Errors need to be handled at the lower layer possible At the controller if possible At the device drivers of possible Then at the application  Example: reading a disk block Controller computes the checksum. Detect the errors. Tries to correct them if it can. If controller can not correct a block error, device driver requests the disk controller to retrieve the same block again, hoping that this time the block will not be erroneous.

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 5 Goals of I/O Software Synchronous versus Asynchronous Transfers  I/O hardware operates in an asynchronous manner. CPU issues a request to read a block. Disk controller retries the block and then interrupts the CPU Asynchronous I/O is interrupt driven.  Programs are easily written of they use synchronous I/O A read() function in a program will block until the data is available. Application programmers can not easily program using interrupts. Synchronous I/O is blocking I/O  Operating System should implement synchronous I/O model for applications using the underlying asynchronous I/O model of the hardware.

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 6 Goals of I/O Software Buffering  Operating System should buffer data The speed at which application reads or writes data can not always match the speed at which the data is transferred to or from devices Sharing or Devices  Some devices are sharable by many users at the same time: hard disk.  Some devices are dedicates to a single user while he/she is using the device: tape, printer, etc.  OS should manage these devices and deal with deadlocks that are the result of using dedicated devices.

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 7 Programming Input and Output Three methods  Programmed I/O  Interrupt driven I/O  I/O using DMA

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 8 Programmed I/O In programmed I/O, CPU is always busy with I/O until I/O gets completed.  Fine for single process systems MS-DOS Embedded systems  But not a good approached for multi-programing and time-sharing systems

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 9 Programmed I/O - Example Assume a program that wants to print a string to a printer. Assume string is “ABCDEFGH”  8 character long string Assume printer has 1 byte of data buffer to put the character that needs to be printed.

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 10 Application Program Printed Page (empty) Kernel BUS Printer Controller Main Memory User Address Space Kernel Address Space ABCDEFGH Application Buffer Kernel Buffer String to be printed datastatus REG CPU registers CPU Controller registers

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 11 Application Program Printed Page (empty) Kernel BUS Printer Controller Main Memory ABCDEFGH Data is copied into Kernel Buffer datastatus REG CPU

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 12 Application Program Kernel BUS Printer Controller Main Memory ABCDEFGH datastatus REG CPU A (1) (2) (3-4) REGA A

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 13 Application Program Kernel BUS Printer Controller Main Memory ABCDEFGH datastatus REG CPU A (3-4) REG A A

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 14 Application Program Kernel BUS Printer Controller Main Memory ABCDEFGH datastatus REG CPU A REGB B (1) (2) B (3-4) B

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 15 Application Program Kernel BUS Printer Controller Main Memory ABCDEFGH datastatus REG CPU A REGC C B C C

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 16 Application Program Kernel BUS Printer Controller Main Memory ABCDEFGH datastatus REG CPU A REGD D B D CD

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 17 Application Program Kernel BUS Printer Controller Main Memory ABCDEFGH datastatus REG CPU A REGE E B E CD E

CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University 18 How would we implement copy in kernel! /* buffer is user buffer p is kernel buffer count is number of bytes to be copied */ copy_from_user(buffer, p, count) { for (i=0; i < count; ++i) /* loop in every character */ { while (*printer_status_register != READY) {}; /*busy waiting – loop until ready*/ *printer_data_register = p[i]; /* output one character */ } return_to_user(); }