MED 304 Real-Time Solutions with Windows CE 5.0 Asang Dani Kanetkar School of Embedded Technology

Slides:



Advertisements
Similar presentations
Windows CE Real-Time Performance Architecture
Advertisements

Optimizing Windows ® CE For Real-Time Systems Paul Yao President The Paul Yao Company
Processes Management.
MHK200 Module 1: Introduction to Windows CE. MHK200 Overivew Windows CE Design Goals Windows CE Architecture Supported Technologies, Libraries, and Tools.
CAS3SH3 Midterm Review. The midterm 50 min, Friday, Feb 27 th Materials through CPU scheduling closed book, closed note Types of questions: True & False,
Resource management and Synchronization Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
Real-Time Library: RTX
Operating Systems Process Scheduling (Ch 3.2, )
OS/2 Warp Chris Ashworth Cameron Davis John Weatherley.
Computer System Overview
 A quantum is the amount of time a thread gets to run before Windows checks.  Length: Windows 2000 / XP: 2 clock intervals Windows Server systems: 12.
MotoHawk Training Model-Based Design of Embedded Systems.
Model for Supporting High Integrity and Fault Tolerance Brian Dobbing, Aonix Europe Ltd Chief Technical Consultant.
INTRODUCTION OS/2 was initially designed to extend the capabilities of DOS by IBM and Microsoft Corporations. To create a single industry-standard operating.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
MicroC/OS-II Embedded Systems Design and Implementation.
What do operating systems do? manage processes manage memory and computer resources provide security features execute user programs make solving user.
Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Scheduling in Windows Zoltan Micskei
Advanced Embedded Systems Design Pre-emptive scheduler BAE 5030 Fall 2004 Roshani Jayasekara Biosystems and Agricultural Engineering Oklahoma State University.
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.
Windows NT and Real-Time? Reading: “Inside Microsoft Windows 2000”, (Solomon, Russinovich, Microsoft Programming Series) “Real-Time Systems and Microsoft.
Scheduling Basic scheduling policies, for OS schedulers (threads, tasks, processes) or thread library schedulers Review of Context Switching overheads.
Real Time Operating Systems Lecture 10 David Andrews
Getting Started with the µC/OS-III Real Time Kernel Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University.
Windows 2000 Course Summary Computing Department, Lancaster University, UK.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Chapter 101 Multiprocessor and Real- Time Scheduling Chapter 10.
EMB422 Advanced Embedded Visual C++ Application Development Control - View Nat Frampton President Real Time Development
Reference: Ian Sommerville, Chap 15  Systems which monitor and control their environment.  Sometimes associated with hardware devices ◦ Sensors: Collect.
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.
EMB427 Writing Real-Time Applications On Windows CE 5.0 Nat Frampton President Real Time Development Corporation
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.
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.
Windows CE Overview and Scheduling Presented by Dai Kawano.
Windows CE Portable Modular Real-time Small footprint Embedded market.
CHAPTER 7 CONCURRENT SOFTWARE Copyright © 2000, Daniel W. Lewis. All Rights Reserved.
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.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
1© Copyright 2015 EMC Corporation. All rights reserved. NUMA(YEY) BY JACOB KUGLER.
Outlines  Introduction  Kernel Structure  Porting.
Real-Time Operating Systems RTOS For Embedded systems.
Chapter 3: Windows7 Part 5.
REAL-TIME OPERATING SYSTEMS
Processes and threads.
Process Management Process Concept Why only the global variables?
CS 6560: Operating Systems Design
Topics Covered What is Real Time Operating System (RTOS)
Background on the need for Synchronization
Unit OS9: Real-Time and Embedded Systems
Unit OS4: Scheduling and Dispatch
Real-time Software Design
Threads and Locks.
Chapter 3: Windows7 Part 2.
Chapter 3: Windows7 Part 5.
Chapter 3: Windows7 Part 2.
Lecture 2 Part 2 Process Synchronization
CPU scheduling decisions may take place when a process:
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
CS703 – Advanced Operating Systems
CSE 153 Design of Operating Systems Winter 2019
Michael Blinn Ben Hejl Jane McHugh Matthew VanMater
Presentation transcript:

MED 304 Real-Time Solutions with Windows CE 5.0 Asang Dani Kanetkar School of Embedded Technology

Overview WinCE features Real-time Systems Real-time performance considerations Interrupt architecture Priority inversion Measurement tools

Architecture

OS Architecture

WinCE Real-time Features Preemptive multi-tasking 32 different processes Priority inversion Nested interrupts One-millisecond system tick timing Advanced thread timing and scheduling Semaphores and other synchronization objectives High resolution timer (OEM)

Scheduler 32 processes Multiple threads per process Preemptive thread scheduler 256 priority levels 0-96Reserved for real-time above drivers Used by the default Windows CE- based device drivers Reserved for real-time below drivers Maps to non-real-time priorities

Real-time Systems Set of all system elements Hardware operating system applications RTOS is one of the elements Application domains manufacturing process controls high-speed data acquisition devices telecommunications switching equipment

WinCE Real-time Performance Guaranteed upper bound on high-priority thread scheduling Guaranteed upper bound on delay in executing high-priority ISRs Fine control over scheduler and how it schedules threads Adjustable Thread quantum Measurement tools

System Response times Predictable factors - processor, clock, bus speed Unpredictable Processor cache IST is current thread? Filesystem Options Adjust the priorities of system's ISTs Interrupt batching Faster processor, bus etc

Real-time Performance considerations Memory Considerations Demand Paging Considerations File System Considerations GWES Considerations Other Considerations

Memory considerations Allocate memory for kernel objects whenever a process starts Virtual memory VirtualAlloc – Commit a region of pages in VA space of caller Caching can also be disabled Heaps Local – first-fit algorithm Make uniform allocations Stack Committed when thread is first scheduled Kernel reclaims unused stack memory

Memory considerations Stack Reclaiming controlled by OEM dwNKMaxPrioNoScav – Highest priority for a thread that should not incur stack space recovery (default 247) CONTD

Demand Paging considerations Code is paged; data is not Can make response time unpredictable Can be disabled for Entire system by setting ROMFLAGS=0x01 in Config.bib An individual dynamic-link library (DLL) by using LoadDriver File system driver that doesn’t support it ( HKEY_LOCAL_MACHINE\System\StorageManager\ FATFS\Paging )

Filesystem & GWES Considerations Filesystem drivers are NOT real-time use critical sections using single critical section per FS can block higher priority threads GWES has no guaranteed latency utilizes single critical section can also worsen the performance through it’s use of display drivers

Other Considerations Power management Frequent cycles in and out of idle state should be avoided OEMIdle should be a no-op. Peripheral access Reading from CMOS clock – optimize in software Working with system bus – find out how drivers in your system affect RT processing Display drivers that use hardware acceleration lock system bus for extended duration

Remote Kernel Tracker Thread interactions Internal dependencies System state information System events, mapped onto thread that was executing at the time they occurred System interrupts All processes and threads in the system Custom events

Remote kernel tracker

Preempt Priority Inversion Thread 1 blocked waiting for resource owned by Thread 3, causing Priority Inversion Avoid priority inversion by keeping all threads waiting for same resource at the same priority Thread 3 High Priority Medium Priority Low Priority Thread 3 Resource Owner: Thread 2 Thread 1 Blocked Thread 2 Thread 1 Priority Boost Priority Inversion Preempt Blocked Priority Restored Thread 3 Fresh Quantum Thread 3

Kernel Interrupt Architecture HW All Higher Enabled All Except ID All OAL Thread ISR SetEvent ID ISH ISR 1 ISRN ISRLatency IST IST Latency

Interrupt Initialization // Create the Event gIntEvent= CreateEvent(NULL, // Security FALSE,// Manual reset FALSE,// Init as not signaled NULL// No Named Events ); // Create a thread that waits for signaling gThreadInt = CreateThread(NULL,// Security 0,// Default ThreadInt,// Interrupt Thread NULL,// No Parameters CREATE_SUSPENDED,// Suspended &dwThreadID // Thread Id); // Initilialize the Interrupt gSysInterruptNum = KernelIoControl( IOCTL_HAL_TRANSLATE_IRQ, &gIRQNum, sizeof(DWORD), &gSysIntNum, &gIRQNum, sizeof(DWORD), &gSysIntNum, sizeof(DWORD), NULL); sizeof(DWORD), NULL); InterruptInitialize( gSysIntNum, // From Map gIntEvent, // Global Event NULL, // Not Used (DWORD)NULL // Not Used ) ) // Get the thread going ResumeThread( gThreadInt ); // Create the Event gIntEvent= CreateEvent(NULL, // Security FALSE,// Manual reset FALSE,// Init as not signaled NULL// No Named Events ); // Create a thread that waits for signaling gThreadInt = CreateThread(NULL,// Security 0,// Default ThreadInt,// Interrupt Thread NULL,// No Parameters CREATE_SUSPENDED,// Suspended &dwThreadID // Thread Id); // Initilialize the Interrupt gSysInterruptNum = KernelIoControl( IOCTL_HAL_TRANSLATE_IRQ, &gIRQNum, sizeof(DWORD), &gSysIntNum, &gIRQNum, sizeof(DWORD), &gSysIntNum, sizeof(DWORD), NULL); sizeof(DWORD), NULL); InterruptInitialize( gSysIntNum, // From Map gIntEvent, // Global Event NULL, // Not Used (DWORD)NULL // Not Used ) ) // Get the thread going ResumeThread( gThreadInt ); Kernel HW All Higher Enabled All Except ID All OAL IST ISR SetEvent ID ISH ISR 1 ISR N IST

DWORDWINAPIThreadInt( LPVOID lpvParam ) { while( gRun ) { // Wait until we have been signaled interrupt WaitForSingleObject( gIntEvent, INFINITE ); // Increment the counter gInterruptCount++; // your logic here … // Reset the interrupt InterruptDone( gSysIntNum ); } return 0; } DWORDWINAPIThreadInt( LPVOID lpvParam ) { while( gRun ) { // Wait until we have been signaled interrupt WaitForSingleObject( gIntEvent, INFINITE ); // Increment the counter gInterruptCount++; // your logic here … // Reset the interrupt InterruptDone( gSysIntNum ); } return 0; } Kernel HW All Higher Enabled All Except ID All OAL IST ISR SetEvent ID ISR ISR 1 ISR N IST Interrupt Service Thread

Priority Runner Strategy Create a thread that runs priorities IST runs, LED blinks Stops Blinking when it isn’t scheduled! Waits for Start Event Check if Reached Stop Priority Turns LED ON Waits 100 ms Turn LED OFF Increments and Sets Priority Sleeps 1 second Loop Sets Finished Event Push Button LED IST

Hardware

Measurement tools - ILTiming Determines ISR and IST latencies Jitter – variance of interrupt latencies ISR and IST jitters should be as small as possible Uses timer interrupt to measure latencies Allows creating idle background threads Affect IST latencies by enabling kernel to be in a non-preemptive call (must finish before IST is run) iltiming [-i0] [-i1] [-i2] [-i3] [-i4] [-p priority] [-ni] [-t interval] [-n interrupt] [-all] [-o file_name] [-h]

Measurement tools - OSBench Collects timing samples for kernel performance measurement Determines time taken for: Critical Section acquire or release Event wait or signal Semaphore/Mutex Create Thread yield System API calls osbench [-all] [-t test_case] [-list] [-v] [-n number] [-m address] [-o file_name] [-h]

Debugging Strategies StrategyComments Application IDENice Integration and view of application data but not system Data Kernel DebuggerGreat system access; Requires OEM Integration into OS Debug ZonesSlow but ability to selectively enable debugging output Firmware DebuggerGreat Hardware access but difficult application level information Hardware DebuggerLast Resort when system is locked

Summary Real-time is system property Real-time performance considerations IST – ISR Interrupt Model Coordination through an OS Event CE 5.0 provides RTOS Environment Priorities/Quantums/Inversion/paging controls Measurement tools Integrated Kernel Tracker, Debugger, Profiler

Tools & Resources msdn.microsoft.com/ embedded microsoft.public. windowsxp.embedded windowsce.platbuilder windowsce.platbuilder windowsce.embedded.vc windowsce.embedded.vc blogs.msdn.com/mikehall Windows CE 5.0 Eval Kit Windows XP Embedded Eval Kit msdn.microsoft.com/ mobility microsoft.public. pocketpc.developer smartphone.developer dotnet.framework.compactframework blogs.msdn.com/ windowsmobile vsdteam netcfteam Windows Mobile 5.0 Eval Kit Websites Newsgroups Blogs Tools Build Develop

Your Feedback is Important! Please Fill Out the feedback form

© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.