Magic Numbers

(exple.tive.org)

177 points | by todsacerdoti 9 days ago

13 comments

  • thayne 9 days ago
    At least there was a technical reason, even if it no longer makes sense. The ATM[1] protocol has a packet size of 48 bytes. Why? Because the US wanted 64 and france wanted 32. So a compromise was made that pleased no one and the standard used the average of the two, which of course isn't a power of 2.

    [1]: https://en.m.wikipedia.org/wiki/Asynchronous_Transfer_Mode

    • cquintana92 9 days ago
      48 bytes which doesn't include the header, which was decided to be 5 bytes because it was "around 10% of the body", making it... 53.
      • TeMPOraL 9 days ago
        I'd loved to be in the room when those decisions were made. I can almost imagine some arbiter hearing the arguments from both sides, and then, to the horror of everyone, deciding that if they can't agree on a common value, they'll have to meet half-way.

        OTOH, skimming the Wikipedia article, it seems to me that overhead in that system was proportional to message length, so perhaps length of 53 bytes was still meaningfully better than 64 bytes.

        • masfuerte 9 days ago
          It's an old story. One side should have renounced their claim rather than live with the abomination, and then the arbiter could have chosen their proposal as the one true packet size. The arbiter's wisdom would have been celebrated for millennia.
    • netmare 9 days ago
      That's like a programming language with 0.5-based array indexing.
      • n4r9 9 days ago
        It's the classic "off by half" index bug.
        • BizarroLand 7 days ago
          Doing the mental math is a lot harder, too. Any halfway decent computer nerd knows on some level that 2^10=1024, but 1/2^10=0.0009765625.

          Doesn't quite lock into the memory banks so easily.

      • MawKKe 8 days ago
      • brookst 9 days ago
        No fence post problems if you just put each post in the middle of each span!
  • parhamn 9 days ago
    Interesting!

    Semi-related problem I dealt with recently: Google Cloud seems to choose a different magic number of 1460 for their VPCs default MTU, which is annoying if you don't know because its different than the default of everything else (such as docker) will cause random packet drops if you do a standard install of those tools.

    Took me a few hours to figure this out.

    • derekp7 9 days ago
      I recall working on a customer host that I was ssh'd into. If I did an operation that displayed a bunch of text, the session would freeze up. It wouldn't freeze if I only did a bit of text at at time though. On a whim, I tried lowering the MTU, set it to something like 1000 and it worked without freezing on me. Was able to raise it to 1460 (I believe) and still work, but anything beyond that I would get the session lockups on more than a few sceens of data.

      Later I researched it, and they were blocking all of ICMP which not only killed ping, but messed with mtu path discovery. Found some information about it on a Cloudflare blog: https://blog.cloudflare.com/path-mtu-discovery-in-practice

    • edward28 9 days ago
      They must be encapsulating traffic on the backend.
      • londons_explore 9 days ago
        In the world of ethernet jumbo frames, you'd imagine they could encapsulate the traffic yet still support sensible MTU's...
      • jppittma 9 days ago
        There is almost certainly so much network virtualization going on your head would spin.
  • easyThrowaway 9 days ago
    I remember reading a comment on stack overflow on old 16 bit x86 architecture saying “any overly complicated feature of modern computing can be attributed to a time where the most powerful cpu available was weaker than the one currently residing inside your tv remote”.
  • mehulashah 9 days ago
    This is similar to why booster rockets are a certain width — they needed to be moved by trains that went through tunnels carved by the Romans. Those tunnels were the width of two horses pulling a chariot.
  • dhosek 9 days ago
    The bit about security is rather telling. I can remember in the early days of the internet almost every system on the internet had its telnet ports open. I would often telnet into my alma mater’s VAX systems from work to read Usenet news. I also had write access to system directories on the VAX that we used at work, which I never abused, but which in retrospect seems distressingly trusting. I have no idea how we qualified for ISO-9001 certification with that level of security.
    • ddingus 9 days ago
      When I got on the net in 1990, my dialup ISP sysadmin had all home directories were globally readable, "so we can learn from one another." And we did!

      That same admin had made cool menus and guide posts, documents that showed everyone about the net.

      We had many system wide chats about stuff and everyone was all about helping everyone else.

      Then we had the Eternal September... or was it December. In any case, for a couple years there before we got the first browser.

      Everyone was mentored onto the Net in the early days. I wish that would have continued, but it would never have scaled, ah well.

      Yes, I had a list of machines I could telnet to. Each offering some resource.

      Oh, one cool thing was being able to ask for a bigger disk quota, download some big stuff and swing by the office to move it onto portable storage. SCSI disk or floppy or tape. I loved those chats right there in the server room!

    • myrmidon 9 days ago
      > I also had write access to system directories on the VAX that we used at work, which I never abused, but which in retrospect seems distressingly trusting.

      I can totally understand that feeling, but my personal experience is honestly that "protecting the company from malicious employees" by technical means is often just window dressing.

      A patient malicious internal actor that is both technically and socially competent can cause much more damage than most companies would ever admit to themselves (but those actors are rare enough to keep modern workplaces running just fine).

      In short I think that just giving employees root access to some important company-internal system could work out surprisingly well even for decently-sized companies (not that I'm advocating for that :P).

      • dhosek 9 days ago
        It’s less a case of worrying about maliciousness than incompetence. I remember reading a post here about some junior dev who accidentally dropped a production database. I can see an employee accidentally doing a DELETE/FORCE [...]*.*;*¹ in the wrong directory.

        1. The VMS equivalent, to the best of my recollection, of rm -rf *

  • Denvercoder9 9 days ago
    Why did it matter that a frame was transmitted in 2^12 microseconds, though? Why not 2^11 or 2^13?
    • teaearlgraycold 9 days ago
      2^12 wasn’t a constraint. The constraint was the clock speed of 3MHz. But making the frame size 1500 Bytes was nice because you get a clean power of two for frame transmission time.

      You could lower or raise the frame size and have it take any amount of microseconds you want. Perhaps ~4ms was selected with human interaction times in mind. You can send a frame, process for a few ms, then send one frame back quick enough for feedback to appear as instant.

      • persnickety 9 days ago
        And if a second was defined centuries ago to be longer or shorter, we'd end up with some other length of time that was a power of 2 close to 4ms, resulting in a different MTU.

        If that's indeed the reasoning, then it's amazing how arbitrary decisions made in the past end up deciding today's standards.

        Now I want the story of the 9000 bytes MTU.

  • fanf2 8 days ago
    In Metcalfe and Boggs (1976) https://dl.acm.org/doi/10.1145/360248.360253 they say the max frame size of 3 Mbit/s PARC Ethernet was about 4000 bits, big enough for one Xerox Alto disk sector.

    The 1500 byte frame size was introduced with 10 Mbit/s DIX Ethernet. PARC Ethernet had 8 bit terminal addresses whereas DIX Ethernet introduced 48 bit MAC addresses.

  • geraldalewis 9 days ago
    I thought it was interesting, but I think citations are needed.
  • dooglius 8 days ago
    The Ethernet header is 14 bytes (18 if you include a vlan tag), not 36?
  • bux93 9 days ago
    Wait until you find out that token ring networks have a minimum cable length between stations, dictated by the length of the token (24 bits).
    • fanf2 8 days ago
      Thicknet and thinnet coax Ethernet also had restrictions on distance between stations. Thick ethernet cables had a band every 2.5 metres to mark where a vampire tap could be attached, to minimize intereference problems from signal reflections.
  • ano-ther 9 days ago
    Reminds me of the Space Shuttle booster size being determined by Roman horses.

    But something seems off in the calculation. 2^12 microseconds for one frame would be awfully slow. [EDIT: I stand corrected below]

    > 12288 bits, which takes 2^12 microseconds to transmit at 3Mb/second,

    • jcranmer 9 days ago
      > Reminds me of the Space Shuttle booster size being determined by Roman horses.

      A story that's passed around a million times whose truth content is damn close to nothing?

      • hi-v-rocknroll 9 days ago
        Not exactly. Read this: https://www.snopes.com/fact-check/railroad-gauge-chariots/

        SRBs were made in Utah by Thiokol and sent by rail in sections. The limiting factor (choke point) was a single mountain tunnel, which was built a long time ago and was influenced by the winners of the rail gauge wars.

        If you want to be confrontational skeptic to seem original, that's all you.

        • jcranmer 9 days ago
          You can see my nearby thread for a more detailed look at the claim.

          The tl;dr: the "limiting factor" is a tunnel width of 18', against a standard US loading gauge of 10'6", and a standard US track gauge of 4'8½" ... and the SRBs are 12' in diameter, which doesn't seem clearly limited by any of those factors whatsoever.

          • brookst 9 days ago
            Does the tunnel have any curved track?
            • jcranmer 9 days ago
              From openrailwaymap, it doesn't look like it.
              • anakaine 8 days ago
                There could also be switching gear, signage, etc internal to the tunnel they had to deal with - if the claim is even valid in terms of this being the spurce of restriction on booster size.
          • hi-v-rocknroll 9 days ago
            [flagged]
    • lilyball 9 days ago
      That calculation is correct. 2^12 microseconds is 4096µs, or 0.004096s, and 12288b / 3Mbps is 12288 / 3000000 is 0.004096. So yeah, just a hair over 4ms for 1536 bytes. Exceedingly slow by modern standards.
      • ano-ther 9 days ago
        Thanks. You are right of course.
    • oersted 9 days ago
      Thanks for the Space Shuttle factoid, quite relevant to the OP article

      https://www.astrodigital.org/space/stshorse.html

      • nathell 9 days ago
        • caseyy 9 days ago
          Ugh, in that GDPR notice, collecting data for personalized advertisement and measuring avert performance (tracking behavior for ads) is turned on by default as “legitimate interest” and this data is shared with tens of partners. Legitimate interest is for direct marketing, but this is not.
        • dr_dshiv 9 days ago
          Not really, if you read the full link. The Snopes felt like it was bending backwards to disprove the story. It gave nuance—but the principle is still the same.

          Am I missing something?

          • jcranmer 9 days ago
            This is an article where I think Snopes does a really bad job.

            Pretty much every factual allegation in the original article is false, and to cap it all off, actually trying to track down the key assertion--the effect of rail transportation limitations [implied to be caused by history dating back to Roman times] on booster design--indicates to you that it had no relevance whatsoever.

            Snopes is accurate in that the track gauge being slightly less than 5' is somewhat correlated with the width of two horses. But the track gauge being slightly less than 5' isn't even relevant to the main claim!

      • jcranmer 9 days ago
        It's worth pointing out that this factoid is completely false.

        Let me give the actual answers to the questions:

        > That's an exceedingly odd number [4'8½" track gauge]. Why was that gauge used?

        Various railroad companies in the US over the 19th century moved to standardize gauges as the interconnected nature of railways meant that it was far more beneficial to have a uniform gauge throughout the system rather than dealing with constant gauge switches. The single biggest gauge conversion was the decision of railroads in the South to move to the same gauge as the Pennsylvania Railroad, 4'9", in 1886, converting some 11,000 miles of 5' gauge track to 4'9" in a weekend.

        Yes, I said 4'9", not 4'8½". The difference between these two gauges is generally within tolerance, but higher speed traffic generally requires tighter attention to tolerances, and so setting the median at a world uniform 4'8½" standard gauge makes sense. Note that the British legislated the 4'8½" as that country's standard gauge in 1846.

        > I see, but why did the English build them like that?

        Well, there was a wide variety of gauges in England even after the passage of the Gauge Act, to say nothing of the time when the US was relying on English engineers to build railroads (which is the 1820s; by the mid-1830s, the US already has a pretty thriving homegrown rail industry). There's a broad cluster of track gauges around 5', and that's a pretty natural fit for a rail gauge.

        > Well, why did they use that gauge in England?

        Stephenson (who built the first practical steam locomotive) chose to use 4'8" for his early railways to match the existing (non-steam) railways then in use, and later expanded it to 4'8½" for the Liverpool & Manchester Railway for better curve engineering. Given the fact that Stephenson was one of the preeminent engineers in England at the time, there was a tendency to use his decisions as a basis for future railway design. However it should be noted that another great titan of English engineering, Isambard Kingdom Brunel, chose a 7' gauge for the Great Western Railway, and this prompted the gauge war that led to the passage of the Gauge Act.

        > Okay! Why did their wagons use that odd wheel spacing?

        At this point I have to seriously wonder... has this author ever seen a pre-industrial wagon? Because wagons don't have fixed wheel spacing! And they're not around 4'8½"; in fact, they're generally much larger. Look at a railroad car, and notice that it is basically a platform hoisted above the wheels. But wagons are generally built so that the platform is situated between the wheels, with relatively little clearance between the axle and the base of the platform.

        > So who built these old rutted roads?

        Not worth answering this question since we've deviated from any relevance whatsoever.

        > And the ruts?

        Going to comment on the answer here: "Roman war chariots." Dude, Romans didn't have war chariots; they became obsolete centuries before Rome existed.

        > So, just what does this have to do with the exploration of space?

        Absolutely nothing.

        You see, the entire discussion I gave so far was on track gauge. But track gauge has no relevance whatsoever to the question of what the maximum size of a load you can carry on track is... that's loading gauge. And whereas track gauge is largely standardized across the world--4'8½"--the loading gauge is very much not. One should note that England, the birthplace of the railroad, generally suffers from extremely tiny loading gauges; the US is among the roomiest loading gauges in the world, especially Plate H double-stacked container traffic.

        The main tunnel east of Ohio that's being referred to is likely Moffat Tunnel, which (per Wikipedia) has a width of 18'. Standard US loading gauge is 10'6" wide; the European standards are generally 10'4"; the UK can sometimes go down to 9' loading gauge. The Space Shuttle SRBs are, per Wikipedia, 12'... above all of them. So even the standard loading gauge in the US didn't limit the diameter of the SRB, much less any discussion of the track gauge!

        • metadat 9 days ago
          I was skeptical but your claims all checked out!

          https://discoveryparkofamerica.com/uncategorized/the-great-g...

        • dr_dshiv 9 days ago
          If you substitute Roman wagons for chariots— and assume some tolerances — the rail gauges are based on wheel ruts. Yes, there were lots of gauges—but the one that won out just happened to match up perfectly with the wheel ruts?

          No one is saying that the boosters are the same size as the rail gauge. Just the size of the train & train tunnels. As you mention, it’s not a standard size.

          But the link and the intuition are the same. Our modern technology standards are based on anachronistic technologies. That was the point of the article.

          • jcranmer 9 days ago
            > If you substitute Roman wagons for chariots— and assume some tolerances — the rail gauges are based on wheel ruts. Yes, there were lots of gauges—but the one that won out just happened to match up perfectly with the wheel ruts?

            No, they're not. The wheel ruts should be about 7' apart. The rail gauge is 4'8½", which is far less than that.

            But as noted, if you trace the history of 4'8½", it comes from a 4'8" gauge (no longer perfect), and that comes from the existing infrastructure that was used to haul coal out of the mines, which came about in the 18th century, has no relevance to any wheel ruts whatsoever.

            (Also, I should point out, there's also a tunnel-free route from Salt Lake City to Florida; just head north and over to Laramie instead of in the Moffat Tunnel. No clue what the actual route used was.)

            • dr_dshiv 9 days ago
              Here are some wheel ruts from Pompeii. They don’t look 7’ apart. https://www.reddit.com/r/interestingasfuck/s/8mQNbrWYVE

              Thanks for the details. If those coal mine gauges came from the dynamics of draft horses, would you agree with this example showing the idea that “anachronistic technology impacts modern standards?”

              • jcranmer 9 days ago
                I'm using the Conestoga wagon as my size of the wagon because it's dimensions I can easily find (see https://www.thehenryford.org/collections-and-research/digita... for source). It's virtually impossible to find any hard details on wagon sizes online because search for roman wagon sizes and the stupid story pops up instead.

                > If those coal mine gauges came from the dynamics of draft horses

                I think coal mine haulage was dominated by hand, not by people (one of the reasons they used track technology--tracks make it easier to handle the heavier loads).

                > would you agree with this example showing the idea that “anachronistic technology impacts modern standards?”

                Not really. As noted, the track gauge wars occurred well into the development of steam technology (so the horse dimensions played no role), and it turns out for a variety of engineering reasons that the sweet spot for railroad track gauge is around 5'. So track gauges aren't based on anachronistic technology.

                And also, as I pointed out, the track gauge didn't play a role in determining the size of loading gauge or tunnel width. And no one has actually ever provided any evidence that the people who designed the booster wanted a larger rocket, but couldn't build it because they were limited by the loading gauges. So it's not even clear that any concerns about the ability to transport by rail played a role in determining the size of the booster.

                The only thing you have linking anything here to the size of the booster is this statement:

                > The railroad from the factory runs through a tunnel in the mountains. The SRBs had to fit through that tunnel. The tunnel is slightly wider than a railroad track, and the railroad track is about as wide as two horses' behinds.

                And every single fact in that statement is false: there is a path that doesn't run through a tunnel, so the SRBs don't have to fit through "that" tunnel; and tunnels are not "slightly wider" than railroad track, and railroad track is not "about as wide as two horses' behinds."

  • risenshinetech 9 days ago
    What's the point of articles like this? I see them crop up all the time where someone from the future looks back on some distant past WAY out of context, and says things like "This was INSANE!" "Who would ever design something like this!?" "Look at how much smarter this other idea would have been!". It's not constructive or interesting.

    The answer is universally this: whoever designed <thing> at the time couldn't even fathom <modern thing>, and didn't need to fathom <modern thing> while they were designing <thing>. What they did at the time made perfect sense for the constraints they were aware of.

    • frankthepickle 9 days ago
      it's a fun fact and a bit of history. you're welcome to move on.
    • monero-xmr 9 days ago
      It’s still interesting, and I appreciated the concise essay.

      It’s also good to remind the next generation of engineers (and ourselves) to be humble because we stand on the shoulders of giants who they themselves stood on the shoulders of giants, and on and on

    • m2f2 9 days ago
      Agreed. But please consider my efforts to have my network team to move out of the default MTU and deploy jumbo frames.... because it's always been 1500 and we feel safer keeping it in 2024.... :(
    • nuancebydefault 8 days ago
      I always wondered where this 1500 came from and now I see it was not really a coincidence, I find that in fact really interesting. It reminds me of origins of PAL/NTSC 25/30 Hz (actually a bit less than 30, for good reasons). Also, sometimes film material of 24fps has been played back at 25 fps on tv, for convenience.
    • travisjungroth 9 days ago
      That seems like an unfair reading. In the same paragraph as “insane”:

      > I bet it seemed like a very reasonable tradeoff.

    • gipp 9 days ago
      I mean... you pretty much just repeated what the article said, though. You agree with him.
    • caseyy 9 days ago
      Yeah, that part is a bit grand-standey. It was awkward to read.

      Also, it’s not very correct. You could dump bits straight into a memory buffer and still sanitize them before use. It’s not as insane of a security issue as presented. It’s more like downloading a file today and not executing it. It technically passed though your system memory, it was just never executed as instructions.

      Well, I think it made the author feel good about themselves so maybe they didn’t notice it doesn’t serve a purpose to the reader. It happens a lot.