windows nt and real time
play

Windows NT and Real-Time? Reading: I nside Microsof t Windows 2000, - PDF document

CPSC-663: Real-Time Systems Operating Systems Issues Windows NT and Real-Time? Reading: I nside Microsof t Windows 2000, (Solomon, Russinovich, Microsof t P rogramming Series) Real- Time Systems and Microsof t Windows NT


  1. CPSC-663: Real-Time Systems Operating Systems Issues Windows NT and Real-Time? • Reading: “I nside Microsof t Windows 2000”, (Solomon, Russinovich, Microsof t P rogramming Series) • “Real- Time Systems and Microsof t Windows NT” (MSDN Library) • “Windows XP with RTX - The of f- the- shelf platf orm f or I ntegrated Communication Equipment” (www.vent urcom.com) Priorit ies in Windows NT/ 2000 1

  2. CPSC-663: Real-Time Systems Operating Systems Issues I O Syst em Component s (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 2

  3. CPSC-663: Real-Time Systems Operating Systems Issues Device Driver Layering (2) Primary Device Driver Rout ines • NT/ 2000 device drivers run ent irely wit hin t he syst em process and have access t o all hardware t hrough t he HAL. A t ypical device driver will have several component s: • I nit ializat ion rout ine This dispatch rout ine init ializes hardware and dispatch dispatch dispatch routines dispatch start I/O set s up dat a st ruct ures used by routines dispatch start I/O routines routines routines routine t he driver at st art up t ime. routines routine • I nt errupt service rout ine (I SR) This rout ine handles an int errupt on t he device t hat t he device driver cont rols. add-device IO interrupt add-device IO interrupt • Def erred processing call (DPC) routine system service routine routine system service routine One or more DP Cs handle non– t ime-crit ical processing f or t he driver. • Syst em t hread Some, but not all, initialization drivers will have a syst em t hread initialization DPC routine DPC routine routine f or very low- priorit y work. routine 3

  4. CPSC-663: Real-Time Systems Operating Systems Issues Cont rol Flow f or an I O Operat ion 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 Ntoskrnl.exe Invoke driver dismiss interrupt on overlapped flag dismiss interrupt Initiate I/O operation Initiate I/O operation Driver.sys dismiss interrupt dismiss interrupt Queueing and Complet ing a Synchr onous Request 4

  5. CPSC-663: Real-Time Systems Operating Systems Issues Ser vicing a Device I nt er r upt (only Phase I ) Servicing a Device I nt errupt (Phase I I ) 5

  6. CPSC-663: Real-Time Systems Operating Systems Issues Complet ing an I / O Request (Phase I ) Complet ing an I / O Request (Phase I I ) 6

  7. CPSC-663: Real-Time Systems Operating Systems Issues Priorit y Levels vs. I nt errupt Levels • The HAL maps hardware- interrupt numbers to IRQLs. 31: High • IRQLs are not the same as 30: Power Fail IRQs in x86. 29: Inter-Processor Interrupt • Scheduling priority is attribute 28: Clock of thread, while IRQL is 27: Profile attribute of an interrupt Hardware 26: Device n source. Interrupts • Lazy IRQL management for slow PICs. • Code running at DPC/dispatch level or above can’t wait on object if so would necessitate 3: Device 1 scheduler to invoke another 2 DPC/dispatch Software thread. 1: APC Thread Interrupts 0: Passive Priorities 0-31 Memory Management • Paging I / O occurs at a lower priorit y level t han t he real-t ime priorit y process levels. P aging wit hin t he real-t ime process is st ill f ree t o occur, but t his really ensures t hat background virt ual memory management won' t int erf ere wit h processing at real-t ime priorit ies. • Windows NT permit s an applicat ion t o lock it self int o memory so t hat it is not af f ect ed by paging wit hin it s own process. This allows even very large processes (such as rast er image processing, where some processes are over 100MB) t o lock all t heir memory down int o physical memory and avoid t he overhead of paging, while allowing t he rest of t he syst em t o f unct ion normally. • Windows NT memory management allows f or memory mapping, which permit s mult iple processes—even device drivers and user applicat ions—t o share t he same physical memory. This result s in very f ast dat a t ransf ers bet ween cooperat ing processes or bet ween a driver and an applicat ion. Memory mapping can be used t o dramat ically enhance real-t ime perf ormance. 7

  8. CPSC-663: Real-Time Systems Operating Systems Issues Windows 2000/ NT and Real-Time Processing • Windows 2000/ NT does not priorit ize device I RQs in cont rollable way. • User-level applicat ions execut e only when a processor’s I RQL is at passive level. • Syst em’s devices and device drivers – not t he OS – ult imat ely det ermine t he worst -case delay. • This is a problem wit h of f -t he-shelf hardware and drivers. • Syst em designer must bound t he lengt h of device’s I SR and DP C in t he worst case. • Embedded versions of Windows NT/ 2000 provide cont rol over memory f oot print et c, but are not real-t ime capable. • Ext ensions of real-t ime kernels can be provided t hrough cust om ext ensions of t he HAL. Vent urCom RTX Archit ect ure 8

Recommend


More recommend