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

windows nt and real time
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

CPSC-663: Real-Time Systems Operating Systems Issues 1

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

slide-2
SLIDE 2

CPSC-663: Real-Time Systems Operating Systems Issues 2

I O Syst em Component s (Windows 2k)

user mode kernel mode HAL WDM WMI routines PnP manager Power manager I/O manager I/O system drivers

...

setup components

user-mode PnP manager WMI service Applications Win32 services

.inf files .cat files registry

Device Driver Layering

slide-3
SLIDE 3

CPSC-663: Real-Time Systems Operating Systems Issues 3

Device Driver Layering (2)

dispatch routines dispatch routines

Primary Device Driver Rout ines

IO system IO system interrupt service routine interrupt service routine DPC routine DPC routine initialization routine initialization routine add-device routine add-device routine dispatch routines dispatch routines dispatch routines dispatch routines start I/O routine start I/O routine

  • I nit ializat ion rout ine This

rout ine init ializes hardware and set s up dat a st ruct ures used by t he driver at st art up t ime.

  • I nt errupt service rout ine (I SR)

This rout ine handles an int errupt

  • n t he device t hat t he device

driver cont rols.

  • Def erred processing call (DPC)

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,

drivers will have a syst em t hread f or very low- priorit y work.

  • 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:

slide-4
SLIDE 4

CPSC-663: Real-Time Systems Operating Systems Issues 4

Cont rol Flow f or an I O Operat ion

Call ReadFile() Call ReadFile() Call NTReadFile() return to caller Call NTReadFile() return to caller INT 2E return to caller INT 2E return to caller Call NTReadFile() dismiss interrupt Call NTReadFile() dismiss interrupt Invoke driver dismiss interrupt Invoke driver dismiss interrupt Initiate I/O operation dismiss interrupt Initiate I/O operation dismiss interrupt

User mode Kernel mode Whether to wait depends

  • n overlapped flag

ReadFile NtReadFile KiSystemService NtReadFile Application Kernel32.dll Ntdll.dll Ntoskrnl.exe Ntoskrnl.exe Driver.sys

Queueing and Complet ing a Synchr onous Request

slide-5
SLIDE 5

CPSC-663: Real-Time Systems Operating Systems Issues 5

Ser vicing a Device I nt er r upt (only Phase I )

Servicing a Device I nt errupt (Phase I I )

slide-6
SLIDE 6

CPSC-663: Real-Time Systems Operating Systems Issues 6

Complet ing an I / O Request (Phase I ) Complet ing an I / O Request (Phase I I )

slide-7
SLIDE 7

CPSC-663: Real-Time Systems Operating Systems Issues 7

Priorit y Levels vs. I nt errupt Levels

31: High 30: Power Fail 29: Inter-Processor Interrupt 28: Clock 27: Profile 26: Device n 3: Device 1 2 DPC/dispatch 1: APC 0: Passive Hardware Interrupts Software Interrupts Thread Priorities 0-31

  • The HAL maps hardware-

interrupt numbers to IRQLs.

  • IRQLs are not the same as

IRQs in x86.

  • Scheduling priority is attribute
  • f thread, while IRQL is

attribute of an interrupt source.

  • Lazy IRQL management for

slow PICs.

  • Code running at DPC/dispatch

level or above can’t wait on

  • bject if so would necessitate

scheduler to invoke another thread.

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.

slide-8
SLIDE 8

CPSC-663: Real-Time Systems Operating Systems Issues 8

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