IO and Device Management • IO Processing • DMA • Logical Structure of I/O Functionality • Buffering • Reading: Silberschatz Chapter 13 I/O Devices graphics keyboard mass storage CPU CPU mouse printer memory memory modem network
Where is the Control of I/O Functions? • Processor directly controls device. • Controller or I/O module is added. Processor uses programmed I/O without interrupts. • Same, but with interrupts. • The I/O module is given direct control of memory via DMA. • I/O module is separate processor, with special instruction set and access to memory to execute I/O program. No CPU intervention. • I/O module has local memory of its own. Can control several I/O devices. • Intelligent I/O (I 2 O) see http://www.I2Osig.org • Data-near computation: portions of applications are migrated to I/O controllers. • TAMU-PANIC (Protocols Aboard Network Interface Cards) project: portions of application run in network interface cards. Direct Memory Access (DMA) • The DMA logic moves data from or to memory without processor intervention. data • Typical I/O operation involving count DMA: data 1. CPU sends DMA request with: data lines register • direction of transfer (read or write) on control control line address • address of I/O device, on data lines address lines register • starting location in memory, on data DMA req lines, in address register • number of words to transfer, on data DMA ack control lines, in data count register interrupt logic 2. CPU continues with other work, while read DMA transfers block of data. write 3. When transfer is complete, DMA interrupts the CPU. DMA Block Diagram
Logical Structure of I/O Subsystem: File System Application program user interface directory management • directory service • create, delete files (logical file system) file system • open-file table management • open, close files • access rights physical organization • translates logical block numbers to physical block addresses • free space manager Device I/O • operations on buffers scheduling and control • hardware access hardware IO System Components (Windows 2k) Win32 Applications services user-mode setup WMI PnP service components manager .inf files user mode .cat files registry kernel mode I/O system WDM WMI PnP Power I/O routines manager manager manager drivers ... HAL
Device Driver Layering Device Driver Layering (2)
Primary Device Driver Routines dispatch dispatch dispatch dispatch routines dispatch start I/O routines dispatch start I/O routines routines routines routine routines routine add-device IO interrupt add-device IO interrupt routine system service routine routine system service routine initialization initialization DPC routine DPC routine routine routine Control Flow for an IO Operation Application Call ReadFile() Call ReadFile() ReadFile Call NTReadFile() Call NTReadFile() Kernel32.dll return to caller return to caller NtReadFile INT 2E INT 2E Ntdll.dll return to caller return to caller User mode Kernel mode KiSystemService Call NTReadFile() Call NTReadFile() Ntoskrnl.exe dismiss interrupt dismiss interrupt NtReadFile Whether to wait depends Invoke driver Invoke driver Ntoskrnl.exe dismiss interrupt on overlapped flag dismiss interrupt Initiate I/O operation Initiate I/O operation Driver.sys dismiss interrupt dismiss interrupt
Queueing and Completing a Synchronous Request Servicing a Device Interrupt (only Phase I)
Servicing a Device Interrupt (Phase II) Completing an I/O Request (Phase I)
Completing an I/O Request (Phase II) Buffering operating system user process no buffering single buffering double buffering circular buffering
Recommend
More recommend