Upgrade to Pro — share decks privately, control downloads, hide ads and more …

On Concurrency and Parallelism in the JVMverse

On Concurrency and Parallelism in the JVMverse

Slides for my session at JAX London 2018.

Be aware I did a lot of writing over the slides during the session do the slides are not that useful. Find the video.

Ca04455902d1b207348b6d406432718f?s=128

Russel Winder

October 09, 2018
Tweet

More Decks by Russel Winder

Other Decks in Technology

Transcript

  1. Copyright © 2018 Russel Winder 1 On Concurrency and Parallelism

    in the JVMVerse Russel Winder @russel_winder russel@winder.org.uk https://www.russel.org.uk
  2. Copyright © 2018 Russel Winder 2 The Presenter • Ex

    theoretical physicist • Ex UNIX systems programmer • Ex academic: – Parallel programming – Software development and programming – HCI, UI, UX • Ex Company director • Ex Independent consultant • Ex analyst • Ex author • Ex expert witness • Ex trainer Russel Winder
  3. Copyright © 2018 Russel Winder 3 Me at Previous JAXLondons

    • 2011 ”Just Keep Passing the Messages” • 2012 ”it’S All About Processes Communicating” Also many sessions at other conferences
  4. Copyright © 2018 Russel Winder 4 Concurrency • dictionary.com –

    concurrence – the act of concurring. – accordance in opinion; agreement: With the concurrence of several specialists, our doctor recommended surgery. – cooperation, as of agents or causes; combined action or effort. • Wikipedia – concurrency – In computer science, concurrency refers to the ability of different parts or units of a program, algorithm, or problem to be executed out-of-order or in partial order, without affecting the final outcome.
  5. Copyright © 2018 Russel Winder 5 Parallelism • dictionary.com –

    parallelism – the position or relation of parallels. – agreement in direction, tendency, or character; the state or condition of being parallel. – a parallel or comparison. • Wikipedia – parallelism – Parallel computing is a type of computation in which many calculations or the execution of processes are carried out simultaneously.
  6. Copyright © 2018 Russel Winder 6 Original computing: single CPU,

    single program
  7. Copyright © 2018 Russel Winder 7 Multitasking: single CPU, many

    programs
  8. Copyright © 2018 Russel Winder 8 Five programs, one CPU

  9. Copyright © 2018 Russel Winder 9 OS manages all the

    programs in one memory, eventually get virtual memory, in the mean time locks, semaphores, monitors, mutexes, and the theory of concurrency get invented.
  10. Copyright © 2018 Russel Winder 10 Five programs, one CPU

  11. Copyright © 2018 Russel Winder 11 Five programs, four CPUs

  12. Copyright © 2018 Russel Winder 12 Moving from operating systems

    to applications
  13. Copyright © 2018 Russel Winder 13 One program, one task,

    one CPU
  14. Copyright © 2018 Russel Winder 14 One program, four tasks,

    one CPU
  15. Copyright © 2018 Russel Winder 15 One program, four tasks,

    four CPUs
  16. Copyright © 2018 Russel Winder 16 One program, four tasks,

    four CPUs
  17. Copyright © 2018 Russel Winder 17 Locks, mutexes, sempahores, monitors

    are the enemy of parallelism
  18. Copyright © 2018 Russel Winder 18 What is the problem…

  19. Copyright © 2018 Russel Winder 19 Shared Memory

  20. Copyright © 2018 Russel Winder 20 A Bit of Java

    History • 1995 — Java introduces threads, multithreading, monitors, synchronized, locks, etc. • 1996 — People predict lots of tears and grief. • 2002 —Doug Lea gets JSR166 moving. • 2011 — Fork/Join framework in Java 7.
  21. Copyright © 2018 Russel Winder 21 A Bit More Java

    History • 2014 — Java 8 introduces: – Lambda Expressions, – Streams, and – CompletableFuture.
  22. Copyright © 2018 Russel Winder 22 Abstract code away from

    the details of managing concurrency and parallelism.
  23. Copyright © 2018 Russel Winder 23

  24. Copyright © 2018 Russel Winder 24 Pipeline

  25. Copyright © 2018 Russel Winder 25 Dataflow

  26. Copyright © 2018 Russel Winder 26 Actors

  27. Copyright © 2018 Russel Winder 27 Distributed System

  28. Copyright © 2018 Russel Winder 28 Microservices

  29. Copyright © 2018 Russel Winder 29 Independent processes/tasks/programs communicating by

    message passing
  30. Copyright © 2018 Russel Winder 30 Data Parallel

  31. Copyright © 2018 Russel Winder 31 Event Processing

  32. Copyright © 2018 Russel Winder 32 One program, four tasks

  33. Copyright © 2018 Russel Winder 33 Have we seen the

    code yet?
  34. Copyright © 2018 Russel Winder 34 Summary • Gpars (Groovy)

    • Quasar • Kotlin Coroutines Can Java catch up (again).
  35. Copyright © 2018 Russel Winder 35 On Concurrency and Parallelism

    in the JVMVerse Russel Winder @russel_winder russel@winder.org.uk https://www.russel.org.uk