20

Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Embed Size (px)

Citation preview

Page 1: Rob Tiffany Mobility Architect Microsoft Corporation MOB401
Page 2: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Game-Changing Memory and Performance Improvements with Windows Mobile 6.5 and the Microsoft .NET Compact Framework

Rob TiffanyMobility ArchitectMicrosoft CorporationMOB401

Page 3: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Who am I?

Day Job

Mobility Architect in the Microsoft Mobile Global Practice

Created the Microsoft Mobile Line of Business Accelerator

Writer :: Entrepreneur :: Former Embedded MVP :: Submariner :: Disk Jockey

Other Stuff…

Page 4: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Session Objectives and Takeaways

Objectives

Learn how Windows Mobile 6.5 makes more memory available to applications

Learn how Windows Mobile 6.5 boosts both application & graphics performance

Learn a new pattern for .NET Compact Framework development

Key Takeaway

Create new opportunities with faster, richer, more complex games and apps that target the consumer, science, education and line of business segments

Page 5: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Windows CE Memory ModelRob TiffanyMobility ArchitectMicrosoft Corporation

Demo

Page 6: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Slot Fill Order

FILE DLLs MODULE DLLs

0 1, 0

Slot 63 :: Resource-Only DLLs

Slot 0 :: Alias of Active Process from other SlotsFILE DLLs reduce VM space for all Processes

Slots 2-32 :: Application Processes

Slots 33-611 GB Large Memory Area

Memory-Mapped Files

2 G

B ::

Use

r Spa

ce

FILE DLLs are loaded into RAM at runtime which decreases

VM space to all slots

DLL Overflow Causes

Instability

MODULE DLLs are

4K page-aligned

instead of 64K due

to ARM architecture

saving 9MB of VM

Slot 62 :: Shared Heaps

Windows Mobile 6Slot Machine

Slot 1 :: ROM MODULE DLLs

Page 7: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

SlotsRob TiffanyMobility ArchitectMicrosoft Corporation

Demo

Page 8: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Slot 63 :: Resource-Only DLLs

Slot 1 :: ROM MODULE DLLs

Slots 2-32 :: Application Processes

Slots 33-58 :: Large Memory AreaMemory-Mapped Files

2 G

B ::

Use

r Spa

ce

Slot 62 :: Shared Heap Area

Slot 61 :: Read-Only FILE DLLs

Slot 60 :: Read-Only FILE DLLs

Slot 59 :: Device.exe Thread Stacks

Extra 64 MB of VM

Extra 8 MB of VM for Device Drivers

Slot 0 :: Alias of Active Process from other SlotsFILE DLLs reduce VM space for all Processes

Convert mshtml.dll to

FILE DLL to free 6 MB of VM

DLLs used exclusively by one process don’t take space from

other processes

Windows Mobile 6.1Better Slot Machine

Slot Fill Order

FILE DLLs MODULE DLLs

60, 61, 0 1, 0

Page 9: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Slot 63 :: Resource-Only DLLs

Slot 1 :: ROM MODULE DLLs

Slots 2-32 :: Application Processes

Slots 33-58 :: Large Memory AreaMemory-Mapped Files

2 G

B ::

Use

r Spa

ce

Slot 62 :: Shared Heaps

Slot 61 :: FILE + MODULE DLLs

Slot 60 :: FILE + MODULE DLLs

Slot 59 :: Device.exe Thread Stacks

Slot 0 :: Alias of Active Process from other SlotsFILE DLLs reduce VM space for all Processes

Faster MODULE DLLs whose VM is allocated at build time instead of runtime can go everywhere!

Process Threshold

of 28

Windows Mobile 6.5Best Slot Machine

Slot Fill Order

FILE DLLs MODULE DLLs

60, 61, 0 1, 61, 60, 0

Page 10: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Windows Mobile 6.5Faster performanceJPEG images decode faster by aligning buffer size to 128-byte boundary needed by hardware

Glyph Cache jumps from 8KB to 72KB for English and 128KB for Asian builds to boost font rendering speed

GDI used to draw text one character at a time; now draws the entire string in one shot

Switching Today screens and backgrounds repeatedly does not degrade device performance

Paging Pool is set to a minimum of 15 MB to boost application load performance

Minimum devices specs include a 400 MHz processor, 128 MB of RAM and 256 MB of ROM

Page 11: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Application Process SpaceNative

64 KB Guard Section

Image of EXE file (Code + Data + Resources)

64 KB/Thread Stack (Local Method Variables)

Heap (Object Instance Variables)

Free Virtual Memory

Other RAM DLLs + Your DLLs

Push

ing

Up

Push

ing

Dow

n

Large Memory Area (1 GB)Memory-Mapped Files

LoadLibrary

MapViewOfFileCreateFileMapping

32 M

B ::

Slot

Spa

ceBreakout

DLL Crunch

Page 12: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

64 KB Guard Section

Image of EXE file (Code + Data + Resources)

AppDomain Heap (CLR Data Structures)

JIT Heap (Current Call Stack)

64 KB/Thread Stack (Local Method Variables)

GC Heap (Object Instance Variables)

Free Virtual Memory

Other Native RAM DLLs

Large Memory Area (1 GB)NETCF Class LibrariesManaged EXEs + DLLs

RAM Allocated

though EXE is not used

IL in Call Stack is

pulled into Slot and JIT’d

32

MB

:: Sl

ot S

pace

Managed DLLs aren’t DLLs so they don’t negatively impact any slots

Application Process SpaceManaged

Breakout

In-ROM NETCF uses 650KB less

Slot VM

Page 13: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

64 KB Guard Section

Empty EXE file (5KB)

AppDomain Heap (CLR Data Structures)

JIT Heap (Current Call Stack)

64 KB/Thread Stack (Local Method Variables)

GC Heap (Object Instance Variables)

Free Virtual Memory

Other Native RAM DLLs

Large Memory Area (1 GB)NETCF Class LibrariesManaged EXEs + DLLs

32 M

B ::

Slot

Spa

ce

Application Lives in DLLs

using System; namespace OptimizedExe {     static class Program     {         [MTAThread]         static void Main()         {             OptimizedDLL.StartUp.Main();         }     } }

using System; using System.Windows.Forms;

namespace OptimizedDLL {     public class StartUp     {         public static void Main()         {             Application.Run(new Main());         }     } }

MemMaker PatternManaged development

Page 14: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

MemMaker PatternRob TiffanyMobility ArchitectMicrosoft Corporation

Demo

Page 15: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Other ways to Breakout

Fast Cache

Store data in the 1 GB large memory area via memory mapped files

Use IPC to access an in-memory Hashtable cache running in a different slot

Use IPC to access SQL Server Compact in a different slot

SQL Server Compact

Run database with a larger Max Buffer Size setting

Send SQL commands

Receive Generic Lists of strongly-typed objects

Page 16: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Summary

Windows Mobile 6.5 provides your games and apps with more virtual memory and performance than any previous release

Incorporating the MemMaker pattern for .NET Compact Framework development will automatically boost the amount of virtual memory available to your games and apps for better performance and stability

Page 17: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Question & Answer

Page 18: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

www.microsoft.com/teched

Sessions On-Demand & Community

http://microsoft.com/technet

Resources for IT Professionals

http://microsoft.com/msdn

Resources for Developers

www.microsoft.com/learningMicrosoft Certification and Training Resources

www.microsoft.com/learning

Microsoft Certification & Training Resources

Resources

Page 19: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

Complete an evaluation on CommNet and enter to win an Xbox 360 Elite!

Page 20: Rob Tiffany Mobility Architect Microsoft Corporation MOB401

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,

IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.