multitasking in applications

9
Multitaskin g in Application s

Upload: robert-maclean

Post on 22-Apr-2015

1.439 views

Category:

Technology


2 download

DESCRIPTION

If you are still thinking in threads when you want code to run in parallel you are doing it wrong. Multitasking is the new hotness and .NET Framework 4 provides many features for the creation of tasks, which is an abstraction above threads, to make your life WAY easier.

TRANSCRIPT

Page 1: Multitasking in applications

Multitasking in

Applications

Page 2: Multitasking in applications

why?

no arguments against needing to be multi-something?– avg cores on desktop: 2.68– cloud: scalable because of lots of small

parts working separately

Page 3: Multitasking in applications

Some are more equal than others

Common logic of add threads = going faster is just wrong.• Physical CPU core limits• Balancing cost to create vs. benefit• I/O bound vs. CPU bound

Page 4: Multitasking in applications

Threading is just hardCode complexity• Providing results at the end of processing• Cross thread communication• Updating the UILogic issues• Balancing new threads vs. reusing threadsReally understanding the bottlenecks

Page 5: Multitasking in applications

what does .NET give us?

1.0 – threading, thread pool

4 – tasks

vNext - async

Page 6: Multitasking in applications

The trend?

Threading is done• Done != Dead• Not much more can be added or changed• Easier with thread poolsTasking is the new trend• Threading lite• Easier to consume

Page 7: Multitasking in applications

Single Threaded MultiThreaded ThreadPool Plinq PlinqForAll ParallelExtensions TPL Async

257.8

6475

2930.1

675

0.2

790159

287.6

1645

261.9

64985

382.5

2188

0.5

170296

7.9

784563

0.8

720499

2129.1

218

0.4

340248

0.9

580548

1.0

190583

1.0

290589

0.5

15029

7.3

804221

1.7

32099

2064.1

181

0.7

820447

1.6

480943

1.4

150809

1.4

680839

1.7

320991

7.1

844109

ConsoleLockingConcurrent

demo time

Page 8: Multitasking in applications

Other options?

Reactive ExtensionsQbservable All those good ideas from the 60’s like pub/sub

Page 9: Multitasking in applications

Summary

Their goal is to make this easierStop thinking in threadsOn going process of evaluate, test & review