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

Nobody Knows What Time It Is

53f67e3899c7ca2ca340b795cf80d3c4?s=47 Vaidehi Joshi
April 27, 2018
130

Nobody Knows What Time It Is

Someone once said that time is a flat circle, which is all well and good...but how on earth does anyone know what time it actually is? In this talk, we’ll try to understand why time is such a hard problem in distributed systems, some of the ways that people have tried to solve this problem, and how one computer scientist's solution completely changed the trajectory of the internet forever.

53f67e3899c7ca2ca340b795cf80d3c4?s=128

Vaidehi Joshi

April 27, 2018
Tweet

Transcript

  1. @vaidehijoshi Nobody Knows What Time It Is Vaidehi Joshi

  2. @vaidehijoshi hola!

  3. @vaidehijoshi hola! i’m vaidehi

  4. @vaidehijoshi i work on

  5. @vaidehijoshi how things work

  6. @vaidehijoshi time

  7. @vaidehijoshi hard problem

  8. @vaidehijoshi hardest problems

  9. @vaidehijoshi 4/27/18 9:51 AM

  10. @vaidehijoshi how did we all agree on this?

  11. @vaidehijoshi vaidehi’s very (very!) brief history of telling time

  12. @vaidehijoshi sundials

  13. @vaidehijoshi

  14. @vaidehijoshi egyptians greeks

  15. @vaidehijoshi egyptians greeks romans

  16. @vaidehijoshi

  17. @vaidehijoshi water clocks

  18. @vaidehijoshi

  19. @vaidehijoshi incense clocks

  20. @vaidehijoshi

  21. @vaidehijoshi

  22. @vaidehijoshi hourglass

  23. @vaidehijoshi

  24. @vaidehijoshi mechanical clock

  25. @vaidehijoshi

  26. @vaidehijoshi 19,192,631,770 cycles of cesium a single second =

  27. @vaidehijoshi

  28. @vaidehijoshi only half the question

  29. @vaidehijoshi how did we agree on the time?

  30. @vaidehijoshi great american railroad

  31. @vaidehijoshi 10:15 10:30 10:04 10:25 10:02

  32. @vaidehijoshi

  33. @vaidehijoshi 10:15 10:02 ❓ ❓

  34. @vaidehijoshi

  35. @vaidehijoshi standard time zones

  36. @vaidehijoshi

  37. @vaidehijoshi ⏱ ⏰ local time train time

  38. @vaidehijoshi Standard Time Act (1918)

  39. @vaidehijoshi 1840

  40. @vaidehijoshi greenwich mean time

  41. @vaidehijoshi 1900

  42. @vaidehijoshi 24 hour day, GMT offset

  43. @vaidehijoshi international time zones

  44. @vaidehijoshi

  45. @vaidehijoshi distributed systems

  46. @vaidehijoshi network of processes

  47. @vaidehijoshi processes communication channel

  48. @vaidehijoshi ticket booking system my server hipmunk united

  49. @vaidehijoshi my server hipmunk united

  50. @vaidehijoshi my server hipmunk united

  51. @vaidehijoshi my server hipmunk united

  52. @vaidehijoshi my server hipmunk united

  53. @vaidehijoshi my server hipmunk united

  54. @vaidehijoshi my server hipmunk united

  55. @vaidehijoshi my server hipmunk united

  56. @vaidehijoshi my server hipmunk united 8:00 pm 8:03 pm

  57. @vaidehijoshi my server hipmunk united

  58. @vaidehijoshi 8:03pm < 8:00pm ⁉

  59. @vaidehijoshi ☹

  60. @vaidehijoshi multiple processes asynchronous ^

  61. @vaidehijoshi ordering of events time time

  62. @vaidehijoshi just one process in a system

  63. @vaidehijoshi a

  64. @vaidehijoshi snapshot

  65. @vaidehijoshi wait, but what is an “event”?

  66. @vaidehijoshi 3. instruction within process itself 1. receiving a message

    2. sending a message
  67. @vaidehijoshi a 1 2 3 4 linearly

  68. @vaidehijoshi a b c 1? 1? 1? 2? 2?

  69. @vaidehijoshi drift

  70. @vaidehijoshi ntp (network time protocol)

  71. @vaidehijoshi doesn’t eliminate clock drift

  72. @vaidehijoshi ⏳

  73. @vaidehijoshi if one thing happened before another?

  74. @vaidehijoshi timestamps

  75. @vaidehijoshi

  76. @vaidehijoshi

  77. @vaidehijoshi “When I looked at the algorithm, I realized that

    it wasn’t quite right. It permitted a system to do things that, in ways, seemed to violate causality. — Leslie Lamport
  78. @vaidehijoshi

  79. @vaidehijoshi it’s actually simpler than it sounds

  80. @vaidehijoshi a

  81. @vaidehijoshi 1. instruction

  82. @vaidehijoshi a b c

  83. @vaidehijoshi 3. receive 1. instruction 2. send

  84. @vaidehijoshi events affecting one another

  85. @vaidehijoshi events happening concurrently

  86. @vaidehijoshi time isn’t linear anymore

  87. @vaidehijoshi time

  88. @vaidehijoshi time what happened before

  89. @vaidehijoshi “happened before”, or →

  90. @vaidehijoshi a → b p a b

  91. @vaidehijoshi a → b p a q b

  92. @vaidehijoshi p a q b r a → b →c

    c
  93. @vaidehijoshi

  94. @vaidehijoshi

  95. @vaidehijoshi causal paths

  96. @vaidehijoshi p a q b r d c e g

    h f a → d → e a → b→ g → h
  97. @vaidehijoshi back to timestamps

  98. @vaidehijoshi timestamps must follow causality

  99. @vaidehijoshi counter (logical “clock”)

  100. @vaidehijoshi p q r 0 0 0

  101. @vaidehijoshi 1 p q r 0 0 0

  102. @vaidehijoshi 1 1 p q r 0 0 0 1

  103. @vaidehijoshi 1 p q r 0 0 0 1 1

  104. @vaidehijoshi 1 0 1 p q r 0 0 0

    1 1
  105. @vaidehijoshi 1 1 p q r 0 0 0 1

    1 + 1 2 2
  106. @vaidehijoshi p q r 0 0 0 1 1 2

  107. @vaidehijoshi anytime an event occurs, the logical clock counter must

    be incremented
  108. @vaidehijoshi when sending events, a process sends its own counter’s

    value with it
  109. @vaidehijoshi when receiving events, a process chooses the greater of

    the two counters, and increments it by 1 to acknowledge the receive event
  110. @vaidehijoshi and that’s it! that’s the entire algorithm.

  111. @vaidehijoshi there is one problem. it’s still not clear if

    something is causal or concurrent :(
  112. @vaidehijoshi vector clocks (look them, up! they’re cool.)

  113. @vaidehijoshi nobody knows what time it is …but maybe that’s

    actually okay
  114. @vaidehijoshi

  115. @vaidehijoshi

  116. @vaidehijoshi basecs.org ✨

  117. @vaidehijoshi basecs.org muchas gracias! ✨