logo

drewdevault.com

[mirror] blog and personal website of Drew DeVault git clone https://hacktivis.me/git/mirror/drewdevault.com.git

Abiopause.md (5467B)


  1. ---
  2. date: 2020-03-03
  3. title: The Abiopause
  4. layout: post
  5. ---
  6. The sun has an influence on its surroundings. One of these is in the form of
  7. small particles that are constantly ejected from the sun in all directions,
  8. which exerts an outward pressure, creating an expanding sphere of particles that
  9. moves away from the sun. These particles are the solar wind. As the shell of
  10. particles expands, the density (and pressure) falls. Eventually the solar wind
  11. reaches the *interstellar medium* — the space between the stars —
  12. which, despite not being very dense, is not empty. It exerts a pressure that
  13. pushes inwards, towards the sun.
  14. Where the two pressures balance each other is an interesting place. The sphere
  15. up to this point is called the *heliosphere* — which can be roughly
  16. defined as the zone in which the influence of the sun is the dominant factor.
  17. The *termination shock* is where the change starts to occur. The plasma from the
  18. sun slows, compresses, and heats, among other changes. The physical interactions
  19. here are interesting, but aren't important to the metaphor. At the
  20. termination shock begins the *heliosheath*. This is a turbulent place where
  21. particles from the sun and from the interstellar medium mix. The interactions in
  22. this area are complicated and interesting, you should read up about it later.
  23. ![Picture of a faucet pouring into a sink](https://legacy.sr.ht/_FIT.svg)
  24. <div class="text-center">
  25. <small>Yanpas via Wikimedia Commons, CC-BY-SA</small>
  26. </div>
  27. Finally, we reach the *heliopause*, beyond which the influence of the
  28. interstellar medium is dominant. Once crossing this threshold, you are said to
  29. have left the solar system. The Voyager 1 space probe, the first man-made object
  30. to leave the solar system, crossed this point on August 25th, 2012. Voyager 2
  31. completed the same milestone on November 12th, 2018[^1].
  32. [^1]: It took longer because Voyager 2 went on to see Uranus and Neptune. Voyager 1 just swung around Saturn and was shot directly up and out of the solar system. Three other man-made objects are currently on trajectories which will leave the solar system.
  33. In the world of software, the C programming language clearly stands out as the
  34. single most important and influential programming language. Everything
  35. forming the critical, foundational parts of your computer is written in it:
  36. kernels, drivers, compilers, interpreters, runtimes, hypervisors, databases,
  37. libraries, and more are almost all written in C.[^2] For this reason, any
  38. programming language which wants to get anything useful done is certain to
  39. support a C FFI (foreign function interface), which will allow programmers to
  40. communicate with C code from the comfort of a high-level language. No other
  41. language has the clout or ubiquity to demand this level of deference from
  42. everyone else.
  43. [^2]: Even if you don't like C, it would be ridiculous to dismiss its influence and importance.
  44. The way that an application passes information back and forth with its
  45. subroutines is called its *ABI*, or application binary interface. There are a
  46. number of ABIs for C, but the most common is the System-V ABI, which is used on
  47. most modern Unix systems. It specifies details like which function parameters to
  48. put in which registers, what goes on the stack, the structure and format of
  49. these values, and how the function returns a value to the caller. In order to
  50. interface with C programs, the FFI layers in other programs have to utilize this
  51. ABI to pass information to and from C functions.
  52. Other languages often have their own ABIs. C, being a different programming
  53. language from $X, naturally has different semantics. The particular semantics of
  54. C don't necessarily line up to the semantics the language designers want $X to
  55. have, so the typical solution is to define functions with C "linkage", which
  56. means they're called with the C ABI. It's from this that we get keywords like
  57. `extern "C"` (C++, Rust), Go's Cgo tooling, `[DllImport]` in C#, and so on.
  58. Naturally, these keywords come with a lot of constraints on how the function
  59. works, limiting the user to the mutually compatible subset of the two ABIs, or
  60. else using some kind of translation layer.
  61. I like to think of the place where this happens as the "abiopause", and draw
  62. comparisons with the solar system's heliopause. Within the "abiosphere", the
  63. programming language you're using is the dominant influence. The idioms and
  64. features of the language are used to their fullest extent to write idiomatic
  65. code. However, the language's sphere of influence is but a bubble in a sea of C
  66. code, and the interface between these two areas of influence is often quite
  67. turbulent. Directly using functions with C linkage from the abiosphere is not
  68. pleasant, as the design of good C APIs do not match the semantics of good
  69. $X APIs. Often there are layers to this transition, much like our solar
  70. system, where some attempt is made to wrap the C interface in a more idiomatic
  71. abstraction.
  72. I don't really like this boundary, and I think most programmers who have worked
  73. here would agree. If you like C, you're stuck either writing bad C code or using
  74. poorly-suited tools to interface badly with an otherwise good API. If you like
  75. $X, you're stuck writing very non-idiomatic $X code to interface with a foreign
  76. system. I don't know how to fix this, but it's interesting to me that the
  77. "abiopause" appears to be an interface full of a similar turbulence and
  78. complexity as we find in the heliopause.