F# for Parallel and Asynchronous Programming
description
Transcript of F# for Parallel and Asynchronous Programming
F# for Parallel and Asynchronous Programming
Luke HobanF# Program ManagerMicrosoft Corporation
FT20
F#: Productive, Functional, Scalable
Luke HobanF# Program ManagerMicrosoft
demo
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
Four Big Concurrency Challenges
Shared State
Inversion of ControlI/O ParallelismScaling to multi-machine
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
F#: Immutability and Functional Programming
Luke HobanF# Program ManagerMicrosoft
demo
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
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
F#: async { … }
Luke HobanF# Program ManagerMicrosoft
demo
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
F#: Agents and Azure
Luke HobanF# Program ManagerMicrosoft
demo
Recap: Some Concurrency ChallengesShared State
Inversion of ControlI/O ParallelismScaling to Multi-Machine
immutabilityasync { … }async { … }agents
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#
YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation
forms online atMicrosoftPDC.com
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….
© 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.