计算机系 信息处理实验室 lecture 12 i/o system xlanchen@05/13/2005
TRANSCRIPT
计算机系•信息处理实验室
Lecture 12 I/O System
xlanchen@05/13/2005
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 2计算机系
信息处理实验室
Contents
I/O System Components
I/O Data Structures
Driver Loading, Initialization, and Installation
I/O Processing
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 3计算机系
信息处理实验室
I/O System Components
I/O manager
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 4计算机系
信息处理实验室
The flow of a typical I/O request
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 5计算机系
信息处理实验室
I/O Manager
The I/O manager defines the orderly framework, or model, within which I/O requests are delivered to device drivers.
Packet driven
I/O request packet (IRP)
Flexible I/O services
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 6计算机系
信息处理实验室
Device Drivers
Types
File system drivers
Windows 2000 drivers
Legacy drivers
display drivers
WDM drivers
Bus drivers
Function drivers
Filter drivers
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 7计算机系
信息处理实验室
user-mode drivers Virtual device drivers (VDDs) Win32 subsystem printer drivers
Driver componentsClass driversPort drivers Miniport drivers
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 8计算机系
信息处理实验室
Layering of a FSD and a disk driver
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 9计算机系
信息处理实验室
Adding a layered driver
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 10计算机系
信息处理实验室
Structure of a Drive
The I/O system drives the execution of device drivers
Primary device driver routines
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 11计算机系
信息处理实验室
Plug and Play (PnP) Manager
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 12计算机系
信息处理实验室
Power Manager
Requirement
hardware must comply with ACPI specification
The six system power states
See table 9-2
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 13计算机系
信息处理实验室
System power-state transitions
Sleeping
waking
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 14计算机系
信息处理实验室
I/O Data Structures
File Objects Driver Objects and Device Objects I/O Request Packets I/O Completion Ports
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 15计算机系
信息处理实验室
File Objects
File Object Attributes
Filename
Current byte offset
Share modes
Open mode flags
Pointer to device object
Pointer to the volume parameter block (VPB)
Pointer to section object pointers
Pointer to private cache map
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 16计算机系
信息处理实验室
Opening a file object
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 17计算机系
信息处理实验室
Driver Objects and Device Objects
A driver object represents an individual driver in the system.
A device object represents a physical or logical device on the system and describes its characteristics
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 18计算机系
信息处理实验室
The driver object
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 19计算机系
信息处理实验室
I/O Request Packets
IRP is where the I/O system stores information it needs to process an I/O request.
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 20计算机系
信息处理实验室
Data structures involved in a single-layered driver I/O request
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 21计算机系
信息处理实验室
IRP Stack Locations
IRP
a fixed header
one or more stack locations
IRP Buffer Management
Buffered I/O
Direct I/O
Neither I/O
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 22计算机系
信息处理实验室
I/O Completion Ports
The IoCompletion ObjectApplications use the IoCompletion executive object, which is exported to Win32 as a completion port, as the focal point for the completion of I/O associated with multiple file handles.
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 23计算机系
信息处理实验室
I/O completion port operation
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 24计算机系
信息处理实验室
Driver Loading, Initialization, and Installation
Explicit loading
Enumeration-based loading
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 25计算机系
信息处理实验室
The Start Value
boot-start (0)
system-start (1)
auto-start (2)
demand-start (3)
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 26计算机系
信息处理实验室
Device Enumeration
PnP manager
primary bus driver
device tree
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 27计算机系
信息处理实验室
Example device tree
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 28计算机系
信息处理实验室
Devnodes
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 29计算机系
信息处理实验室
Driver Installation
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 30计算机系
信息处理实验室
I/O Processing
Types of I/OSynchronous I/O and Asynchronous I/O
Fast I/OMapped File I/O and File CachingScatter/Gather I/O
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 31计算机系
信息处理实验室
Control flow for an I/O operation
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 32计算机系
信息处理实验室
I/O Request to a Single-Layered Driver
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 33计算机系
信息处理实验室
Servicing an Interrupt
Phrase 1
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 34计算机系
信息处理实验室
Phrase 2
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 35计算机系
信息处理实验室
Completing an I/O Request
Phrase 1
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 36计算机系
信息处理实验室
Phrase 2
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 37计算机系
信息处理实验室
I/O Requests to Layered Drivers
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 38计算机系
信息处理实验室
Completing a layered I/O request
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 39计算机系
信息处理实验室
Queuing associated IRPs
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 40计算机系
信息处理实验室
Completing associated IRPs
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 41计算机系
信息处理实验室
I/O Completion Port Operation
xlanchen@05/13/2005 Understanding the Inside of Windows 2000 42计算机系
信息处理实验室
Synchronization