platform architecture mike zintel development manager.net compact framework microsoft corporation
TRANSCRIPT
Platform Architecture Platform Architecture
Mike ZintelMike ZintelDevelopment ManagerDevelopment Manager.NET Compact Framework.NET Compact FrameworkMicrosoft CorporationMicrosoft Corporation
AgendaAgenda
Design goalsDesign goals Internals of the platformInternals of the platform Key features that enable applicationsKey features that enable applications
Platform Design GoalsPlatform Design Goals
Portable & small .NET Common Portable & small .NET Common Language RuntimeLanguage Runtime
Leverage .NET toolsLeverage .NET tools Run .EXEs generated by .NET toolsRun .EXEs generated by .NET tools Cross-debug with VS.NETCross-debug with VS.NET
Peacefully co-exist with host OSPeacefully co-exist with host OS Scheduling, UI display surface & input, Scheduling, UI display surface & input,
resource contentionresource contention
Enable rich client Web Services appsEnable rich client Web Services apps GUI, local storage, networkingGUI, local storage, networking
.NET Terminology.NET Terminology
Execution Engine (EE)Execution Engine (EE) Common Language Runtime (CLR)Common Language Runtime (CLR) .NET Compact Framework.NET Compact Framework Programming FrameworksProgramming Frameworks
Class LibrariesClass Libraries
Native Code, Managed Code, ILNative Code, Managed Code, IL Common Language Runtime Common Language Runtime
ApplicationsApplications OEM ApplicationOEM Application
Developing A .NET AppDeveloping A .NET App
Testing on Window s
Target Platforms
.NET CF
.NET CF Execution Engine
.NET CF Class Libraries
CLR Application (.EXE & DLLs)
Win32 PAL
Windows
.NET CF Execution Engine
.NET CF Class Libraries
CLR Application (.EXE & DLLs)
Host O/S PAL & NSLs
Host Operating System
VS.NET
.NET Compilers
VS.NET Source Code
(Multiple Lang.) .NET CF Class Libraries
Edit Compile
Development
Run & Debug
Deploy
.NET CLR Features.NET CLR Features
Verifiable typesafe executionVerifiable typesafe execution No unsafe casts, no uninitialized variables, No unsafe casts, no uninitialized variables,
no out of bounds array indexing, no bad no out of bounds array indexing, no bad pointer mathpointer math
Garbage CollectionGarbage Collection No ref-counting, no leaksNo ref-counting, no leaks
JIT compilationJIT compilation Portable & fastPortable & fast
Common type systemCommon type system Call, inherit, and source-level debug across Call, inherit, and source-level debug across
different languagesdifferent languages
.NET API Design.NET API Design
Code and data are expressed as classesCode and data are expressed as classes Described in metadata, no .h or idl filesDescribed in metadata, no .h or idl files Inheritance can be used to extend a classInheritance can be used to extend a class
APIs work across languagesAPIs work across languages APIs are organized in namespaces with APIs are organized in namespaces with
strong naming conventionsstrong naming conventions Garbage Collection eliminates memory Garbage Collection eliminates memory
ownership issuesownership issues
.NET Error Handling.NET Error Handling
Error handling through exceptionsError handling through exceptions Not bools or HRESULTSNot bools or HRESULTS
Error handling is mandatoryError handling is mandatory Default isn’t to “muddle on”Default isn’t to “muddle on”
Descriptive exception messagesDescriptive exception messages Not cryptic HRESULTSNot cryptic HRESULTS
Language SupportLanguage Support
Plans for… Plans for… C#C# VB.NETVB.NET JScript (ECMAScript)JScript (ECMAScript)
Will deliver in staggered fashionWill deliver in staggered fashion Platform extensible to other languagesPlatform extensible to other languages VS.NET packages planned for C#, VBVS.NET packages planned for C#, VB
Different Types of Host O/SDifferent Types of Host O/S
Static address spaceStatic address space System image defined at manufacturing timeSystem image defined at manufacturing time pSOS, OSE, many custom O/SpSOS, OSE, many custom O/S Boot loader onlyBoot loader only No “application” loader or interactive shellNo “application” loader or interactive shell CLR adds app loader, makes system extensibleCLR adds app loader, makes system extensible
Apps run in “App Domains”Apps run in “App Domains”
Dynamic address spaceDynamic address space Boot loader & application loaderBoot loader & application loader Windows, UnixWindows, Unix Shell is provided by the O/SShell is provided by the O/S
System ArchitectureSystem Architecture
.NET Compact Framework
Host O/S
CLR Apps
Host O/S Apps
CLR
App Domain Host
CLR Apps
Host O/S Services Boot Loader Timers Hardware Drivers Threads Networking Sync Filesystems
Base Frameworks (Class Libs)
Platform Adaptation Layer (PAL)
Execution Engine App Domain Loader Instruction Engine/JIT Class Loader Garbage Collection Verifier P/Invoke Debugger
Platform Extension Frameworks
Native Support Libs (NSL)
managed
native
launch
Hardware
Execution EngineExecution Engine
Class loader, verifier, JIT, GC, exception Class loader, verifier, JIT, GC, exception handling, code access security, handling, code access security, debuggingdebugging
Provides hardware and O/S independent Provides hardware and O/S independent program executionprogram execution
No MMU required on the target CPUNo MMU required on the target CPU Garbage collection eliminates reference Garbage collection eliminates reference
counting and leakscounting and leaks JIT architecture for fast executionJIT architecture for fast execution
Supported Data TypesSupported Data TypesI1 (SByte) 8-bit 2's complement signed value
U1 (Boolean , Byte) 8-bit unsigned binary value
I2 (Int16) 16-bit 2's complement signed value
U2 (Uint16, Char) 16-bit unsigned binary value
I4 (Int32) 32-bit 2’s complement signed value
U4 (UInt32) 32-bit unsigned binary value
I8 (Int64) 64-bit 2’s complement signed value
U8 (UInt64) 64-bit unsigned binary value
R4 (Float) 32-bit IEEE 754 floating point value
R8 (Double) 64-bit IEEE 754 floating point value
O natural size object reference to managed memory
& natural size managed pointer (may point into managed memory)
* Natural size unmanaged pointer
Array
String Unicode string class
Same as on the full .NET FrameworkSame as on the full .NET Framework
Native Code InteroperabilityNative Code Interoperability
IssuesIssues Calling conventionsCalling conventions Garbage collectionGarbage collection Security Vs. extensibilitySecurity Vs. extensibility
Platform Invoke (P/Invoke)Platform Invoke (P/Invoke) Managed Managed Native Native
IL_CallDelegateIL_CallDelegate Native Native Managed Managed
Inter-App Domain Message PassingInter-App Domain Message Passing
App DomainsApp Domains
Runtime construct that supports a Runtime construct that supports a running applicationrunning application Logical container of application threadsLogical container of application threads Provides memory isolationProvides memory isolation
Single execution engine instance can Single execution engine instance can support multiple app domainssupport multiple app domains
Execution engine ensures all resources Execution engine ensures all resources are released on app terminationare released on app termination
App Domain HostsApp Domain Hosts
Bootstrap the execution engineBootstrap the execution engine Written in C, call C APIs to start, pause Written in C, call C APIs to start, pause
and stop CLR applicationsand stop CLR applications Few constraints on execution modelsFew constraints on execution models
Loader hooks on Windows & Windows CELoader hooks on Windows & Windows CE Web server in ASP.NETWeb server in ASP.NET SQL uses CLR for stored proceduresSQL uses CLR for stored procedures Graphical shell or browser as shellGraphical shell or browser as shell
SecuritySecurity
Type-safetyType-safety On-device verification for software isolationOn-device verification for software isolation
Code Access Security with simple policyCode Access Security with simple policy Evidence determines access permission bucketsEvidence determines access permission buckets Evidence includes location, signing, banned listEvidence includes location, signing, banned list
Protocol for remote policy configurationProtocol for remote policy configuration Add/remove apps from banned listAdd/remove apps from banned list
User Identity/authenticationUser Identity/authentication Exposed through the PALExposed through the PAL
Network securityNetwork security SSL for Web Services, secure email, commerceSSL for Web Services, secure email, commerce
System qualitySystem quality
Remote Debugging, VS.NETRemote Debugging, VS.NET
File copy and run (F5)File copy and run (F5) Source code breakpointsSource code breakpoints Source code single-stepSource code single-step Stack traceStack trace Variable inspectionVariable inspection Thread suspend/resumeThread suspend/resume Data watchpointsData watchpoints Multiple device transportsMultiple device transports
Application InstallationApplication Installation
InstallInstall Copy files, perform configuration tasksCopy files, perform configuration tasks
UninstallUninstall Deletes filesDeletes files Dynamic dependency walk removes Dynamic dependency walk removes
orphaned shared componentsorphaned shared components Perform configuration tasksPerform configuration tasks
Shared class lib versioningShared class lib versioning ““Never break a functioning app”Never break a functioning app” Apps are written to specific class lib Apps are written to specific class lib
version or “latest”version or “latest”
GUI ArchitectureGUI Architecture
Two flavorsTwo flavors Generic – provides cross-OS portabilityGeneric – provides cross-OS portability
Drawing primitivesDrawing primitives Controls and FormsControls and Forms OEM-customizable look and feelOEM-customizable look and feel
Windows FormsWindows Forms Supersets generic functionalitySupersets generic functionality Available for Windows CE devicesAvailable for Windows CE devices Consistent with WinForms on .NET FrameworkConsistent with WinForms on .NET Framework Drag n’ drop UI designer in Visual StudioDrag n’ drop UI designer in Visual Studio
Basic NetworkingBasic Networking
Platform Adaptation Layer (PAL)
CLR Apps
Hardware
Execution Engine
Host O/S
.NET Compact Framework
TCP/IP TCP, UDP
IrDA TinyTP
Bluetooth L2CAP
SMS
WAP, others
interfaces PPP/serial PPP/IrDA PPP/Bluetooth 802.xx
interfaces IrDA USB serial
HTTP Client Libs/Universal Listener XML Libs
Web Service Libs
Sockets API (name resolution, discovery, data) Connection Management API
Phone Book
Network ThreadingNetwork Threading
Apps can make synchronous (blocking) Apps can make synchronous (blocking) or asynchronous callsor asynchronous calls
Synchronous calls run on the caller’s Synchronous calls run on the caller’s threadthread
The system spins threads to support The system spins threads to support asynchronous callsasynchronous calls Threads terminate after a short no-use Threads terminate after a short no-use
timeouttimeout
Web Services & DevicesWeb Services & Devices
Clean, protocol level separation of Clean, protocol level separation of publishing and usagepublishing and usage Many producers, many consumersMany producers, many consumers
Separation of data from presentation Separation of data from presentation enables rich client applicationsenables rich client applications
Client applications can aggregate web Client applications can aggregate web services from multiple sourcesservices from multiple sources
Client applications can control Client applications can control “chunkiness” of transfers“chunkiness” of transfers
.NET CF can execute VS.NET generated .NET CF can execute VS.NET generated client proxy codeclient proxy code
PerformancePerformance
JIT compilationJIT compilation Focus on resource constrained devicesFocus on resource constrained devices Scalable to more capable devicesScalable to more capable devices TunableTunable Tradeoff different memory typesTradeoff different memory types
Memory UsageMemory Usage
CLR Apps .EXE and .DLLs
ROM
Execution Engine Code
RAM
App Domain Host Data
CLR Apps .EXE and .DLL
FLASH
R/O Filesystem
App Domain Host Code
Host O/S Code
R/W Filesystem
Host O/S Data
Execution Engine Data
CLR App Data
Object Data. JIT Cache. Released on app exit.