Download presentation
Presentation is loading. Please wait.
Published byNeal Page Modified over 9 years ago
1
Device Management
2
Serial Port Serial Device Serial Device Memory CPU Printer Terminal Modem Mouse etc.
3
Serial Port RS-232 Interface 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
Adding a Modem Serial Device 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
5
Serial Communication Modem RS-232 Serial Device Device Driver 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
6
Comm Device Comm Device Memory CPU Modem Phone Comm Device Comm Device Memory CPU Modem Phone Switched Telephone Network Exploiting the Phone Network Logical Communication
7
Data Networks Network Device Network Device Memory CPU Network Device Network Device Memory CPU Data Network Logical Communication Technology focus includes protocols and software (more on this later … Chapter 15 and beyond...)
8
Rotating Storage Track (Cylinder) Sector Top View of a Surface
9
MS Disk Description
10
Storage Device Magnetic Disk (SCSI) Controller Driver Get disk description Set SCSI parms read/write ops Interrupt hander SCSI API commands bits per byte etc. Device Driver API
11
Device Management Organization Application Process Application Process File Manager File Manager Device Driver Device Driver Device Controller Command Status Data Hardware Interface System Interface
12
System Call Interface Functions available to application programs Abstract all devices (and files) to a few interfaces Make interfaces as similar as possible –Block vs character –Sequential vs direct access Device driver implements functions (one entry point per API function)
13
Example: BSD UNIX Driver open Prepare dev for operation close No longer using the device ioctl Character dev specific info read Character dev input op write Character dev output op strategy Block dev input/output ops select Character dev check for data stop Discontinue a stream output op
14
Read with Polling read(device, …); Data Device Controller Command Status Data read function write function 1 234 5 Hardware Interface System Interface
15
Read Using Interrupts read(device, …); Data Device Controller Command Status Data read driver write driver 1 2 3 4 5 Hardware Interface System Interface Device Status Table Device Handler Device Handler Interrupt Handler Interrupt Handler 6 7 8a 8b 9
16
Driver-Kernel Interface Drivers are distinct from main part of kernel Kernel makes calls on specific functions, drivers implement them Drivers use kernel functions for: –Device allocation –Resource (e.g., memory) allocation –Scheduling –etc. (varies from OS to OS)
17
Reconfigurable Drivers Other Kernel services Other Kernel services Entry Points for Device j open(){…} read(){…} etc. System call interface Driver for Device j
18
NT Driver Organization
19
NT Device Drivers API model is the same as for a file Extend device management by adding modules to the stream Device driver is invoked via an Interrupt Request Packet (IRP) –IRP can come from another stream module –IRP can come from the OS –Driver must respond to minimum set of IRPs See Part I of notes
20
Memory Mapped I/O Primary Memory Device 0 Device 1 Device n-1 Primary Memory Device 0 Device 1 Device n-1 Device Addresses Memory Addresses
21
CPU-I/O Overlap Variable x Register Data on device... read(dev_I, “%d”, x); y = f(x)... Device dev_I Memory CPU... startRead(dev_I, “%d”, x);... While(stillReading()) ; y = f(x)...
22
I/O - CPU Overlap App 1 App 2 I/O Ctlr t1t1 t2t2 t3t3 t4t4 App I/O Ctlr t1t1 t2t2 t3t3 t4t4 t5t5 t6t6 t7t7 t8t8 t9t9 Overlapping App 1’s I/O with App 2 Overlapping App CPU with its own I/O
23
Direct Memory Access Primary Memory CPU Controller Device Primary Memory CPU Controller Device
24
Buffering Water CompanyCustomer Office Water Consumers Water Producer Delivering Water Returning the Empties Water bottles are buffers Office workers consume water from a buffer while water company fills other buffers
25
Hardware Buffering Process Controller Data Device Process Controller B Device A Unbuffered Process reads b i-1 Controller reads b i
26
Hardware Buffering Process Controller Data Device Process Controller B Device A Process Controller B Device A Unbuffered Process reads b i-1 Controller reads b i Process reads b i Controller reads b i+1
27
Buffering in the Driver Process Controller B Device A BA Hardware Driver
28
Buffering in the Driver Process Controller B Device A Process Controller B Device A BABA Hardware Driver
29
A Ring Buffer From data producer To data consumer Buffer i Buffer j
30
Compute vs I/O Bound Compute-bound I/O-bound Time
31
Disk Optimizations Transfer Time: Time to copy bits from disk surface to memory Disk latency time: Rotational delay waiting for proper sector to rotate under R/W head Disk seek time: Delay while R/W head moves to the destination track/cylinder Access Time = seek + latency + transfer
32
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 FCFS: 52+ 64 + 51 + 57 + 27 = 251 steps
33
Optimizing Seek Time (cont) Requests = 23, 87, 36, 93, 66 SSTF: (75), 66, 87, 93, 36, 23 –11 + 21 + 6 + 57 + 13 = 107 steps 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
34
Optimizing Seek Time (cont) Requests = 23, 87, 36, 93, 66 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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.