Download presentation
Presentation is loading. Please wait.
Published bySheryl Harrell Modified over 9 years ago
1
Better concurrency with a.NET language for isolation and asynchrony Niklas Gustafsson Parallel Computing Platform Microsoft Corporation Niklas.Gustafsson@microsoft.com © 2009 Microsoft Corporation1
2
Take-aways Concepts – Domains and agents – Channels and protocols – Schema – Dataflow networks Examples © 2009 Microsoft Corporation
3
Layers of a Concurrent Program Asynchronous Agents – Isolation, asynchrony Concurrent Collections – Parallelism, decomposition Interacting Infrastructure – Consistency Interacting Infrastructure Asynchronous Agents Concurrent Collections © 2009 Microsoft Corporation
4
Maestro Value Propositions Reduce complexity Provide a declarative model for serializing access to state Leverage latency Components default to concurrency Provide an application model that is inherently concurrent and responsive © 2009 Microsoft Corporation
5
Incubation Objectives Is language the better way to go? Does our model reduce complexity? Is it feasible and productive to incrementally adopt Maestro for legacy apps? Are we building it right? Syntax and semantics Missing concepts Conceptual consistency and composition Productivity Platform fit © 2009 Microsoft Corporation
6
Maestro from 50,000 Feet Imperative Actor-oriented Special-purpose Object-aware Concurrent by default © 2009 Microsoft Corporation
7
Ada Erlang SR (U of Arizona) Web-based Application Patterns © 2009 Microsoft Corporation Maestro Inspiration
8
Is a parallel system that: Runs on hundreds of millions of cores Is known to scale Is built by tens of thousands of programmers of average skill working in thousands of organizations Is remarkably robust Maybe there are some things we could learn from how it's programmed? © 2009 Microsoft Corporation The Web
9
Programming model aspects of relevance to manycore: Loosely coupled Strictly isolated components Globally concurrent, locally sequential Message-passing with simple protocols Partial failure is expected and common © 2009 Microsoft Corporation Web Programming
10
Sources Of Concurrency Asynchronous Agents – An agent has a separate “thread” of control Dataflow networks – Multiple nodes “light up” concurrently © 2009 Microsoft Corporation
11
Maestro: Core Concepts Domain Agent Channel Schema Pattern © 2009 Microsoft Corporation
12
Maestro: Application Structure Agent: Reader Shared State Agent: Reader Reader Agents Writer Agent Domain Shared State Reader Agent Writer Agent Schema Channel w/ protocol © 2009 Microsoft Corporation
13
Domain Passive construct Scope of global state Isolation boundary domain A { int j; int func( int k ) { } agent X : Channel1 { } agent Y : Channel2 { } } domain B { double m; string func( ) { } agent Z : Channel1 { } } © 2009 Microsoft Corporation
14
Agent Thread of control Communicates with other agents: – Intra-domain – Inter-domain Inheritance model Reader/Writer declaration domain A { int j; int func( int k ) { } writer agent X : Channel1 { } reader agent Y : Channel2 { } } domain B { double m; string func( ) { } agent Z : Channel1 { } } © 2009 Microsoft Corporation
15
Channel Agent proxy Duplex message- passing via ports Enforces value passing semantics Bi-lateral channels only, not a general "open mailbox" concept channel ChAddition { input int Add; output int Sum; } © 2009 Microsoft Corporation
16
Duality Of Ports © 2009 Microsoft Corporation Num1 Channel Num2 Sum Num1 Num2 Sum Agent Impl side Using side Each port is both a source and a target, depending on which side of the channel you are using it from, the channel perspective.
17
Pattern Enforces protocol rules Special states: start and end For channels and networks channel ChAddition { input int Add; output int Sum; Start: { Add -> S1; } S1: { Sum -> End; } } © 2009 Microsoft Corporation
18
Schema Fields Functions Constants Rules Serializable Strong name identity schema A { required String Name; optional Int32 Age = 0; rules { require String.IsNullOrEmpty(Name); require Age >= 0; } schema B { optional String Name; } B b =...; A a = b; A a = {Name = “John”, Age = 39}; © 2009 Microsoft Corporation
19
Dataflow Networks Think of data flowing through network – Not objects performing actions! Get data, do something with it, pass on to next stage(s) © 2009 Microsoft Corporation
20
Network Declarations Encapsulates DF layout Exposes ports Implementation details hidden in private methods and fields network N1 { input string RequestByKey; input int RequestBySize; output ResultRecord Result; public N1() { … } layout { RequestByKey ==> Search ==> Result; RequestBySize ==> szTbl.Find ==> Result; } private Map szTbl; } © 2009 Microsoft Corporation
21
Dataflow Examples Compiler: – Characters flow through lexer turning into tokens; – Tokens go through grammar turning into AST; – AST goes through several passes Spreadsheet: – Change in a cell triggers reevaluation of dependent cells; – Independent cells can change concurrently © 2009 Microsoft Corporation
22
Example: Image Processor ReadSharpenRed EyeShrinkSave © 2009 Microsoft Corporation Read JPG, Sharpen, Reduce “red eye” effect, Shrink, Save as 85% quality JPG Simple pipeline Network n1 = Read ==> Sharpen ==> RedEye ==> Shrink ==> Save;
23
Example: Image Processor (2) ReadSharpenRed EyeShrinkSave © 2009 Microsoft Corporation Simple branching Save Network n1 = (Read ==> Sharpen ==> RedEye); n1 - Save};
24
Example: Image Processor (3) ReadSharpenRed EyeShrinkSave © 2009 Microsoft Corporation Simple branching Network n1 = (Sharpen ==> RedEye ==> Shrink); Network n2 = (Sharpen ==> RedEye ==> Shrink); // or: n1.Clone(); Network n3 = (Sharpen ==> RedEye ==> Shrink); // or: n1.Clone(); Read - >- Save; SharpenRed EyeShrinkSharpenRed EyeShrink
25
Concurrency in Network Same model: one writer or multiple readers – Reader/writer of what? – Notation: methods write, true functions read © 2009 Microsoft Corporation Domain Reader Agent1 method1 method2 function1 function2 m1 m2 f1 f2 Writer Agent2 m1 m2 f1 f2 No Access Agent3 m1 m2 f1 f2
26
© 2009 Microsoft Corporation Example: Backup Utility
27
GUIController Profiles Backup Folder Monitor Configuration Log Backup Sched © 2009 Microsoft Corporation
28
We're planning a early-access public release through Microsoft DevLabs in the spring. Download it Play with it Build something with it Try to break it Tell us what you think Spread the word © 2009 Microsoft Corporation How to join the band…
29
© 2009 Microsoft Corporation Thank You © 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.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.