introduction to i o
play

Introduction to I/O 1-Slide Overview to File Management I/O - PDF document

CPSC 410 / 611 : Operating Systems Introduction to I/O 1-Slide Overview to File Management I/O Hardware I/O Application Interface I/O Subsystem Issues Note : much material in this set of slides comes directly from


  1. CPSC 410 / 611 : Operating Systems Introduction to I/O • 1-Slide Overview to File Management • I/O Hardware • I/O Application Interface • I/O Subsystem Issues Note : much material in this set of slides comes directly from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series. Short Interlude: The Logical View of File Management Service http://www.cs.tamu.edu/index.html Server / Volume file structure • directory management • access control • access method records • blocking physical blocks in memory • disk scheduling physical blocks on disk • file allocation 1

  2. CPSC 410 / 611 : Operating Systems I/O Devices graphics keyboard mass storage CPU mouse printer 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). • Data-near computation: portions of applications are migrated to I/O controllers. • TCP offload: Run protocols on network interface card. • TAMU-PANIC (Protocols Aboard Network Interface Cards) project: portions of application run in network interface cards. 2

  3. CPSC 410 / 611 : Operating Systems 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 W2k Primary Device Driver Routines dispatch dispatch routines dispatch start I/O routines routines routine add-device IO interrupt routine system service routine In addition: initialization DPC routine routine I/O completion routines Cancel I/O routine Unload routine System shutdown notification routine Error-logging routine 3

  4. CPSC 410 / 611 : Operating Systems W2k I/O Data Structures • File Objects: Handles to files or devices. • Driver Objects: Represent individual driver in the system. I/O Manager has references to Dispatch Routines. • Device Objects: Represent physical or logical devices in the system. Contain all information about device characteristics, buffer locations, etc. W2k File Objects Filename Identifies the physical file that the file object refers to Current byte offset Identifies the current location of the file (valid only for synchronous I/O) Share modes Indicate whether other callers can access the file while the current caller is using it. Open mode flags Indicate whether I/O will be synchronous or asynchronous, cached or non-cached, sequential or random, etc. Pointer to device object Pointer to volume parameter Indicates the volume, or partition, that the file block resides on. Pointer to section object Indicates a root structure that describes a pointers mapped file. Pointer to private cache map Identifies which part of the file are cached by the cache manager 4

  5. CPSC 410 / 611 : Operating Systems Opening a File Object (W2k) Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series 5

  6. CPSC 410 / 611 : Operating Systems W2k I/O Data Structures (simple I/O request) Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series Windows Driver Model (WDM) Drivers • Bus Drivers manage logical or physical bus (PCMCIA, PCI, USB, IEEE 1394, ISA). Interfaces to – PnP Manager -- to detect and inform about devices attached to bus. – Power Manager -- to control power settings of devices on bus. • Function Drivers manage particular type of device. Exports operational interface of device. • Filter Drivers logically layer above or below function drivers. – Augment or modify behavior of device or another driver. 6

  7. CPSC 410 / 611 : Operating Systems Device Driver Layering Environment subsystem or DLL 1. NtWriteFile(file_handle, char_buffer) System Services 2. Write data at specified I/O byte offset within a file manager File system driver 3. Transfer file-relative byte offset into a disk-relative byte offset and call next driver (via I/O manager) disk driver 4. Call driver to write data at disk-relative byte offset 5. Translate disk-relative byte offset into physical location and transfer data. Device Driver Layering Environment subsystem or DLL 1. NtWriteFile(file_handle, char_buffer) System Services 2. Write data at specified I/O byte offset within a file manager File system driver 3. Transfer file-relative byte offset into a disk-relative byte offset and call next driver (via I/O manager) 4. Call next driver to write data at disk-relative byte 4. Call n ext driver to write data at disk-relative byte Volume manager offset offset disk driver 5. Tran 5. Transfer disk-relative byte offset in sfer disk-relative byte offset into disk n to disk number an umber and offset, and call n offset, an d call next driver ext driver (via I/O man via I/O manager) ager) 6. Call next driver to write data to disk 3 at disk-relative disk driver byte offset 5. Translate disk-relative byte offset into physical location and transfer data. 7

  8. CPSC 410 / 611 : Operating Systems W2k I/O Processing • Types of I/O • I/O Control Flow Control Flow for an IO Operation Application Call ReadFile() ReadFile Call NTReadFile() Kernel32.dll return to caller NtReadFile INT 2E Ntdll.dll return to caller User mode Kernel mode KiSystemService Call NTReadFile() Ntoskrnl.exe dismiss interrupt NtReadFile Whether to wait depends Invoke driver Ntoskrnl.exe dismiss interrupt on overlapped flag Initiate I/O operation Driver.sys dismiss interrupt 8

  9. CPSC 410 / 611 : Operating Systems Queuing and Completing a Synchronous Request Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series Servicing a Device Interrupt (only Phase I) Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series 9

  10. CPSC 410 / 611 : Operating Systems Servicing a Device Interrupt (Phase II) Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series Completing an I/O Request (Phase I) Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series 10

  11. CPSC 410 / 611 : Operating Systems Completing an I/O Request (Phase II) Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series Issues: Buffering operating system user process no buffering single buffering double buffering circular buffering 11

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend