$30 off During Our Annual Pro Sale. View Details »

Pioneering Real-Time

Pioneering Real-Time

My keynote from PyCon Balkan 2019

Andrew Godwin

October 03, 2019

More Decks by Andrew Godwin

Other Decks in Programming



  2. Hi, I’m Andrew Godwin

  3. async def view(request): data = await api_call(pk=5) return render(request, "a.html",

  4. "The Real-Time Web"

  5. AJAX 1999 Comet 2006 WebSockets 2011

  6. "Real-Time"

  7. “A system in which input data is processed within milliseconds

    so that it is available virtually immediately
  8. None
  9. None
  10. CPU cores run one thing at a time (yes, computers

    are basically a giant lie)
  11. Program 2 Program 3 Program 1

  12. Scheduling The art of running multiple things at once

  13. Program 2 Program 3 Program 1 300 cycles 300 cycles

    300 cycles
  14. Program 2 Program 3 Program 1 300 cycles Restore Save

    Restore Save Restore Save 30 cycles 30 cycles 300 cycles 30 cycles 30 cycles 300 cycles 30 cycles 30 cycles
  15. Context switching is expensive The more you have, the worse

    it gets
  16. Python's threading has this problem! The more you have, the

    worse it gets
  17. Active Threads Idle Threads Runtime 1 0 1.3 seconds 1

    1 2.3 seconds 1 5 5.4 seconds 1 30 39 seconds 1 100 15 minutes
  18. "Boxcar" scheduling has… issues Don't ever write avionics software like

    this! Thanks.
  19. None
  20. None
  21. 72kb Woven core memory

  22. 0.085 Mhz processor

  23. “ Don Eyles ...when the guidance system was first being

    conceived, the onboard software was almost an afterthought
  24. None
  25. None
  26. Priority-based Executive Please do write avionics software like this.

  27. Job Priorities Higher numbers beat lower Limited job "RAM" Only

    7 running at once Interrupts from hardware Descent radar, keyboard, etc.
  28. Predictable Software They knew exactly what ran and what it

  29. ...Unpredictable Hardware It's never easy, especially in space.

  30. None
  31. Two differently phased 800Mhz clocks This is really bad, trust

  32. False detections stole computer time The radar system had to

    update the guidance computer
  33. Descent Phase: 85% load Capsule orientation and thrust calculations Hardware

    Bug: 13% Caused by the descent radar Display Routine: 5% Astronauts trying to see how far to go
  34. 103%

  35. None
  36. SERVICER never gets to run But the system keeps trying

    to schedule it
  37. Alarm 1202 The computer self-restarts, but keeps crashing

  38. Buzz Aldrin works it out Turns off the display routine

    to bring the load under 100%
  39. Apollo 11 was almost a failure ...but good software design

    prevented it
  40. Apollo 9 First flight test of Lunar Module Apollo 10

    Second test and partial descent of Lunar Module Apollo 11 First Moon landing
  41. “ Eugene A. Cernan, recounting Apollo 10 Don't give those

    guys an opportunity to land, 'cause they might!
  42. Building for Failure Software is only as good as its

    worst outing
  43. “ Don Eyles During simulations we sometimes pushed the [restart]

    button randomly
  44. We often only design for the good cases After all,

    that's what we're expecting to happen
  45. Hardware is always unpredictable Disks, networks, even keyboards and mice

  46. Can your software survive a crash? Or does it need

    a clean shutdown to work?
  47. How will you handle the unexpected? Weird input. Slow network

    connections. Emoji.
  48. “ Don Eyles When Hal Laning designed the Executive and

    Waitlist system, he made it up from whole cloth with no examples to guide him. The design [...] still represents the state of the art.
  49. All software has consequences We may not all be designing

    spacecraft, but we affect lives.
  50. doneyles.com/LM/Tales.html Tales from the Lunar Module Guidance Computer, 2004

  51. Thanks. Andrew Godwin @andrewgodwin // aeracode.org