Optimizing Windows ® CE For Real-Time Systems Paul Yao President The Paul Yao Company 8-309.

Slides:



Advertisements
Similar presentations
Process A process is usually defined as an instance of a running program and consists of two components: A kernel object that the operating system uses.
Advertisements

Windows CE Real-Time Performance Architecture
Introduction to Embedded Systems Resource Management - III Lecture 19.
MED 304 Real-Time Solutions with Windows CE 5.0 Asang Dani Kanetkar School of Embedded Technology
MHK200 Module 1: Introduction to Windows CE. MHK200 Overivew Windows CE Design Goals Windows CE Architecture Supported Technologies, Libraries, and Tools.
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
A Sample RTOS Presentation 4 Group A4: Sean Hudson, Manasi Kapadia Syeda Taib.
Resource management and Synchronization Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
Real-Time Library: RTX
Operating Systems Process Scheduling (Ch 3.2, )
1 CS318 Project #3 Preemptive Kernel. 2 Continuing from Project 2 Project 2 involved: Context Switch Stack Manipulation Saving State Moving between threads,
Real-Time Operating Systems Suzanne Rivoire November 20, 2002
Performance Evaluation of Real-Time Operating Systems
Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Scheduling in Windows Zoltan Micskei
Introduction to Embedded Systems
Chapter 8 Windows Outline Programming Windows 2000 System structure Processes and threads in Windows 2000 Memory management The Windows 2000 file.
Introduction to Embedded Systems Rabie A. Ramadan 6.
Real-Time Systems Design1 Priority Inversion When a low-priority task blocks a higher-priority one, a priority inversion is said to occur Assume that priorities:
Getting Started with the µC/OS-III Real Time Kernel Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University.
Unit OS9: Real-Time and Embedded Systems
Module 6: Debugging a Windows CE Image.  Overview Debug Zones IDE Debug Setup IDE Debug Commands Platform Builder Integrated Kernel Debugger Other Debugging.
Fall 2013 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to Embedded Systems Dr. Jerry Shiao, Silicon Valley University.
Traditional UNIX Scheduling Scheduling algorithm objectives Provide good response time for interactive users Ensure that low-priority background jobs do.
Kernel Architecture Process Management Memory Management.
Windows 2000 Michael Blinn Ben Hejl Jane McHugh Matthew VanMater.
Embedded Systems OS. Reference Materials The Concise Handbook of Real- Time Systems TimeSys Corporation.
RTX - 51 Objectives  Resources needed  Architecture  Components of RTX-51 - Task - Memory pools - Mail box - Signals.
ECGR-6185 µC/OS II Nayana Rao University of North Carolina at Charlotte.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Solaris CS Dr. Abzug Alex Blood Mike Henry James Sheasley David Waterman.
Chapter 19: Real-Time Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 19: Real-Time Systems System Characteristics.
Windows CE Overview and Scheduling Presented by Dai Kawano.
Windows CE Portable Modular Real-time Small footprint Embedded market.
1.  System Characteristics  Features of Real-Time Systems  Implementing Real-Time Operating Systems  Real-Time CPU Scheduling  An Example: VxWorks5.x.
Where Testing Fails …. Problem Areas Stack Overflow Race Conditions Deadlock Timing Reentrancy.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Outlines  Introduction  Kernel Structure  Porting.
Threads and Thread Synchronization. Introduction In windows the basic unit of execution is the thread. It is the smallest schedulable unit of execution.
Real-Time Operating Systems RTOS For Embedded systems.
REAL-TIME OPERATING SYSTEMS
Chapter 19: Real-Time Systems
Processes and threads.
Lecture 12: Real-Time Scheduling
Advanced Operating Systems CIS 720
Topics Covered What is Real Time Operating System (RTOS)
Windows API.
Thread Fundamentals Header Advanced .NET Threading, Part 1
OPERATING SYSTEMS CS3502 Fall 2017
REAL TIME OPERATING SYSTEM
Getting Started with the µC/OS-III Real Time Kernel
Intro to Processes CSSE 332 Operating Systems
I/O Manager, 64-bit Porting, and New Driver Models
Real-time Software Design
Threads and Locks.
Structure of Processes
Process Description and Control
OS/2 Warp Chris Algire Jonathan Depner Daniel Kvitko Jason Shifflett
Process Description and Control
Threads Chapter 5 2/17/2019 B.Ramamurthy.
Chapter 19: Real-Time Systems
Threads Chapter 5 2/23/2019 B.Ramamurthy.
Still Chapter 2 (Based on Silberchatz’s text and Nachos Roadmap.)
February 5, 2004 Adrienne Noble
CSE 153 Design of Operating Systems Winter 2019
Michael Blinn Ben Hejl Jane McHugh Matthew VanMater
Akos Ledeczi EECE 6354, Fall 2017 Vanderbilt University
Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University
Presentation transcript:

Optimizing Windows ® CE For Real-Time Systems Paul Yao President The Paul Yao Company

Agenda Introductions (5 minutes) Introductions (5 minutes) Terms (5 minutes) Terms (5 minutes) RT-features of Windows CE (15 minutes) RT-features of Windows CE (15 minutes) RT enhancements for Windows CE 3.0 (15 minutes) RT enhancements for Windows CE 3.0 (15 minutes) Optimization tips (20 minutes) Optimization tips (20 minutes) Discussion (15 minutes) Discussion (15 minutes)

Terms Real time – A system in which specific data collection or device control must be handled within specified time parameters Real time – A system in which specific data collection or device control must be handled within specified time parameters  1 Millisecond (1 ms) =.001 second  1 Microsecond (1 ms) = second Hard real time – Catastrophic results for failure to meet time-critical needs Hard real time – Catastrophic results for failure to meet time-critical needs Soft real time – Non-catastrophic results Soft real time – Non-catastrophic results

CE Kernel Features Multi-process operating system (32 max) Multi-process operating system (32 max) Multi-threaded Multi-threaded  256 thread priorities (new with Windows CE 3.0) Synchronization Synchronization  Critical sections  Mutexes  Semaphores (new with Windows CE 3.0)  Events Memory Memory  Paged  No backing store

Interrupt Handling Event NK.EXE IRQ User Mode Kernel Mode ISR = “Interrupt Service Routine” IST = “Interrupt Service Thread” A B C Event

Windows CE 3.0 Real-Time Features Better interrupt handling Better interrupt handling  Support for nested interrupts  Improved interrupt latencies Better control of Scheduler Better control of Scheduler  More thread priorities  Control of time-slice quantum  Restrictions based on Trust  Better synchronization support  Higher timer resolution  Better priority inversion handling

Nested Interrupts Windows CE 2.x Windows CE 2.x  No nesting  IRQs always run to completion  ISTs run to completion when created with highest priority Windows CE 3.0 Windows CE 3.0  Nesting supported  IRQs can be interrupted  Registers saved and restored  Interrupts only occur for higher priority IRQs

Interrupt Latency Event NK.EXE IRQ User Mode Kernel Mode ISR = “Interrupt Service Routine” IST = “Interrupt Service Thread” A B Event

Thread Priorities Windows CE 2.x Windows CE 2.x  Eight priorities – 0 to 8  SetThreadPriority(hThread, nPriority) Windows CE 3.0 Windows CE 3.0  256 priorities – 0 (real-time) to 255  CeSetThreadPriority(hThread, nPriority)

New Thread Priorities Windows CE 2.x SetThreadPriority() Windows CE 2.x SetThreadPriority()  0 = real-time  1  2  3 = normal  4  5  6  7 = idle-time Windows CE 3.0 CeSetThreadPriority() Windows CE 3.0 CeSetThreadPriority()  0 (RT) to 247  248  249  250  251  252  253  255

Thread Quantum Control Quantum = Duration of time slice Quantum = Duration of time slice Platform builder – Set default Platform builder – Set default  During call to OEMInit()  Set dwDefaultThreadQuantum Individual threads: Individual threads:  DWORD CeGetThreadQuantum();  BOOL CeSetThreadQuantum (DWORD dwTime)

Thread Quantum Examples // Set quantum to 100 ms. CeSetThreadQuantum(100); // Set quantum to 500 ms. CeSetThreadQuantum(500); // Set run to completion. CeSetThreadQuantum(0);

Certifying Trust Untrusted applications: Untrusted applications:  Cannot call CeSetThreadPriority  Cannot call CeSetThreadQuantum Platform Builder – OEMCertifyModule Platform Builder – OEMCertifyModule Checking Trust: Checking Trust:  DWORD CeGetCurrentTrust(void);  DWORD CeGetCallerTrust(void);  0 = None, 1 = Some, 2 = All

Synchronization Enhancements TryEnterCriticalSection() – TryEnterCriticalSection() –  Non-blocking call Semaphores Semaphores  A “mutex with a count”

Timers Sleep(int nMilliseconds) Sleep(int nMilliseconds)  1 ms granularity on CE 3.0 Sleep(100); // block for 100 ms. Sleep(5); // block for 5 ms. Sleep(0); // yield quantum. Avoid SetTimer() Avoid SetTimer()  Not RT  Message-based, UI-oriented timer

Priority Inversion Mutex ABC Priority Time Blocks on Mutex Acquires Mutex Frees Mutex

Optimizing Tips Avoid priority inversion Avoid priority inversion  Avoid file I/O from RT threads  Avoid graphic calls from RT threads  Avoid UI calls from RT threads Memory Memory  Pre-allocate heap memory  Pre-commit stack memory To Control Paging To Control Paging  Use LoadDriver() - not LoadLibrary()  For individual pages - LockPages()

Measurement Tools ILTIMING – Check Interrupt Latency ILTIMING – Check Interrupt Latency  \wince300\public\common\oak\ utils\iltiming OSBENCH – Thread scheduling OSBENCH – Thread scheduling  \wince300\public\common\oak\ utils\osbench White paper: White paper:  embedded/ce/resources/developing

Measurement APIs QueryPerformanceFrequency() QueryPerformanceFrequency() QueryPerformanceFrequency()  Returns Ticks per Second QueryPerformanceCounter() QueryPerformanceCounter()  Returns Current tick count GetTickCount() GetTickCount()

Discussion

Thank You!