Outline Device Management Device Manager Design Buffering

Slides:



Advertisements
Similar presentations
I/O Management and Disk Scheduling
Advertisements

Chapter 6 I/O Systems.
I/O Management and Disk Scheduling
Principles of I/O Hardware I/O Devices Block devices, Character devices, Others Speed Device Controllers Separation of electronic from mechanical components.
I/O Management and Disk Scheduling
Device Management Ankur Saggar Nitin Golait Jason Foos Adam Estabrook.
CT213 – Computing system Organization
Slide 5-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 5 5 Device Management.
Device Management.
Slide 5-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 5 5 Device Management.
Input/Output Management and Disk Scheduling
Operating Systems Input/Output Devices (Ch , 12.7; , 13.7)
04/18/2007CSCI 315 Operating Systems Design1 Mass Storage Structure Notice: The slides for this lecture have been largely based on those accompanying the.
5 Device 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)
Slide 5-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 5.
Device Management.
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.
Copyright ©: Nahrstedt, Angrave, Abdelzaher
Device Management. Serial Port Serial Device Serial Device Memory CPU Printer Terminal Modem Mouse etc.
1 I/O Management and Disk Scheduling Chapter Categories of I/O Devices Human readable Used to communicate with the user Printers Video display terminals.
I/O Management and Disk Structure Introduction to Operating Systems: Module 14.
Slide 5-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 5.
Slide 5-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 5 5 Device Management.
Slide 5-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 5.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Slide 5-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 5.
I/O Management and Disk Scheduling Chapter 11. Categories of I/O Devices Human readable Used to communicate with the user  Printers, Display terminals,
Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating.
Slide 5-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 5 5 Device Management.
© 2004, D. J. Foreman 1 Device Mgmt. © 2004, D. J. Foreman 2 Device Management Organization  Multiple layers ■ Application ■ Operating System ■ Driver.
© 2004, D. J. Foreman 1 Device Mgmt. © 2004, D. J. Foreman 2 Device Management Organization  Multiple layers ■ Application ■ Operating System ■ Driver.
Device Management Mark Stanovich Operating Systems COP 4610.
1 Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and.
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 2: Computer-System Structures(Hardware)
Chapter 2: Computer-System Structures
Sarah Diesburg Operating Systems CS 3430
I/O SYSTEMS MANAGEMENT Krishna Kumar Ahirwar ( )
Multiple Platters.
Input/Output Devices ENCE 360
I/O System Chapter 5 Designed by .VAS.
Operating Systems (CS 340 D)
Operating System I/O System Monday, August 11, 2008.
I/O system.
CS703 - Advanced Operating Systems
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Computer Architecture
Module 2: Computer-System Structures
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
Module 2: Computer-System Structures
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Device Mgmt © 2004, D. J. Foreman.
Chapter 2: Computer-System Structures
Device Mgmt © 2004, D. J. Foreman.
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Chapter 13: I/O Systems.
Module 12: I/O Systems I/O hardwared Application I/O Interface
Andy Wang Operating Systems COP 4610 / CGS 5765
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:

Outline Device Management Device Manager Design Buffering Device Drivers I/O Strategies Polling vs. interrupt-driven I/O Device Manager Design Buffering Optimizing Access for Rotating Devices Device Management in Linux

Announcements We are going to have a quiz at the end of the class on Sept. 18, 2003 It will be a closed book and closed notes quiz It will cover System calls and how to use them Lecture notes up to Today (Sept. 16) Related materials in the book Tomorrow’s recitation session is optional You are not required to come I will mainly answer questions related to Lab 1 4/6/2019 COP4610

Review: Device Drivers The part of OS that implements device management is called collectively as device manager, which includes device drivers and device driver infrastructure Device drivers can be complex However, the drivers for different devices implement a similar interface so that a higher-level component has a uniform interface for different devices 4/6/2019 COP4610

Device Management Organization Application Process File Manager Device Controller Command Status Data Hardware Interface System Interface Device-Independent Device-Dependent 4/6/2019 COP4610

Review: Direct I/O vs. Direct-Memory Access 4/6/2019 COP4610

Review: I/O Strategies – cont. Direct I/O or DMA for data transferring Polling or interrupt-driven I/O strategies Direct I/O with polling DMA I/O with polling Not supported in general Direct I/O with interrupts DMA I/O with interrupts 4/6/2019 COP4610

Review: Direct I/O with Polling read(device, …); Data Device Controller Command Status read function write function 1 2 3 4 5 Hardware Interface System Interface 4/6/2019 COP4610

Device Controllers – cont. Command Status Data 0 Data 1 Data n-1 Logic busy done Error code . . . busy done 0 0 idle 0 1 finished 1 0 working 1 1 (undefined) 4/6/2019 COP4610

Review: Interrupt-Driven I/O read(device, …); Data Device Controller Command Status read driver write driver 1 2 3 4 5 Hardware Interface System Interface Device Status Table Device Handler Interrupt 6 7 8a 8b 9 4/6/2019 COP4610

Review: Interrupt Handling At the end of each instruction cycle, we check if an interrupt has occurred 4/6/2019 COP4610

Interrupt-Driven Direct-Memory Access – cont. 4/6/2019 COP4610

Interrupt-Driven Versus Polling In general, an interrupt-driven system will have a higher CPU utilization than a polling-based system The CPU time on polling by one process may be utilized by another process to perform computation 4/6/2019 COP4610

Comparison of Polling and Interrupt-Driven I/O Performance Polling is normally superior from the viewpoint of a single process Because overhand of polling is less Interrupt-driven I/O approach gives better overall system performance 4/6/2019 COP4610

I/O-CPU Overlap Through interrupt-driven I/O 4/6/2019 COP4610

I/O-CPU Overlap – cont. Sequential operation and overlapped operation 4/6/2019 COP4610

I/O-CPU Overlap – cont. - I/O-CPU overlap through overlapped operation and polling 4/6/2019 COP4610

I/O-bound and Compute-bound Processes I/O-bound process A process’s overall execution time is dominated by the time to perform I/O operations Compute-bound process A process’s time on I/O is small compared to the amount of time spent using the CPU Many processes have I/O-bound and compute-bound phases 4/6/2019 COP4610

Phases of a Process Compute-bound I/O-bound Time 4/6/2019 COP4610

Device Manager Design Device drivers Application programming interface Coordination among application processes, drivers, and device controllers Performance optimization 4/6/2019 COP4610

BSD UNIX Driver Functions 4/6/2019 COP4610

The Kernel Interface 4/6/2019 COP4610

Device-Independent Function Call funci(…) Trap Table dev_func_i(devID, …) { // Processing common to all devices … switch(devID) { case dev0: dev0_func_i(…); break; case dev1: dev1_func_i(…); case devM: devM_func_i(…); }; } 4/6/2019 COP4610

Re-configurable Device Drivers Other Kernel services Entry Points for Device j open(){…} read(){…} etc. System call interface Driver for Device j 4/6/2019 COP4610

Handling Interrupts Device driver J Device interrupt handler J Device status table int read(…) { // Prepare for I/O save_state(J); out dev# // Done (no return) } void dev_handler(…) { get_state(J); //Cleanup after op signal(dev[j]); return_from_sys_call(); } J Interrupt Handler Device Controller 4/6/2019 COP4610

Handling Interrupts – cont. Device driver J Device interrupt handler J int read(…) { … out dev# // Return after interrupt wait(dev[J}); return_from_sys_call(); } void dev_handler(…) { //Cleanup after op signal(dev[j]); } Interrupt Handler Device Controller 4/6/2019 COP4610

CPU-device Interactions 4/6/2019 COP4610

Buffering Buffering A technique to keep slower I/O devices busy during times when a process is not requiring I/O operations Input buffering Output buffering 4/6/2019 COP4610

The Pure Cycle Water Company Customer Office Water Company Returning the Empties Water Producer Water Consumers Delivering Water 4/6/2019 COP4610

Buffering – cont. 4/6/2019 COP4610

Double Buffering 4/6/2019 COP4610

Multiple Buffers - Producer-consumer problem 4/6/2019 COP4610

Spooling A spool is a buffer that holds output for a device that cannot accept interleaved data streams Printer is an example 4/6/2019 COP4610

Device Characteristics Character devices vs. block devices Communication devices Sequentially accessed storage devices Randomly accessed storage devices 4/6/2019 COP4610

Communication Devices Generic Controller Local Device Communications Cabling connecting the controller to the device Printer Modem Network Bus 4/6/2019 COP4610

Randomly Accessed Devices 4/6/2019 COP4610

Optimizing Access to Rotating Devices Access time has three major components Seek time – the time for the disk arm to move the heads to the cylinder containing the desired sector Rotational latency – the additional time waiting for the disk to rotate the desired sector to the disk head Transfer Time - time to copy bits from disk surface to memory 4/6/2019 COP4610

Optimizing Seek Time Multiprogramming on I/O-bound programs => set of processes waiting for disk Seek time dominates access time => minimize seek time across the set Tracks 0:99; Head at track 75, requests for 23, 87, 36, 93, 66 4/6/2019 COP4610

Optimizing Access to Rotating Devices First-Come-First-Served (75), 66, 87, 93, 36, 23 52+ 64 + 51 + 57 + 27 = 251 steps 4/6/2019 COP4610

Optimizing Access to Rotating Devices – cont. Shortest-Seek-First-First - SSTF: (75), 66, 87, 93, 36, 23 11 + 21 + 6 + 57 + 13 = 107 steps 4/6/2019 COP4610

Optimizing Access to Rotating Devices – cont. -Scan/Look - Scan: (75), 87, 93, 99, 66, 36, 23 12 + 6 + 6 + 33 + 30 + 13 = 100 steps - Look: (75), 87, 93, 66, 36, 23 12 + 6 + 27 + 30 + 13 = 87 steps 4/6/2019 COP4610

Optimizing Access to Rotating Devices – cont. Circular Scan/ Circular Look Circular Scan: (75), 87, 93, 99, 23, 36, 66 12 + 6 + 6 + home + 23 + 13 + 30 = 90 + home Circular Look: (75), 87, 93, 23, 36, 66 12 + 6 + home + 23 + 13 + 30 = 84 + home 4/6/2019 COP4610

Serial Port Printer Terminal Modem Mouse etc. CPU Serial Memory Device 4/6/2019 COP4610

Serial Port RS-232 Interface Serial Device (UART) UART API 9-pin connector 4-wires bit transmit/receive ... Serial Device (UART) UART API parity bits per byte etc. Device Driver Set UART parms read/write ops Interrupt hander Software on the CPU Device Driver API Bus Interface 4/6/2019 COP4610

Switched Telephone Network Adding a Modem Serial Device Memory CPU Modem Phone Switched Telephone Network Dialing & connecting Convert analog voice to/from digital Convert bytes to/from bit streams Transmit/receive protocol 4/6/2019 COP4610

Serial Communication Device Driver Serial Device RS-232 Modem Set UART parms read/write ops Interrupt hander Driver-Modem Protocol Dialing & connecting Convert analog voice to/from digital Convert bytes to/from bit streams Transmit/receive protocol 4/6/2019 COP4610

Exploiting the Phone Network Comm Device Memory CPU Modem Phone Switched Telephone Network Logical Communication 4/6/2019 COP4610

Device Management in Linux While it builds on the same basic principles, it is more complex and with more details There are a lot of device drivers included and you can also develop your own device drivers for specific purpose devices Linux divides into char-oriented devices and block oriented devices fs/blk_dev.c fs/char_dev.c 4/6/2019 COP4610

Summary Device Management Organization I/O Strategies Device is the bottleneck for I/O-bound processes Overlap between I/O and CPU will increase the system’s throughput rate Buffering Access Optimization for Disks 4/6/2019 COP4610