Go, D, C++ and the                           Multicore Revolution                                         Russel Winder   ...
Aims, Goals and Objects     ●   Show that shared memory multi-threading should         return to being an operating system...
Structure                                      A beginning.                                       A middle.               ...
Protocol     ●   Questions or short comments during the session are         entirely in order.     ●   Let me know you hav...
Interstitial AdvertisementCopyright © 2011–2012 Russel Winder                  5
A BeginningCopyright © 2011–2012 Russel Winder                 6
It is no longer contentious that                         The Multicore Revolution                             is well unde...
Quad core laptops and phones.                    Eight and twelve core workstations.                         Servers with ...
Software technology                                  is now lagging                               hardware technology     ...
Operating systems manage cores                            with kernel threads.         Operating systems are fundamentally...
Operating systems really rather need                      to be native code systems.Copyright © 2011–2012 Russel Winder   ...
Constructive dichotomies…Copyright © 2011–2012 Russel Winder               12
Native code languages.                                               vs.                      Virtual machine based langua...
Statically typed languages.                                          vs.                          Dynamically typed langua...
Compiled languages.                                              vs.                         Scripting languages languages...
Imperative languages.                                               vs.                                      Declarative l...
Sequential.                                          vs.                                       Parallel.Copyright © 2011–2...
Computationally intensive.                                           vs.                                      I/O intensiv...
Batch flow.                                           vs.                                      Event driven.Copyright © 20...
Monolithic systems.                                              vs.                                 Cooperating subsystem...
Computationally intensive systems or             subsystems definitely have to be parallel.                  Other systems...
Concurrency is a design tool.                         Parallelism is a tool to improve                          computatio...
Static vs. Dynamic     ●   Fortran                               ●   Python, Jython     ●   C                             ...
A MiddleCopyright © 2011–2012 Russel Winder              24
Its all about controlling                      concurrency with tools that                       programmers find usable.C...
Shared memory multi-threading is an                operating system technique.Copyright © 2011–2012 Russel Winder         ...
Applications and tools programmers               need computational models with                  integrated synchronizatio...
Dataflow                                            Operators connected by    Actors                                  chan...
Actors    Independent processes    communicating via    asynchronous exchange    of messagesCopyright © 2011–2012 Russel W...
Dataflow                                      Operators connected by                                      channels with ac...
CSP                                      Sequential processes                                      connected by channels  ...
Need examples.Copyright © 2011–2012 Russel Winder                    32
Copyright © 2011–2012 Russel Winder       33
What is the Value of  ?     ●         Easy, its known exactly, its  (obviously).                                       I...
Approximating      ●   What is its value represented as a floating point         number?          ●   We can only obtain ...
One Possible Algorithm     ●   Use quadrature to estimate the value of the integral         – which is the area under the ...
Scatter – Gather                                      map         reduceCopyright © 2011–2012 Russel Winder               ...
Code!Copyright © 2011–2012 Russel Winder           38
Need another example.Copyright © 2011–2012 Russel Winder                 39
The Sleeping Barber ProblemCopyright © 2011–2012 Russel Winder        40
The Sleeping Barber Problem     ●   The barbers shop has a          ●   If the barber is cutting, a new         single cut...
The cutting chair.      The waiting chairs                                          The barbers shop.  A new customer ente...
Wikipedia article presents the classic operating      systems approach using locks and semaphores.           http://en.wik...
More code!Copyright © 2011–2012 Russel Winder                44
Note to Self:                                      Did you, in fact, show all                                      the exa...
An EndCopyright © 2011–2012 Russel Winder            46
Native code language are just as                    much scripting languages as                     virtual machine langua...
Virtual machine languages are                         just as fast as native code                        languages when us...
Multicore and multiprocessor                            are now the norm,                            not the exception.Cop...
Parallelism only matters                                 if computational                               performance matter...
Unstructured synchronization                           of concurrent systems                        is not a feasible appr...
Actors, CSP and Dataflow                                 are the future of                              applications struc...
Passing messages between                        processes is the way forward.Copyright © 2011–2012 Russel Winder          ...
Shared memory concurrency                      is a dead end for applications.Copyright © 2011–2012 Russel Winder         ...
Surreptitious AdvertisementCopyright © 2011–2012 Russel Winder                55
The EndCopyright © 2011–2012 Russel Winder             56
Go, D, C++ and the                           Multicore Revolution                                         Russel Winder   ...
Upcoming SlideShare
Loading in...5
×

ACCU 2012: Go, D, C++ and The Multicore Revolution

2,351

Published on

presenting actors, dataflow, CSP, data parallelism in Go, D and C++. Used the examples from the Bazaar branch at http://www.russel.org.uk/Bazaar/Pi_Quadrature

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

No Downloads
Views
Total Views
2,351
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
14
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

ACCU 2012: Go, D, C++ and The Multicore Revolution

  1. 1. Go, D, C++ and the Multicore Revolution Russel Winder email: russel@winder.org.uk xmpp: russel@winder.org.uk twitter: russel_winderCopyright © 2011–2012 Russel Winder 1
  2. 2. Aims, Goals and Objects ● Show that shared memory multi-threading should return to being an operating systems development technique and not continue to be pushed as an applications programming technique. ● Show, possibly, that the C++11 standard may, perhaps, have saved C++ from the dustbin of obscurity.Copyright © 2011–2012 Russel Winder 2
  3. 3. Structure A beginning. A middle. An end.Copyright © 2011–2012 Russel Winder 3
  4. 4. Protocol ● Questions or short comments during the session are entirely in order. ● Let me know you have an interjection by raising your hand, and when I come to an appropriate pause, Ill pass you the token. Questions, answers, comments, etc. appearing to get too long as interjections may get stacked to be unstacked at a break.Copyright © 2011–2012 Russel Winder 4
  5. 5. Interstitial AdvertisementCopyright © 2011–2012 Russel Winder 5
  6. 6. A BeginningCopyright © 2011–2012 Russel Winder 6
  7. 7. It is no longer contentious that The Multicore Revolution is well underway.Copyright © 2011–2012 Russel Winder 7
  8. 8. Quad core laptops and phones. Eight and twelve core workstations. Servers with “zillions” of cores.Copyright © 2011–2012 Russel Winder 8
  9. 9. Software technology is now lagging hardware technology by decades.Copyright © 2011–2012 Russel Winder 9
  10. 10. Operating systems manage cores with kernel threads. Operating systems are fundamentally shared memory multi-threaded systems. Operating systems rightly use all the lock, semaphore, monitor, etc. technologies.Copyright © 2011–2012 Russel Winder 10
  11. 11. Operating systems really rather need to be native code systems.Copyright © 2011–2012 Russel Winder 11
  12. 12. Constructive dichotomies…Copyright © 2011–2012 Russel Winder 12
  13. 13. Native code languages. vs. Virtual machine based languages.Copyright © 2011–2012 Russel Winder 13
  14. 14. Statically typed languages. vs. Dynamically typed languages.Copyright © 2011–2012 Russel Winder 14
  15. 15. Compiled languages. vs. Scripting languages languages.Copyright © 2011–2012 Russel Winder 15
  16. 16. Imperative languages. vs. Declarative languages.Copyright © 2011–2012 Russel Winder 16
  17. 17. Sequential. vs. Parallel.Copyright © 2011–2012 Russel Winder 17
  18. 18. Computationally intensive. vs. I/O intensive.Copyright © 2011–2012 Russel Winder 18
  19. 19. Batch flow. vs. Event driven.Copyright © 2011–2012 Russel Winder 19
  20. 20. Monolithic systems. vs. Cooperating subsystems.Copyright © 2011–2012 Russel Winder 20
  21. 21. Computationally intensive systems or subsystems definitely have to be parallel. Other systems likely use concurrency but not parallelism.Copyright © 2011–2012 Russel Winder 21
  22. 22. Concurrency is a design tool. Parallelism is a tool to improve computational performance.Copyright © 2011–2012 Russel Winder 22
  23. 23. Static vs. Dynamic ● Fortran ● Python, Jython ● C ● Lisp, Clojure ● C++ ● Ruby, JRuby ● D ● Groovy ● Go ● JavaScript ● Rust ● Java ● Dart ● Scala ● Ceylon ● Kotlin COBOLCopyright © 2011–2012 Russel Winder 23
  24. 24. A MiddleCopyright © 2011–2012 Russel Winder 24
  25. 25. Its all about controlling concurrency with tools that programmers find usable.Copyright © 2011–2012 Russel Winder 25
  26. 26. Shared memory multi-threading is an operating system technique.Copyright © 2011–2012 Russel Winder 26
  27. 27. Applications and tools programmers need computational models with integrated synchronization.Copyright © 2011–2012 Russel Winder 27
  28. 28. Dataflow Operators connected by Actors channels with activity Independent processes triggered by arrival of communicating via data on the channels. asynchronous exchange of messages CSP Sequential processes connected by channels using synchronous message exchange (rendezvous).Copyright © 2011–2012 Russel Winder 28
  29. 29. Actors Independent processes communicating via asynchronous exchange of messagesCopyright © 2011–2012 Russel Winder 29
  30. 30. Dataflow Operators connected by channels with activity triggered by arrival of data on the channels.Copyright © 2011–2012 Russel Winder 30
  31. 31. CSP Sequential processes connected by channels using synchronous message exchange (rendezvous).Copyright © 2011–2012 Russel Winder 31
  32. 32. Need examples.Copyright © 2011–2012 Russel Winder 32
  33. 33. Copyright © 2011–2012 Russel Winder 33
  34. 34. What is the Value of  ? ● Easy, its known exactly, its  (obviously). Its simples Александр Орлов 2009Copyright © 2011–2012 Russel Winder 34
  35. 35. Approximating  ● What is its value represented as a floating point number? ● We can only obtain an approximation. ● A plethora of possible algorithms to choose from, a popular one is to employ the following integral equation.  1 1 =∫0 dx 4 1x 2Copyright © 2011–2012 Russel Winder 35
  36. 36. One Possible Algorithm ● Use quadrature to estimate the value of the integral – which is the area under the curve. 4 n 1 = ∑i=1 n i−0.5 2 Embarrassingly parallel. 1  n With n = 3 not much to do, but potentially lots of error. Use n = 107 or n = 109?Copyright © 2011–2012 Russel Winder 36
  37. 37. Scatter – Gather map reduceCopyright © 2011–2012 Russel Winder 37
  38. 38. Code!Copyright © 2011–2012 Russel Winder 38
  39. 39. Need another example.Copyright © 2011–2012 Russel Winder 39
  40. 40. The Sleeping Barber ProblemCopyright © 2011–2012 Russel Winder 40
  41. 41. The Sleeping Barber Problem ● The barbers shop has a ● If the barber is cutting, a new single cutting chair and a row customer checks to see if of waiting seats. there is a free waiting seat. ● The barber sleeps in the ● If there is join the queue cutting chair unless trimming to be trimmed. a customer. ● If there isnt leave ● Customers arrive at the shop disgruntled. at intervals. ● If the barber is asleep, the customer wakes the barber Problem originally due takes the cutting chair and to Edsgar Dijkstra. gets a trim.Copyright © 2011–2012 Russel Winder 41
  42. 42. The cutting chair. The waiting chairs The barbers shop. A new customer enters the shop, check to see if they can go straight to the cutting chair, if not can they take a waiting chair, if not leave.Copyright © 2011–2012 Russel Winder 42
  43. 43. Wikipedia article presents the classic operating systems approach using locks and semaphores. http://en.wikipedia.org/wiki/Sleeping_barber_problemCopyright © 2011–2012 Russel Winder 43
  44. 44. More code!Copyright © 2011–2012 Russel Winder 44
  45. 45. Note to Self: Did you, in fact, show all the examples in: ● C ● D ● Go ● C++ ● PythonCopyright © 2011–2012 Russel Winder 45
  46. 46. An EndCopyright © 2011–2012 Russel Winder 46
  47. 47. Native code language are just as much scripting languages as virtual machine languages and interpreted ones.Copyright © 2011–2012 Russel Winder 47
  48. 48. Virtual machine languages are just as fast as native code languages when using JITs.Copyright © 2011–2012 Russel Winder 48
  49. 49. Multicore and multiprocessor are now the norm, not the exception.Copyright © 2011–2012 Russel Winder 49
  50. 50. Parallelism only matters if computational performance matters.Copyright © 2011–2012 Russel Winder 50
  51. 51. Unstructured synchronization of concurrent systems is not a feasible approach.Copyright © 2011–2012 Russel Winder 51
  52. 52. Actors, CSP and Dataflow are the future of applications structure.Copyright © 2011–2012 Russel Winder 52
  53. 53. Passing messages between processes is the way forward.Copyright © 2011–2012 Russel Winder 53
  54. 54. Shared memory concurrency is a dead end for applications.Copyright © 2011–2012 Russel Winder 54
  55. 55. Surreptitious AdvertisementCopyright © 2011–2012 Russel Winder 55
  56. 56. The EndCopyright © 2011–2012 Russel Winder 56
  57. 57. Go, D, C++ and the Multicore Revolution Russel Winder email: russel@winder.org.uk xmpp: russel@winder.org.uk twitter: russel_winderCopyright © 2011–2012 Russel Winder 57
  1. ¿Le ha llamado la atención una diapositiva en particular?

    Recortar diapositivas es una manera útil de recopilar información importante para consultarla más tarde.

×