TOPICS WHAT YOU’LL LEAVE WITH WHO WILL BENEFIT FROM THIS TALK.NET developers: familiar with parallel programming support in Visual Studio 2010 and.NET.

Slides:



Advertisements
Similar presentations
Luis Guerrero UX Software Arquitect Plain Concepts
Advertisements

Hazim Shafi Principal Architect Microsoft Corporation TL19.
Parallel Performance Tools in Visual Studio 2010.
TechReady 16 4/1/2017 Async Clinic
James Kolpack, InRAD LLC popcyclical.com. CodeStock is proudly partnered with: Send instant feedback on this session via Twitter: Send a direct message.
Parallel Extensions to the.NET Framework Daniel Moth Microsoft
FUTURE OF.NET PARALLEL PROGRAMMING Joseph Albahari SESSION CODE: DEV308 (c) 2011 Microsoft. All rights reserved.
System.Threading.Tasks Task Represents an asynchronous operation Supports waiting, cancellation, continuations, … Parent/child relationships 1 st -class.
 Niklas Gustafsson Software Architect Microsoft Corporation TL22.
Cole Durdan.  What is asynchronous programming?  Previous patterns  Task Based Async Programming .NET 4.5 Keywords  What happens in an async. method?
Joe Hummel, PhD Microsoft MVP Visual C++ Technical Staff: Pluralsight, LLC Adjunct Professor: U. of Illinois, Chicago and Loyola University Chicago
{ async patterns } - or - using the asynchronous library in the.Net 4.5 Framework for more than keeping your UI responsive.
Stephen Toub Parallel Computing Platform Microsoft Corporation.
Async Programming WITH ASYNC TASK
Virtual techdays INDIA │ 9-11 February 2011 Parallelism in.NET 4.0 Parag Paithankar │ Technology Advisor - Web, Microsoft India.
Parallel Programming in Visual Studio 2010 Sasha Goldshtein Senior Consultant, Sela Group
Daniel Moth  Parallel Computing Platform Microsoft Corporation TL26.
Windows Core OS Services JavaScript (Chakra) C C++ C# VB Metro style apps Communication & Data Application Model Devices & Printing WinRT APIs Graphics.
WHO WILL BENEFIT FROM THIS TALK TOPICS WHAT YOU’LL LEAVE WITH Web app developers who are already familiar with Windows Azure with scaling needs. Asynchronous.
Multi-paradigm language Type inferred Just another.NET language Tools First-class language in VS2010* F# Interactive Window F# PowerPack F# = Fun.
Introducing Xamarin 2.0 Introducing Xamarin 2.0 Michael Hutchinson
Managed Code Generics Language Integrated Query Dynamic + Language Parity C# VB 11.0 Windows Runtime + Asynchrony C# VB 7.0 C# VB.
 George Chrysanthakopoulos Software Architect Microsoft Corporation.
A Top Level Overview of Parallelism from Microsoft's Point of View in 15 minutes IDC HPC User’s Forum April 2010 David Rich Director Strategic Business.
Phil Pennington Sr. Developer Evangelist Microsoft Corporation SESSION CODE: WSV325.
Joe Hummel, PhD Technical Staff: Pluralsight Adjunct Professor: UIC, LUC
DEV301. // Synchronous TResult Foo(...); // Asynchronous Programming Model (APM) IAsyncResult BeginFoo(..., AsyncCallback callback, object state);
Parallel Extensions A glimpse into the parallel universe By Eric De Carufel Microsoft.NET Solution Architect at Orckestra
Parallel Programming in.NET 4.0 Tasks and Threading Ingo Rammer, thinktecture
Parallel Extensions A glimpse into the parallel universe Eric De Carufel
Parallel Programming: Responsiveness vs. Performance Joe Hummel, PhD Microsoft MVP Visual C++ Technical Staff: Pluralsight, LLC Professor: U. of Illinois,
About Me Microsoft MVP Intel Blogger TechEd Israel, TechEd Europe Expert C++ Book
public static void PausePrintAsync() { ThreadPool.QueueUserWorkItem(_ => PausePrint()); } public static Task PausePrintAsync() { return Task.Run(()
Joe Hummel, PhD Microsoft MVP Visual C++ Technical Staff: Pluralsight, LLC Professor: U. of Illinois, Chicago stuff:
Expressing Parallel Patterns in Modern C++ Rahul V. Patil Microsoft C++ Parallel Computing Team Note: this is a simplified version of the deck used in.
 Joshua Goodman Group Program Manager Microsoft Corporation.
Parallel Extensions A glimpse into the parallel universe By Eric De Carufel Microsoft.NET Solution Architect at Orckestra
WHO WILL BENEFIT FROM THIS TALK TOPICS WHAT YOU’LL LEAVE WITH ASP.NET developers, including Web Forms & MVC History of async programming in.NET How async.
Barry Wimlett Technical Specialist BSc MBCS blackmarble.com.
C# 2.0 and Future Directions Anders Hejlsberg Technical Fellow Microsoft Corporation.
Huseyin YILDIZ Software Design Engineer Microsoft Corporation SESSION CODE: DEV314.
IAsyncResult ar = BeginSomething(…); // Do other work, checking ar.IsCompleted int result = EndSomething(ar);
Asynchronous Programming Writing Asynchronous Code in C# SoftUni Team Technical Trainers Software University
This deck has 1-, 2-, and 3- slide variants for C++ AMP If your own deck uses 4:3, get with the 21 st century and switch to 16:9 ( Design tab, Page Setup.
Module 8 Enhancing User Interface Responsiveness.
Parallel Pattern Library Resource Manager Task Scheduler Task Parallel Library Task Parallel Library Parallel LINQ Managed Native Key: Threads Operating.
LINQ & PLINQ (Parallel) Language Integrated Query.
TAP into async programming
TOPICS WHAT YOU’LL LEAVE WITH WHO WILL BENEFIT FROM THIS TALK.NET library developers : with knowledge of async/await in C# / VB interested in low-level.
Asynchrony in (ASP).NET Aliaksandr
Patterns of Parallel Programming with.NET 4 Stephen Toub Principal Architect Parallel Computing Platform Microsoft Corporation
C# Present and Future Marita Paletsou Software Engineer.
C# 5.0 Alex Davies 22 nd December What we will cover C# 5.0,.NET 4.5, Visual Studio 11 Caller Info Attributes Upgrade from synchronous to asynchronous.
Task and Data Parallelism: Real-World Examples Sasha Goldshtein | SELA Group.
Async Made Simple in Windows 8, with C# and Visual Basic Alex Turner Program Manager VB/C# Compilers Microsoft Corporation DEV332.
Asynchronous Programming Writing Concurrent Code in C# SoftUni Team Technical Trainers Software University
Wely Microsoft MVP, Visual C#
The Future of C# and Visual Basic
Async or Parallel? No they aren’t the same thing!
Lighting Up Windows Server 2008 R2 Using the ConcRT on UMS
Staying Afloat in the .NET Async Ocean
C++ Forever: Interactive Applications in the Age of Manycore
12 Asynchronous Programming
null, true, and false are also reserved.
F# for Parallel and Asynchronous Programming
Build /2/2019 © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
JavaScript Reserved Words
Patterns for Programming Shared Memory
Patterns for Programming Shared Memory
.NET Core Summer event 2019 – Brno, CZ
Presentation transcript:

TOPICS WHAT YOU’LL LEAVE WITH WHO WILL BENEFIT FROM THIS TALK.NET developers: familiar with parallel programming support in Visual Studio 2010 and.NET 4 interested in parallelism, concurrency, and asynchrony.NET 4 &Visual Studio 2010: Recap.NET 4.5 & Visual Studio 11 Better performance Async in C# / Visual Basic More control TPL Dataflow New debugging windows New profiler visualizations Knowledge of improvements to existing parallelism libaries Knowledge of new parallelism libraries and compiler support Knowledge of new debugging and profiling support for parallel programming Understanding of the past, present, and future of parallelism in.NET and Visual Studio

Parallel Pattern Library Task Parallel Library Parallel LINQ Managed Native Key: Windows Operating System Runtime Programming Models CLR ThreadPool Task Scheduler Resource Manager Data Structures Tools Tooling Parallel Debugger Concurrency Visualizer Async Agents Library Async Agents Library Stacks Tasks Threads Cores F# ConcRT Task Scheduler Resource Manager CPU private static ConcurrentDictionary m_data = new ConcurrentDictionary (); private static string GetValue(Uri url) { return m_data.GetOrAdd(url, u => Download(u)); } let runAll() = urlList |> Seq.map fetchAsync |> Async.Parallel |> Async.StartAsTask var results = from item in LoadData().AsParallel() where IsValid(item) orderby item ascending select ComputeResult(item); Task.Factory.StartNew(() => { Parallel.For(0, 1000, i => { Compute(i); }); }

This is synchronous code with.NET 4… public void CopyStreamToStream(Stream source, Stream destination) { byte[] buffer = new byte[0x1000]; int numRead; while ((numRead = source.Read(buffer, 0, buffer.Length)) != 0) { destination.Write(buffer, 0, numRead); } }

This is async (but blocking) code with.NET 4…

This is async code with.NET 4… public void CopyStreamToStream(Stream source, Stream destination) { byte[] buffer = new byte[0x1000]; int numRead; while ((numRead = source.Read(buffer, 0, buffer.Length)) != 0) { destination.Write(buffer, 0, numRead); } } public IAsyncResult BeginCopyStreamToStream( Stream source, Stream destination, AsyncCallback callback, object state) { var tcs = new TaskCompletionSource (state); if (callback != null) tcs.Task.ContinueWith(_ => callback(tcs.Task)); var buffer = new byte[0x1000]; Action readWriteLoop = null; readWriteLoop = iar => { try { for (bool isRead = iar == null; ; isRead = !isRead) { switch (isRead) { case true: iar = source.BeginRead(buffer, 0, buffer.Length, readResult => { if (readResult.CompletedSynchronously) return; readWriteLoop(readResult); }, null); if (!iar.CompletedSynchronously) return; break; case false: int numRead = source.EndRead(iar); if (numRead == 0) { tcs.TrySetResult(null); return; } iar = destination.BeginWrite(buffer, 0, numRead, writeResult => { if (writeResult.CompletedSynchronously) return; destination.EndWrite(writeResult); readWriteLoop(null); }, null); if (!iar.CompletedSynchronously) return; destination.EndWrite(iar); break; } } } catch (Exception e) { tcs.TrySetException(e); } }; readWriteLoop(null); return tcs.Task; } public void EndCopyStreamToStream(IAsyncResult asyncResult) { ((Task)asyncResult).Wait(); }

This is async code with.NET 4.5… public void CopyStreamToStream(Stream source, Stream destination) { byte[] buffer = new byte[0x1000]; int numRead; while ((numRead = source.Read(buffer, 0, buffer.Length)) != 0) { destination.Write(buffer, 0, numRead); } } public async Task CopyStreamToStreamAsync(Stream source, Stream destination) { byte[] buffer = new byte[0x1000]; int numRead; while ((numRead = await source.ReadAsync(buffer, 0, buffer.Length)) != 0) { await destination.WriteAsync(buffer, 0, numRead); } }

This is async code with.NET 4.5… public void CopyStreamToStream(Stream source, Stream destination) { byte[] buffer = new byte[0x1000]; int numRead; while ((numRead = source.Read(buffer, 0, buffer.Length)) != 0) { destination.Write(buffer, 0, numRead); } }

ActionBlock Message Queue Process(0);Process(1);Process(2);Process(3); Process(4); var ab = new ActionBlock (i => { Process(i); }); for(int i = 0; i < 5; i++) { ab.Post(i); }

TransformBlock Compress TransformBlock Encrypt compresse d dataand encrypted

Parallel Pattern Library Task Parallel Library PLINQ Manage d Native Key: Windows Operating System Runtime Programming Models CLR ThreadPool Task Scheduler Resource Manager Data Structures Tools Tooling Parallel Debugger Concurrency Visualizer Async Agents Library Async Agents Library Stacks Tasks Watch CPU Threads Cores C#/VB/F# Async Dataflo w C++ AMP DirectX GPU CPU GPU ConcRT Task Scheduler Resource Manager New Update d IEnumerable TakeTop ( this IEnumerable source, int count) { return source.AsParallel().OrderBy(k => k).Take(count); } var tl = new ThreadLocal (trackAllValues: true); Parallel.For(0, 1000, i => { tl.Value += Compute(i); }); int result = tl.Values.Sum(); var consumer = new ActionBlock ( item => Process(item)); … consumer.Post(42); consumer.Post(43); … async Task ReplaceAsync(Stream input, string oldText, string newText) { string contents = await new StreamReader(input).ReadToEndAsync(); return contents.Replace(oldText, newText); } Task t = Task.WhenAny( Task.Delay(10000)), Task.Run(() => Parallel.ForEach(…)));

RELATED SESSIONSARTICLES, SAMPLES, VIDEOS, BLOGS IDTitleSpeaker TOOL-834TWhat's new in.NET Framework 4.5 Joshua Goodman TOOL-816TFuture directions for C# and Visual Basic Anders Hejlsberg TOOL-810TAsync made simple in Windows 8, with C# and Visual Basic Mads Torgersen; Alex Turner SAC-804TBuilding IIS and ASP.NET apps with the power of async Damian Edwards SAC-808TBuilding parallelized apps with.NET and Visual Studio Stephen Toub TOOL-829TThe zen of async: Best practices for best performance Stephen Toub TOOL-802TTaming GPU compute with C++ AMP Daniel Moth TOOL-835TWriting modern C++ code: how C++ has evolved over the yearss Herb Sutter ncy