Agus Kurniawan Microsoft MVP. Blog

Similar documents
An Introduction to What s Available in.net 4.0 PARALLEL PROGRAMMING ON THE.NET PLATFORM

Supercomputing and Mass Market Desktops

Parallelism Marco Serafini

VS08 This One Goes to Going Parallel with PFX, PLINQ, TPL and Async Keywords

DNParallel - Version: 3. TPL Dataflow

MCSA Universal Windows Platform. A Success Guide to Prepare- Programming in C# edusum.com

Database Architectures

Multiple processes can run in parallel on a single computer and multiple threads can run in parallel in a single process.

Patterns of Parallel Programming with.net 4. Ade Miller Microsoft patterns & practices

Implementing and Supporting Windows Intune

Manoj Agarwal Senior Development Lead BizTalk Server Product Team Microsoft India Development Center

Computation Abstractions. Processes vs. Threads. So, What Is a Thread? CMSC 433 Programming Language Technologies and Paradigms Spring 2007

COMP 633 Parallel Computing.

CIT 668: System Architecture

The Various Faces of the.net Task Parallel Library

The Beauty and Joy of Computing

DBArtisan 8.6 New Features Guide. Published: January 13, 2009

Xiaoying Guo Program Manager Microsoft Server and Tools China Session Code: DEV377

Concurrency & Parallelism, 10 mi

Le L c e t c ur u e e 7 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Multithreading

Pro.NET 4 Parallel Programming in C#

An Introduction to Parallel Programming

Nicholas Dritsas Principal Program Manager Microsoft Corporation Microsoft Corporation. All rights reserved

THREADS & CONCURRENCY

Virtualization And High Availability. Howard Chow Microsoft MVP

Saranya Sriram Developer Evangelist Microsoft Corporation India

Break Through Your Software Development Challenges with Microsoft Visual Studio 2008

Andrew Coates Microsoft Australia Session Code: OFC343

Martin Kruliš, v

2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or

Multithreading and Interactive Programs

Concurrency, Thread. Dongkun Shin, SKKU

Threads & Concurrency

Threads & Concurrency

Programming C# 5.0. Ian Griffiths O'REILLY' Beijing Cambridge * Farnham Kbln Sebastopol Tokyo

Multithreading and Interactive Programs

Intel Parallel Studio 2011

Database Architectures

Microsoft Visual C# Step by Step. John Sharp

Availability and Performance for Tier1 applications

Manage program flow. Have you read page xxi? Objectives in this chapter:

Using Intel VTune Amplifier XE and Inspector XE in.net environment

Fractal: A Software Toolchain for Mapping Applications to Diverse, Heterogeneous Architecures

Optimize an Existing Program by Introducing Parallelism

What s new in ASP.NET 3.5? Mike Ormond Developer & Platform Group Microsoft Ltd

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne

Threads and Too Much Milk! CS439: Principles of Computer Systems January 31, 2018

Administration. Prerequisites. Website. CSE 392/CS 378: High-performance Computing: Principles and Practice

In-memory data pipeline and warehouse at scale using Spark, Spark SQL, Tachyon and Parquet

High Performance Computing Course Notes Shared Memory Parallel Programming

Efficiently Introduce Threading using Intel TBB

High-Performance Parallel Computing

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

Shared Memory Programming with OpenMP (3)

Overview. CMSC 330: Organization of Programming Languages. Concurrency. Multiprocessors. Processes vs. Threads. Computation Abstractions

User Space Multithreading. Computer Science, University of Warwick

Karthik Bharathy Program Manager, SQL Server Microsoft

Heckaton. SQL Server's Memory Optimized OLTP Engine

Threads and Too Much Milk! CS439: Principles of Computer Systems February 6, 2019

New Challenges in Microarchitecture and Compiler Design

Introduction to Multicore architecture. Tao Zhang Oct. 21, 2010

Microsoft. Microsoft Visual C# Step by Step. John Sharp

Chapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads

Parallel Functional Programming Lecture 1. John Hughes

03 Features of C#, Part 2. Jerry Nixon Microsoft Developer Evangelist Daren May President & Co-founder, Crank211

Parallelizing Ocean plug-in computations using the Background Worker + PFX pattern

THREADS AND CONCURRENCY

Optimizing Performance for Partitioned Mappings

Multithreading Deep Dive. my twitter. a deep investigation on how.net multithreading primitives map to hardware and Windows Kernel.

Multi-Core Programming

Повышение энергоэффективности мобильных приложений путем их распараллеливания. Примеры. Владимир Полин

Intel Thread Building Blocks, Part II

Multithreaded Programming

Grand Central Dispatch

Huge market -- essentially all high performance databases work this way

Java s Implementation of Concurrency, and how to use it in our applications.

Name: Vijay Rajagopalan Title : Principal Architect Company : Microsoft Corporation Session Code:

Introduction to parallel Computing

The Future of Parallel Programming in the.net Framework. Igor Ostrovsky Software Engineer Microsoft Corporation

CSC 447: Parallel Programming for Multi- Core and Cluster Systems

What is a thread anyway?

multiprocessing HPC Python R. Todd Evans January 23, 2015

UPGRADING DEVELOPMENT SKILLS

Prashant Kumar Program Manager Microsoft Session Code:

Shared-Memory Programming Models

CIS233J Java Programming II. Threads

Parallel Programming Principle and Practice. Lecture 7 Threads programming with TBB. Jin, Hai

2012 Microsoft Corporation. All rights reserved. Microsoft, Active Directory, Excel, Lync, Outlook, SharePoint, Silverlight, SQL Server, Windows,

Most real programs operate somewhere between task and data parallelism. Our solution also lies in this set.

CS 261 Fall Mike Lam, Professor. Threads

C# 6.0 in a nutshell / Joseph Albahari & Ben Albahari. 6th ed. Beijin [etc.], cop Spis treści

Operating Systems 2 nd semester 2016/2017. Chapter 4: Threads

Project management - integrated into Outlook

INF 212 ANALYSIS OF PROG. LANGS CONCURRENCY. Instructors: Crista Lopes Copyright Instructors.

Jim Tsui Sr. Solution Manager Mobile Communications Business Microsoft Corporation WMB202

Synchronisation in Java - Java Monitor

HA150. SAP HANA 2.0 SPS03 - SQL and SQLScript for SAP HANA COURSE OUTLINE. Course Version: 15 Course Duration:

Written Presentation: JoCaml, a Language for Concurrent Distributed and Mobile Programming

Programming in.net. Microsoft Development Center Serbia programming course. Lesson 8 Parallelism and Threading in.net

CS 498RK FALL RESTFUL APIs

Transcription:

Agus Kurniawan Microsoft MVP Blog http://geeks.netindonesia.net/blogs/agus http://blog.aguskurniawan.net

Agenda Reasons The Paradigm The Technology The People Code Parallel Processing PLINQ Data and Synchronization Tools Debugging Profiling

Why? Because Single-Core Is Slow (Single-Threaded)

Power Density (W/cm 2 ) The Paradigm Hardware limitations due to heat increases Moore's Law implies more Cores not higher speeds 10,000 Sun s Surface 1,000 Rocket Nozzle 100 Nuclear Reactor 10 1 4004 8008 8080 8085 8086 286 386 Hot Plate 486 Pentium processors 70 80 90 00 10

GOPS The Shift More Cores More Parallel Computing 32,768 2,048 128 16 Parallelism Opportunity 80X 2004 2006 2008 2010 2012 2015

The Technology Intel (C) (software.intel.com)

The People "Everyone does it"

Writing Parallel Code is Hard (Multi-Threaded & Multi-Core)

Multi- Threaded Programming It's not easy Error Prone From Race conditions to data sharing Hard to Debug Very hard to reproduce Easy to break (on newer hardware) Dedication and perseverance Businesses want business value not hardcore developers writing threads

Simple Maths Demo 1, 2, 3, 5, 7, 11, 13, 17, 19, 23...

Calculating Prime Numbers List<int> primes = new List<int>(); for (int i = 2; i < upper; i++) { if (SieveOfEratosthenes.IsPrime(i)) primes.add(i); }

"My" Parallel int corecount = Environment.ProcessorCount; int partitionsize = upper / corecount; ManualResetEvent endevent = new ManualResetEvent(false); List<int> result = new List<int>(); object lockobject = new object(); int runninginstances = corecount; for (int i = 0; i < corecount; i++) { // partition per core ThreadPool.QueueUserWorkItem(c => { int core = (int)c; int partitionstart = core * partitionsize; int partitionend = ((core + 1) * partitionsize) - 1; for (int j = partitionstart; j < partitionend; j++) { if (SieveOfEratosthenes.IsPrime(j)) { lock (lockobject) { result.add(j); } } } if (Interlocked.Decrement(ref runninginstances) == 0) { endevent.set(); } }, i); } endevent.waitone(); Static Work Distribution Potential scalability bottleneck Error Prone Error Prone Manual locking Manual Synchronization

Parallel Prime Numbers var result = new ConcurrentBag<int>(); Parallel.For(2, upper, (x) => { if (SieveOfEratosthenes.IsPrime(x)) { result.add(x); } }); var result = new List<int>(); for (int i = 2; i < upper; i++) { if (SieveOfEratosthenes.IsPrime(i)) result.add(i); }

Ray tracer Boids

Architecture public static void Main(string[] args) {... } Declarative Parallel Queries Imperative Parallel Algorithms Compiler (F#, C#, VB...) PLINQ Execution Engine Task Parallel Library Parallel Constructs Task Scheduling Data Structures and Coordination Concurrent Collections Synchronization & Coordination T1 T2 T1 T2 CPU CPU

Library - Parallel Parallel.For & Parallel.ForEach Drop in replacement for for/foreach loop Core Partitioning Scalable Cancellable Parallel.Invoke Action Invoker Cancelation API Cooperative Cancellation

Coordination Structures Collections ConcurrentBag<T> ConcurrentStack<T> BlockingCollection Locks & Signals SpinLock & SpinWain SemaphoreSlim Barrier CountdownEvent

Blend Images

Library - Tasks Task & Task<T> Asynchronous Execution (Blocking) Value on competition Parent & Child Relationships Continuations on success, failure or cancellation Task Scheduler Scheduler on top of the ThreadPool Abstract implementation

Tasks Custom Scheduling Task Stealing Priority Scheduling Round Robin IO Scheduler

Fractals Putting Tasks to do some work

Library - PLINQ LINQ but Parallel IEnumerable<T>.AsParallel() Standard Operators Parallel Extensions Partitioning and Merging API Extensions.AsParallel() Direct Use: ParallelEnumerable.Select/Where...

PLINQ Partitioning: Range & Stride IList<T> Range Continuous ranges Stripped Round Robin, designed for Skip&Take

PLINQ Partitioning: Chunk & Hash IEnumerable<T> Chunk Single Enumerator (locked), chunks of increasing size handled Hash Used for Join, GroupJoin, GroupBy, Distinct, Except, Union and Intersect

PLINQ Ray Tracer

Task Debugging Parallel Tasks All scheduled tasks All running tasks Parallel Stacks Call graphs Call stacks

Parallel + MS Excel 2010

Resources www.microsoft.com/teched Sessions On-Demand & Community www.microsoft.com/learning Microsoft Certification & Training Resources http://microsoft.com/technet Resources for IT Professionals http://microsoft.com/msdn Resources for Developers

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.