Nuno Filipe Godinho

All about WebDevelopment (ASP.NET & Silverlight)

Sponsors

November 2009 - Posts

PDC09 – Pre-Conference – Windows Bootcamp Part 8 – Multi-Touch

Architecture

  • Handled using a Driver Model that is implemented by the partners
  • Based on WM_Messages that are exchanged by the application and the Multi-touch Hardware

Development Tiers

  • Good
    • Everything that comes for free
    • APIs
      • Panning/Zoom gestures
      • Right-click Gestures
    • Native Win32
      • Controls with standard scrollbars
    • WPF4
      • Click Events
      • ScrollViewer
    • WinForms
      • Controls with standard scrollbars
  • Better
  • Best
    • Everything done before and even handle events that the Multi-touch supports

Coding with MultiTouch

  • Gestures
    • Native
    • .NET 4.0 / WPF
    • .NET 3.5
  • Raw Touch
    • Native
    • .NET 4.0 / WPF
    • Silverlght
    • .NET 3.5
  • Manipulation
    • Native
    • .NET 4.0 / WPF
    • .NET 3.5
  • Inertia
    • Native
    • .NET 4.0 / WPF
    • .NET 3.5

Gestures

  • One or two fingers “actions”
  • Pre-defined in the platform
  • On by default in Windows 7
  • Using WM_Gestures

Touch

  • Using WM_Touch
  • Similar to WM_Gestures but just a lot more of them
  • We need to opt-in to have Touch capabilities
  • In case of using Touch we won’t get Gestures any more, just Raw touch
Geneva Framework goes WIF – Windows Identity Foundation

   Geneva Framework has received a name change and now is called WIF – Windows Identity Foundation, since is the technology that will work with all types of Identity in the Microsoft world.

“It provides developers pre-built .NET security logic for building claims-aware applications, enhancing either ASP.NET or WCF applications.  Windows Identity Foundation makes it easeir to build richer, more secure applications (cloud and on-premise) without being a security and identity expert.  It will boost developer productivity, as a result, and enhance app security through a standard approach to federation, strong authentication and identity delegation.”

   I’ve made a simple wrap-up of the several interesting articles about WIF, and they are:

   Have good reading and tests with WIF

PDC09 – Pre-Conference – Windows Bootcamp Part 7 – Graphics Improvements in Windows 7

Windows 7 Usage of the GPU

  • Continues from Vista
    • Media Center UI
    • Video Playback
    • Desktop Window Manager (DWM)
  • Win7 DWM uses DirectX3D10.1 API
    • Scales in Performance all the way from low end integrated graphics cards to the highest level ones

Windows 7 High Color

  • Wider Gamur
    • Bigger then sRGB, eg. xvYCC, AdobeRGB
  • Higher precision
  • Higher Dynamic Range
  • Windows 7 provides
    • Color Calibration Tool
    • Gamma LUT Loader

High DPI Displays are now Common

  • Improvements in Windows UI & IE
    • Automatic Configuration in OOBE (Out-Of-Box-Experience)
    • Promotion the Control Panel UI for DPI

Current Challengues

  • 3D
    • Uses DX3..10
    • Challenges
      • Not always available
        • No Hardware
        • Server
    • New in Win7
      • usage of DirectX10.1
  • 2D
    • Uses GDI, GDI+
    • Challenges
      • Quality and Performance
    • New in Win7
      • usage of Direct2D
  • Text
    • GDI
    • Challenges
      • Quality, Not up to date
    • New in Win7
      • usage of DirectWrite
  • Imaging
    • GDI, GDI, WIC+
    • Challenges
      • Extensive Format
      • Support for Security
    • New in Win7
      • new WIC version
  • Device Control
    • GDI
    • Challenges
      • Outdated notion of devices
Windows Azure TCO and ROI Calculator

   One of the most asked questions about Windows Azure is what is the TCO (Total Cost of Ownership) and the ROI (Return of Investment) that we have in order to decide if we are going or not into the cloud.

   Based on this questions Windows Azure Team putted together a TCO and ROI Calculator that will help you make your decisions better, and also plan how much are you going to spend in Windows Azure and Windows Azure Service Platform in order to maintain your business going. This is very important because even when having things going into the cloud our management still need some predictability on the costs and also some numbers to support the decision of moving to the cloud.

   Start predicting and planning your TCO and ROI using this calculator here.

PDC09 – Pre-Conference – Windows Bootcamp Part 6/6 – Windows Sensors and Location

Sensor Platform Overview

  • Develop better and more productive user experiences
    • Enable environmentally adaptive user interface
  • Windows 7 features a unified API for working with sensors
    • No need to target vendor-specific APIs
    • Consistent interface for sensors, extensions for location
    • Access control and privacy

Sensor Platform Architecture

  • Applications
  • Sensor API
  • Sensor class extensions
  • UMDF Sensor Driver
  • Sensor Device

Sensor class extensions and Sensor API connect to the Location and Other sensors control panel

Privacy and Access Control

  • Sensor data is considered personal
    • User consent is required to share data
  • All sensors are disabled by default
  • Can be preconfigured per user/services
  • Administrator rights required to enabled a sensor

What is a Sensor?

  • Category and Type
    • Category, represents what is being sensed
    • Type, represents how it’s being sensed
  • Properties
    • Read-only (Model, Serial Number) or read-write (Report Interval)
    • Sensors may have custom properties
  • Data
    • Get sensor-specific data report object synchronously or asynchronously (recommended approach)
  • Events
    • State change, leave, data updated, other
  • State
    • Is sensor working properly? What is the problem?

Sensor API Architecture

  • Native/Win32 API
    • COM Based (includes sensorsapi.h and sensors.h)
    • Consist in the following interfaces
      • ISensorManager
      • ISensor
      • ISensorDataReport
  • Windows API CodePack
    • Managed class library to ease .NET Framework access to the Sensor and Location APIs

Location Platform

  • A single API call to answer. Where I am?
    • Enabled location based services
    • Adjust functionality based on location changes
  • Built on top of the sensor API
    • Automatic transition between providers (most accurate providers have priority)
    • Concurrent access for multiple applications
  • Managed Wrapper
  • In .NET 4 we’ll use the System.Devices namespace where this will be placed
PDC09 – Pre-Conference – Windows Bootcamp Part 5/6 – Windows 7 Libraries Integration

Overview

  • In previous versions of windows, users managed files in known folders locations
    • Documents, Pictures, Music, Videos
  • People store data “all over the place”
    • 54% of digital content lives outside the user profile
    • Most uses do both
    • Store content on net work shares
      • Home Groups
  • Allows us to specify which folders make the library
  • “Libraries are declarations where users can find and organize data collected from multiple folders”

“Under the Hood”

  • Library is kept in a file
    • Important: Don’t work with the file
  • Libraries is similar to a folder but only look at the folders

Integrating with Libraries

  • Common File Dialog
    • When we save a file on a Library by default is going to be saved into the default save location defined in the Library configuration
    • The new Common file dialog have built-in support for Libraries
    • Win32
      • Use IFileDialog native APIs
      • Do not use GetOpenFileName and SaveFileName

Library APIs

  • Shell APIs are COM Bases
  • User the Library objects, interfaces and functions you should
  • To Load Library
    • IShellLibrary
    • LoadLibraryFromKnownFolder
  • Shell Helper Functions (ShHelper.h)
  • ShellLibrary Class in the Windows API CodePack for Managed Code
  • SLUtil.exe is a command-line tools that enables us to manage libraries
    • More samples here.
PDC09 – Pre-Conference – Windows Bootcamp Part 4/6 – Windows 7 Taskbar

Key Goals

  • Things you use all the time are at your fingerprints
  • Manage your windows with confidence
  • You are in control
  • Clean and lightweight

Coding for the Windows Taskbar

  • Win32/C++
    • COM
      • iTaskbarList3
      • ICustomDestinationList
      • IShellItem
      • IShellLink
  • .NET

How are Windows Grouped?

  • ApplicationID
    • It’s a String, not a GUID
      • Limited to 128 characters
      • Naming Conventions – Company.Product.SubProduct
    • Design Considerations
      • Default: Computed by process name
      • Can be explicitly declared
        • Several executables, same application
        • Same executables (host), many applications
        • Multiple shortcuts
    • Setting the ApplicationID
      • Process-wide – affects all windows in the current process
      • C++
        • SetCurrentProcessExplicjtAppUserModelId(L”Microsoft.Samples.AppId1”)
      • .NET
        • TaskbarManager.SetCurrentProcessId(“Microsoft.Samples.AppId1”)

Taskbar Buttons

  • Consolidation
    • Quick launch
    • Notification area icon
    • Desktop shortcut
    • Running application Windows
  • Design Considerations
    • Only users can pin applications to taskbar
    • The icon’s hot-track color us the icon dominant color
    • Test icons with High DPI
    • Test with with various themes and glass colors
  • Get More from Taskbar Buttons
    • Overlay and Progress
      • Design considerations
        • Notification area is now user controlled
          • Leave yourself out if possible
        • Use taskbar buttons for custom progress or status information
  • Thumbnail toolbars
    • Design Considerations
      • You’ll get up to 7 buttons (hard-coded limit)
        • Once added, can’t delete
        • Can hide and disable
      • Behave as regular buttons
        • Listen to Events
    • API
      • C++
        • RegisterWindowMessage
        • ThumbBarAddButton
      • .NET
        • AddButtoons(IntPtr windowHandle, params ThumbnailToolbarButton[]) – WindowsForms
        • AddButtons(UIElement element, params ThumbnailToolbarButton[]) – WPF
  • Live Thumbnails
    • Custom Window Switchers
      • Use ITaskbarList3::RegisterTab, SetTabOrder

Taskbar + Windows Shell

  • Application Support
    • Common file dialogs
    • Known folders and libraries
    • Property System
  • Terminology
    • IShellItem – represents folders and files
    • IShellLink – represents shell shortcuts
    • IShellFolder – represents folders
  • Jump List
    • It’s a mini Start Menu for the application
      • The user is in control of what is part of the Jump List
    • Detailed Look
      • Destination (nouns) – Items that will be worked
        • Pinned Category
        • Known Category
          • Only 2 Known category exist and mutually exclusive on the API
            • Recent
            • Frequent
        • Custom Category
      • Tasks (verbs) - Actions
        • User Tasks
        • Taskbar Tasks
    • Design Considerations
      • Surface key destinations and tasks
        • Recent and frequent are free
        • Pinned is also free (if the user uses it)
        • Respect items the user removes
PDC09 – Pre-Conference – Windows Bootcamp Part 3/6 - Working Set Background

Working Set Background

  • Optimal usage of system memory – a constant area of investment
  • Working set: Comprises all the potentially trimmable virtual addresses for a given process, session or system resource
  • Resources like nonpaged pool, kernel stacks, large pages & AWE regions are excluded
  • Working sets provide an efficient way for the system to make memory available under pressure … but maintaining them is nor free

Working Set Aging/Trimming

  • Are periodically aged to improve trim decisions
  • Which sets and which virtual addresses to trim?
  • How much to trim?
  • Memory events so applications can trim?

General Policies of Working Sets

  • How is optimal usage achieved?
    • Ordered based on their age distribution
    • Trim goal is set higher to avoid subsequent additional trimming
    • After the goal is meet other sets continue to be trimmed – bus just for their very old pages. This provides fairness so one process doesn’t surrender pages and the others not.
    • Up to 4 pages may be performed later passes consider higher percentages of each working set and lower ages (more recently accessed) as well
    • When trimming does occur, all sets are also aged so future trims have optimal aging

Working Set improvements

  • Expansion to 8 aging values
  • Keep exact age distribution counts instead of estimates
  • Force self-aging and trimming during rapid expansion
  • Don’t skip processes due to lock contention and ensure fair aging by removing pass limits
  • Separation of the system cache working set into 3 distinct working sets (system cache, paged pool and driver images)
    • Now we can apply minimums to each one making it more manageable and interesting
  • Factor in standby list repurposing when making age/trim decisions
    • Any pages that are reference by your application are immediately protected by the factor in the standby list
  • Improved inpage clustering of system addresses
  • RESULTS: Doubling of performance in memory constrained systems 

PFN Lock Background

  • The Page Frame Number (PFN) array is virtually continuous (but can be physically sparse)
  • The Problem
    • The huge majority of virtual memory operations were synchronized via a single system-wide PFN lock.
    • Large number of processors and memory sizes identify the lock pressure. Prior to this change SQL Server had an 88% PFN lock contention rate on systems with 128 processors
    • Applications and device drivers seeking higher performance faced significance complexity at best
  • The Answer
    • In Windows 7 the system wide PFN lock was replaced with the fine-grained locking on an individual page basis
    • This completely eliminated the bottleneck, resulting in much higher scalability.
PDC09 – Pre-conference – Windows 7 Bootcamp Part 2/6 – Core Kernel Changes

More Core Platform Support

  • Supporting Mode than 64Lps
    • Introduction of the Processor Groups
      • Windows Server 2008 R2 introduces processor Groups
        • Each processor groups can contain up to 64 LPs
        • System support up to 4 groups in this release
        • Maintains compatibility with legacy systems
  • Processes and Threads
    • Processes can  contain threads executing in multiple groups
    • Processes are assigned groups in round robin fashion
    • Threads are assigned to a group based on:
      • Inheritance from creating thread
      • Using new group affinity API
  • Task Based Scheduling
    • Runtime support task based concurrency want to control when and where tasks execute
    • Why not use kernel threads to represent tasks
      • Context switches between threads involve the kernel scheduler
      • Runtime loses control when blocking event occurs
  • UMS – User Mode Scheduling
    • Enables switching between threads in user mode
    • Returns control to the runtime when a thread blocks in the kernel
    • Architecture
      • Divides threads into a user and kernel portion
        • Together these comprise a UMS Worker Thread
      • Creates to views of what is being made
      • When a Worker thread enters the kernel
        • porting of the Scheduler thread enters wait state
        • Worker thread wakes and executes kernel service
          • Ensures correct kernel state for the Worker Thread
  • The Dispatcher Lock
    • Dispatcher database lock originally protected the integrity of all scheduler related data structures
    • Over time additional locks introduced to reduce contention
      • Thread locks, timer table locks, PRCB locks
      • Still synchronizes
    • Replaced in Windows 7 by Coarse-Grained lock
      • Well defined locking hierarchy
      • Per-object locking used for object paths
      • Many Operations are lock-free
      • Uses transactional semantics for waits
PDC09 – Pre-Conference - Windows 7 BootCamp Part 1/6 - Introduction

Introduction to the Windows 7 BootCamp

Key Windows Kernel Changes

  • Performance
    • Footprint reduction
    • Memory optimizations
    • Working set management improvements
    • Perftrack
  • Power efficiency
    • Core Parking
      • Trying to make cores going to sleep if they are not needed
    • Unified Background Process Manager
    • Timer Coalescing
    • Tick Skipping
  • Reliability
    • Fault Tolerant Heap
    • Process Reflection
    • Native VHD
      • Ability to mount and manage VHDs
      • Boot-from-VHD
    • Scalability
      • Simultaneous Multithreading Improvements
      • User Model Scheduling
      • Support for > 64 logical processors
      • Lock removal, including PFM, dispatcher locks
  • Security
    • New UAC operating models
    • Managed Service accounts
      • Allows a service to run isolated form other services
    • Bitlocker-to-go
      • Extends the  previous versions in order to encrypt USB disks and we can use it in any other OS since it launches the Bitlocker-To-Go plugin in order to get access to the elements of the USB disks
    • Windows Biometric Framework
    • App Locker
    • Auditing improvements
      • New Object global auditing in order to get information about why the user has or doesn’t have access to same information
More Posts Next page »