I often find myself explaining the same things in real life and online, so I recently started writing technical blog posts.

This one is about why it was a mistake to call 1024 bytes a kilobyte. It’s about a 20min read so thank you very much in advance if you find the time to read it.

Feedback is very much welcome. Thank you.

    • Phrodo_00@lemmy.world
      link
      fedilink
      English
      arrow-up
      10
      arrow-down
      3
      ·
      1 year ago

      when you format a 256GB drive and find out that you don’t actually have 256GB

      Most of the time you have at least 256GB. It’s just you 256GB=238.4GiB, and windows reports GiB but calls them GB. You wouldn’t have that problem in Mac OS that counts GB properly, or gnome that counts GiB and calls them GiB.

      (This is ignoring the few MB that takes to format a drive, but that’s also space on the disk and you’re the one choosing to partition and format the drive. If you dumped a file straight into the drive you’d get that back, but it would be kind of inconvenient)

    • wikibot@lemmy.worldB
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      4
      ·
      1 year ago

      Here’s the summary for the wikipedia article you mentioned in your comment:

      Both the British imperial measurement system and United States customary systems of measurement derive from earlier English unit systems used prior to 1824 that were the result of a combination of the local Anglo-Saxon units inherited from Germanic tribes and Roman units. Having this shared heritage, the two systems are quite similar, but there are differences. The US customary system is based on English systems of the 18th century, while the imperial system was defined in 1824, almost a half-century after American independence.

      article | about

    • wischi@programming.devOP
      link
      fedilink
      English
      arrow-up
      5
      arrow-down
      30
      ·
      edit-2
      1 year ago

      So why don’t they just label drives in Terabit instead of terabyte. The number would be even bigger. Why don’t Europeans also use Fahrenheit, with the bigger numbers the temperature for sure would instantly feel warmer 🤣

      Jokes aside. Even if HDD manufacturers benefit from “the bigger numbers” using the 1000 conversation is the objectively only correct answer here, because there is nothing intrinsically base 2 about hard drives. You should give the blog post a read 😉

      • silly goose meekah@lemmy.world
        link
        fedilink
        English
        arrow-up
        24
        arrow-down
        5
        ·
        1 year ago

        there is nothing intrinsically base 2 about hard drives

        did you miss the part where those devices store binary data?

        • wischi@programming.devOP
          link
          fedilink
          English
          arrow-up
          7
          arrow-down
          19
          ·
          1 year ago

          Binary prefixes (the ones with 1024 conversations) are used to simplify numbers that are exact powers of two - for example RAM and similar types of memory. Hard drive sizes are never exact powers of two. Disk storing bits don’t have anything to do with the size of the disk.

          • silly goose meekah@lemmy.world
            link
            fedilink
            English
            arrow-up
            10
            arrow-down
            2
            ·
            1 year ago

            sure, but one of the intrinsic properties of binary data is that it is in binary sized chunks. you won’t find a hard drive that stores 1000 bits of data per chunk.

            • abhibeckert@lemmy.world
              link
              fedilink
              English
              arrow-up
              4
              arrow-down
              2
              ·
              edit-2
              1 year ago

              The “chunk” is often 32,768 bits these days and it never matches the actual size of the drive.

              A 120 GB drive might actually be closer to 180 GB when it’s brand new (if it’s a good drive - cheap ones might be more like 130 GB)… and will get smaller as the drive wears out with normal use. I once had a HDD go from 500 GB down to about 50 GB before I stopped using it - it was a work computer and only used for email so 50 GB was when it actually started running out of space.

              HDD / SSD sellers are often accused of being stingy - but the reality is they’re selling a bigger drive than what you’re told you’re getting.

            • wischi@programming.devOP
              link
              fedilink
              English
              arrow-up
              2
              arrow-down
              8
              ·
              1 year ago

              Look up the exact number of bytes and then explain to me what the benefits are of using 1024 conversations instead of 1000 for a hard drive?

            • wischi@programming.devOP
              link
              fedilink
              English
              arrow-up
              2
              arrow-down
              1
              ·
              1 year ago

              Not even SSDs are. Do you have an SSD? You should lookup the exact drive size in bytes, it’s very likely not an exact power of two.

                • wischi@programming.devOP
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  edit-2
                  1 year ago

                  The underlying chips certainly are exact powers of two but the drive size you get as a consumer is practically never an exact power of two, that’s why it doesn’t really make sense to divide by 1024.

                  The size you provided would be 500107862016 / 1024 / 1024 / 1024 = 465.76174163818359375 GiB

                  Divided by 1000³ it would be 500.107862016 GB, so both numbers are not “pretty” and would’ve to be rounded. That’s why there is no benefit in using 1024 for storage devices, even SSDs.

                  The situation is a bit different with RAM. 16 “gig” modules are exactly 17179869184 bytes. https://www.wolframalpha.com/input?i=prime+factors+of+17179869184

                  So you could say 17.179869184 GB or 16 GiB. Note that those 16 GiB are not rounded and the exact number of bytes for that RAM module. So for memory like caches, RAM, etc. it definitely makes sense to use binary prefixes with 1024 conversion but for storage devices it wouldn’t make a difference because you’d have to round anyway.

                  • gens@programming.dev
                    link
                    fedilink
                    English
                    arrow-up
                    1
                    ·
                    1 year ago

                    It’s the size in bytes as the os sees it (and in SMART). And i do know how to use a calculator, thank you.

                    There is also no benefit to using 1000. Except to hdd makers.

      • wewbull@feddit.uk
        link
        fedilink
        English
        arrow-up
        18
        arrow-down
        1
        ·
        1 year ago

        there is nothing intrinsically base 2 about hard drives

        Yes there is. The addressing protocol. Sectors are 512 (2⁹) bytes, and there’s an integer number of them on a drive.

        • wischi@programming.devOP
          link
          fedilink
          English
          arrow-up
          2
          arrow-down
          17
          ·
          1 year ago

          That’s true but the entire disk size is not an exact power of two that’s why binary prefixes (1024 conversation) don’t have any benefit whatsoever when it comes to hard drives. With memory it’s a bit different because other than with storage devices RAM size is always exactly a power of two.