Your SlideShare is downloading. ×
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Concurrency and Parallelism with Scala
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Concurrency and Parallelism with Scala

2,465

Published on

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,465
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Concurrency andParallelism with Scala Timothy Perrett BrisFunctional, June 2011 software. done right.
  • 2. About Me  Big Scala Geek  Author of Lift in Action  Coding Scala since 2007  Background in both dynamic and statically typed languages  Manufacturing and marketing automation is my day job h"p://manning.com/perre"/   software. done right.
  • 3. Concurrency vsParallelism software. done right.
  • 4. ConcurrencyMutable state is Plain Evil software. done right.
  • 5. ConcurrencyThreads and Locks are EOL software. done right.
  • 6. Concurrency Actors tothe Rescue software. done right.
  • 7. Concurrency msg msg msg msg msg Mailbox msg Actor software. done right.
  • 8. Concurrency  Simpler mental model  Much easier to avoid common issues:   Deadlocks   Race Conditions   Starvation   etc software. done right.
  • 9. Concurrencycase class Increment(amount: Int) class Counter extends Actor { private var count = 0 def receive = { case Increment(by) => count += by println(count) } } software. done right.
  • 10. Concurrencyval counter = actorOf[Counter] counter.start software. done right.
  • 11. Concurrencycounter ! Increment(10) Fire  and  forget   software. done right.
  • 12. Concurrencycounter !!! Increment(10) Fire  yielding  a  Future   software. done right.
  • 13. Concurrency software. done right.
  • 14. Concurrency software. done right.
  • 15. ConcurrencyDon’t Block. Ever. (it’s  a  zen  thing)   software. done right.
  • 16. Parallelism software. done right.
  • 17. ParallelismCollectionson crack i-core ____________ Mult software. done right.
  • 18. list.filter(predicate) software. done right.
  • 19. list.filter(predicate).par software. done right.
  • 20. ParallelismCreate  small  units  of  work  to  split  over  available  processor  capacity   software. done right.
  • 21. Parallelism Stolen!Processor A Processor B software. done right.
  • 22. PlainLazysoftware. done right.
  • 23. Not 100%Toll Free software. done right.
  • 24. Summary  Manually handling threads and locks sucks  Actors provide a sane model for concurrency  Build completely asynchronous systems  Get the most out of your hardware investment software. done right.
  • 25. Further Reading  Scala Language http://scala-lang.org  Akka Actor Toolkit http://akka.io/  State: You’re Doing It Wrong http://www.slideshare.net/jboner/state-youre-doing-it-wrong-javaone-2009  A Generic Parallel Collection Framework http://infoscience.epfl.ch/record/150220/files/pc.pdf software. done right.
  • 26. Questions?twitter.com/timperrett Lift in Actiongithub.com/timperrett manning.com/perrett/blog.getintheloop.eu software. done right.

×