F# for Parallel and Asynchronous Programming

17
F# for Parallel and Asynchronous Programming Luke Hoban F# Program Manager Microsoft Corporation FT20

description

FT20. F# for Parallel and Asynchronous Programming. Luke Hoban F# Program Manager Microsoft Corporation. F#: Productive, Functional, Scalable. demo . Luke Hoban F# Program Manager Microsoft. Parallel Computing and PDC09. Tools. Managed Languages. Visual F#. Axum. Visual Studio 2010. - PowerPoint PPT Presentation

Transcript of F# for Parallel and Asynchronous Programming

Page 1: F# for Parallel and Asynchronous Programming

F# for Parallel and Asynchronous Programming

Luke HobanF# Program ManagerMicrosoft Corporation

FT20

Page 2: F# for Parallel and Asynchronous Programming

F#: Productive, Functional, Scalable

Luke HobanF# Program ManagerMicrosoft

demo

Page 3: F# for Parallel and Asynchronous Programming

Parallel Computing and PDC09

Parallel Pattern Library

Resource Manager

Task Scheduler

Task Parallel Library

Parallel LINQ

Threads

Operating System

Native Concurrency Runtime

Managed Libraries

ThreadPool

Data Structures D

ata

Stru

ctur

es

Tools

AsyncAgentsLibrary

UMS Threads

MicrosoftResearch

Visual Studio 2010Parallel

Debugger

WindowsProfiler

Concurrency

Analysis

Race DetectionFuzzing

AxumVisual F#Managed Languages

Rx

Native Libraries

Managed Concurrency Runtime

DryadLINQ

Key: Research / Incubation

Visual Studio 2010 / .NET 4 Windows 7 / Server 2008 R2

HPC Server Operating System

Page 4: F# for Parallel and Asynchronous Programming

Four Big Concurrency Challenges

Shared State

Inversion of ControlI/O ParallelismScaling to multi-machine

Page 5: F# for Parallel and Asynchronous Programming

Concurrency ChallengesShared State

Inversion of ControlI/O ParallelismScaling to Multi-Machine

o Difficult to maintain and testo Very difficult to parallelize!o Locking is fundamentally error prone:

o Must guess where parallelism will be neededo All consumers need to participate

Page 6: F# for Parallel and Asynchronous Programming

F#: Immutability and Functional Programming

Luke HobanF# Program ManagerMicrosoft

demo

Page 7: F# for Parallel and Asynchronous Programming

Concurrency ChallengesShared StateInversion of Control

I/O ParallelismScaling to Multi-Machine

o We’re used to writing code linearlyo Async requires decoupling Begin from Endo Very difficult to

o Combine multiple asynchronous operationso Deal with exceptions and cancellation

Page 8: F# for Parallel and Asynchronous Programming

Concurrency ChallengesShared StateInversion of ControlI/O Parallelism

Scaling to Multi-Machine

o Software is often I/O-bound o Leveraging web serviceso Working with data on disk

o Network and disk speeds increasing slowero I/O resources are inherently parallel

o Huge opportunity for performance

Page 9: F# for Parallel and Asynchronous Programming

F#: async { … }

Luke HobanF# Program ManagerMicrosoft

demo

Page 10: F# for Parallel and Asynchronous Programming

Concurrency ChallengesShared StateInversion of ControlI/O ParallelismScaling to Multi-Machineo To scale up, must to go beyond a single

machineo Multi-machine resources becoming common

o Roll-you-own clusters with cheap hardwareo On-demand cloud compute with Azure

o Buto Shared memory doesn’t scale

Page 11: F# for Parallel and Asynchronous Programming

F#: Agents and Azure

Luke HobanF# Program ManagerMicrosoft

demo

Page 12: F# for Parallel and Asynchronous Programming

Recap: Some Concurrency ChallengesShared State

Inversion of ControlI/O ParallelismScaling to Multi-Machine

immutabilityasync { … }async { … }agents

Page 13: F# for Parallel and Asynchronous Programming

In Summary

Simple, powerful, and productive

Ready for production use with VS2010

F# + .NET 4.0 radically simplify

parallelism

Parallelism and asynchrony – for

today and tomorrow

F#

Page 14: F# for Parallel and Asynchronous Programming

YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation

forms online atMicrosoftPDC.com

Page 15: F# for Parallel and Asynchronous Programming

Learn More On Channel 9> Expand your PDC experience through

Channel 9

> Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses

channel9.msdn.com/learnBuilt by Developers for Developers….

Page 16: F# for Parallel and Asynchronous Programming

© 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.

Page 17: F# for Parallel and Asynchronous Programming