Why Go is an important programming language

1,985 views
1,833 views

Published on

A short presentation given at the inaugural meeting of the Go London User Group http://www.meetup.com/Go-London-User-Group/ 2013-03-27T20:20

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

No Downloads
Views
Total views
1,985
On SlideShare
0
From Embeds
0
Number of Embeds
65
Actions
Shares
0
Downloads
23
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Why Go is an important programming language

  1. 1. Why Go is an Important Language Prof Russel Winder email: russel@winder.org.uk xmpp: russel@winder.org.uk twitter: russel_winderCopyright © 2013 Russel Winder 1
  2. 2. Interstitial Advertisement ?Copyright © 2013 Russel Winder 2
  3. 3. controversial adjective of, pertaining to, or characteristic of controversy; polemicalCopyright © 2013 Russel Winder 3
  4. 4. controversy noun dispute, argument, or debate, especially one concerning a matter about which there is strong disagreementCopyright © 2013 Russel Winder 4
  5. 5. polemic noun a strong verbal or written attack on someone or somethingCopyright © 2013 Russel Winder 5
  6. 6. Go, made public late 2009.Copyright © 2013 Russel Winder 6
  7. 7. Its a better C.Copyright © 2013 Russel Winder 7
  8. 8. Strong, static type checking.Copyright © 2013 Russel Winder 8
  9. 9. Garbage collected.Copyright © 2013 Russel Winder 9
  10. 10. Statically linked.Copyright © 2013 Russel Winder 10
  11. 11. Aware of DVCS repositories.Copyright © 2013 Russel Winder 11
  12. 12. No classes.Copyright © 2013 Russel Winder 12
  13. 13. Separation of state and behaviour.Copyright © 2013 Russel Winder 13
  14. 14. Focus on modern, multicore hardware.Copyright © 2013 Russel Winder 14
  15. 15. Concurrency is a tool for structuring execution where a single processor is used by multiple computations. Parallelism is about making a computation complete faster than using a single processor.Copyright © 2013 Russel Winder 15
  16. 16. Parallelism is performance improvement. Performance improvement requires parallelism.Copyright © 2013 Russel Winder 16
  17. 17. People should tremble in fear at the prospect of using mutable shared-memory multithreading.Copyright © 2013 Russel Winder 17
  18. 18. Locks deny parallelism. The whole purpose of a lock is to prevent parallelism.Copyright © 2013 Russel Winder 18
  19. 19. Locks are needed only if there is mutable shared state.Copyright © 2013 Russel Winder 19
  20. 20. Avoid mutable shared state.Copyright © 2013 Russel Winder 20
  21. 21. Use processes and message passing.Copyright © 2013 Russel Winder 21
  22. 22. Its all easier if processes are single threaded.Copyright © 2013 Russel Winder 22
  23. 23. Applications and tools programmers need computational models with integrated synchronization.Copyright © 2013 Russel Winder 23
  24. 24. Actors Dataflow Independent processes Operators connected by communicating via channels with activity asynchronous exchange triggered by arrival of of messages data on the channels. CSP Data Parallelism Sequential processes Transform a sequence to connected by channels another sequence where all using synchronous message individual actions happen exchange (rendezvous). at the same time.Copyright © 2013 Russel Winder 24
  25. 25. Data Parallelism Transform a sequence to another sequence where all individual actions happen at the same time.Copyright © 2013 Russel Winder 25
  26. 26. Actors Independent processes communicating via asynchronous exchange of messagesCopyright © 2013 Russel Winder 26
  27. 27. Dataflow Operators connected by channels with activity triggered by arrival of data on the channels.Copyright © 2013 Russel Winder 27
  28. 28. CSP Sequential processes connected by channels using synchronous message exchange (rendezvous).Copyright © 2013 Russel Winder 28
  29. 29. Actors Dataflow Independent processes Operators connected by communicating via channels with activity asynchronous exchange triggered by arrival of of messages data on the channels. CSP Data Parallelism Sequential processes Transform a sequence to connected by channels another sequence where all using synchronous message individual actions happen exchange (rendezvous). at the same time.Copyright © 2013 Russel Winder 29
  30. 30. Agents A wrapper for some Active Objects shared mutable state. An object that is actually an actor but looks like a full service object. Fork/Join An toolkit for tree structured concurrency and parallelism. Software Transactional Memory Wrappers for mutable values that uses transactions rather than locks.Copyright © 2013 Russel Winder 30
  31. 31. Example.Copyright © 2013 Russel Winder 31
  32. 32. Copyright © 2013 Russel Winder 32
  33. 33. What is the Value of ? Easy, its known exactly. Its . Obviously.Copyright © 2013 Russel Winder 33
  34. 34. Its simples Александр Орлов 2009Copyright © 2013 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 © 2013 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 1  parallel. n With n = 3 not much to do, but potentially lots of error. Use n = 107 or n = 109?Copyright © 2013 Russel Winder 36
  37. 37. Because addition is commutative and associative, expression can be decomposed into sums of partial sums.Copyright © 2013 Russel Winder 37
  38. 38. a+b+c+d+e+f = (a+b)+(c+d)+(e+f)Copyright © 2013 Russel Winder 38
  39. 39. Scatter – Gather map reduceCopyright © 2013 Russel Winder 39
  40. 40. Code!Copyright © 2013 Russel Winder 40
  41. 41. If you want the code, clone the Git repository: http://www.russel.org.uk/Git/Pi_Quadrature.gitCopyright © 2013 Russel Winder 41
  42. 42. Or if you just want to browse: http://www.russel.org.uk/gitwebCopyright © 2013 Russel Winder 42
  43. 43. Multicore and multiprocessor are now the norm, not the exception.Copyright © 2013 Russel Winder 43
  44. 44. Parallelism only matters if computational performance matters.Copyright © 2013 Russel Winder 44
  45. 45. Unstructured synchronization of concurrent systems is not a feasible approach.Copyright © 2013 Russel Winder 45
  46. 46. Actors, CSP, Dataflow, and Data parallelism are the future of applications structure.Copyright © 2013 Russel Winder 46
  47. 47. Passing messages between processes is the way forward.Copyright © 2013 Russel Winder 47
  48. 48. Shared memory concurrency is a dead end for applications.Copyright © 2013 Russel Winder 48
  49. 49. Goroutines and channelsCopyright © 2013 Russel Winder 49
  50. 50. Interstitial Advertisement ?Copyright © 2013 Russel Winder 50
  51. 51. Why Go is an Important Language Prof Russel Winder email: russel@winder.org.uk xmpp: russel@winder.org.uk twitter: russel_winderCopyright © 2013 Russel Winder 51

×