Skip to main content

On Kilobytes, Megabytes, and other computer-centric factors

I started programming way back. In those olden days I was working close to the hardware - on machine language code (assembly languages). Bits were important: shift left, shift right, AND/OR/XOR. And memory pages were important too: fitting an important routine within a 256 byte page of RAM could really help performance.

Today, life is different. Instead of choosing a memory address, Programmers allocate objects. If a programmer is storing a boolean, a boolean object is created. Who knows how that's represented under the hood, but it certainly isn't represented in one bit of RAM. Most programmers don't even use the bit-wise operators offered through the programming languages given to them. Sure, some do. But most do not.

And so now we get into our prefixes: kilo, mega, giga, terra, and peta (and beyond, I suppose)

Many programmers still want these prefixes to be based on powers of 2. One kilobyte is 1024 bytes (2^10). One megabyte is 1024*1024 bytes (2^20). Etc. It was a useful system up until the early 1980s, but today it serves no purpose. Why is a kilobyte 2^10? Because the number, when converted to decimal, is the power-of-two number that is closest to 1,000. 2^11 and 2^9 simply aren't as close to 1000 as 2^10.

Anyhow, all this makes some (but not much) sense in terms of addressing RAM. Then these same people wanted everything else related to computing to work the same way.

Disk Storage

So the programmers decided that since physical RAM layout was important, and that it was good to have a funny math for it, that others should follow their methods. The programmers wanted disk drives to follow the same memory conventions. At first there was some practicality to this: programmers wrote code to stick pages of RAM onto disks in what they called "disk sectors". This was primarily done because it was very easy to treat a page of RAM (perhaps 2^8 bytes) as a body of work. This was key because performance ruled the day with 1 MHz computers. (By the way, the M in MHz means exactly "1,000,000").

But over time the disk drive guys lost interest. Sectors were a false abstraction, and under the hood of the drive sectors changed size to pack in more bytes, and low-level ECC and other techniques made it pointless. Furthermore, programmers were no longer dumping pages of RAM to disk, they just wanted to store files in a file system.

And so the drive guys started to sell disks using normal base-10 units. 100 MB drive means 100 Million Bytes. This was convenient to a lot of programmers because most left base-2 mathematics behind when higher level languages became practical. Before long, if a programmer said that there were 1K of rows in a database, they meant a normal thousand and not 1,024. 

That was the start of the first war. Programmers screamed at the drive guys for abandoning their "base 2" convention. Some programmers still wanted 1 MB of disk storage to mean 1024 *1024. But why? Programmers were no longer worrying about pages of RAM and sector sizes. Those same programmers also complained when they got less storage than on the box due to the overhead of things like the realities of how a file system works. And those same programmers are creating substantial "objects" to store a 3 character string. Talk about babies, they couldn't even appreciate a file system. They just liked their silly "my way or it is wrong" math despite the fact that their way no longer had a purpose.

Let me give you a practical example: Let's say you are dumping 1 billion records onto a disk. Each record is 40 bytes long. Quick, do you have enough room if you have 38.1 GB free? WHO KNOWS! Because bonehead holier-than-thou programmers that never shifted any register on any CPU wanted to confuse everyone.

Networking

Throughout all this the network guys were having none of it. They did things in bits per second. Bytes? No way! "Byte" was an ambigulously-sized number of bits, so they smartly renamed a collection of 8 bits an "octet". Kilo? To a network guy, that meant 1000. Nothing else. Mega? 1,000,000. 100 Megabits per second meant 100,000,000 bits in one second. And it still does to a network guy.

But then the uncultured programmers got in there using their personal ideals and wrote some networking software using their own rules and confused everyone. They started to apply their way to other realms for NO REASON.

What does 100 MB/second mean?

  • Normal Person: 100,000,000 bytes in one second (100 * 1,000,000)
  • Networking Person: 100,000,000 bytes in one second (100 * 1,000,000)
  • Programmer:
    • Normal: 100,000,000 bytes in one second (100 * 1,000,000)
    • Stupid: 104,857,600 bytes in one second (100 * (1024*1024))
    • Very Stupid: 102,400,000 bytes in one second (100 * (1024*1000))

Unfortunately, many programmers have fallen into the "Stupid" trap. Or worse.

These same annoying programmers no longer use the bin/oct/hex functions of their HP16C. In fact, I'd say they most wouldn't be able to use an HP16C to add two hexadecimal numbers together.

Conclusion

It's time to give up the fully obsolete base-2 notion of kilo, mega, and giga. If you really love powers of two, use them explicitly like a REAL tech expert would. My laptop has 2^33 addresses of active RAM. And now how many 2^8 byte pages of RAM fit into that address space? Comment with your simple assembly language program that calculates this number (any architecture).


Popular posts from this blog

Repairing an HP Pavillion DV6 Motherboard

Here's my procedure on how to remove and replace the logic board of an HP Pavilion DV6. My model is a DV6-3122US, and many DV6s of the 3000 series are similar. These machines often fail to start due to a motherboard failure.  With a motherboard failure, upon pressing power the fan will first spin and the power light comes on.  The capslock key will flash white once every 4 seconds, and the f12 key will stay a solid orange, and the screen - although powered up - displays black only. Although the caps lock "single blink" indicator at boot implies a CPU failure, in my experience it is not due to the CPU itself but the supporting components on the motherboard. The only solid solution is to repair or replace the motherboard.  Replacement boards are readily available.  I bought one and replaced it myself. Disassembly Procedure NOTE: The screws are different sizes, and its important to reinstall them correctly.  I color-coded the different screws in the photos...

Various ways of powering the MikroTik hAP

I have several MikroTik RB952Ui hAP AC Lite routers.  They're located in closets, basements, attics, and on desktops.  Each location results in different needs in terms of power.  Happily, the hAP AC Lite is quite flexible when it comes to power.  Here I document the three different ways I have powered my MikroTik AC Lite routers. Power Solutions: Active PoE+ Splitter, Passive PoE Injector, and Standard wall adapter Standard Power: MikroTik (or aftermarket) Wall Wart The default way to power the AC Lite is by using its standard "barrel-style" power port, which is far more flexible than your typical router.  The AC Lite accepts power between 10 and 24VDC.  When using the MikroTik in a desktop configuration, I use the stock 24 volt MikroTik power adapter .  The stock adapter output specifications are as follows: 24 VDC 1200 mA  2.1mm barrel Center Positive  Passive Power-over-Ethernet solution: TP-Link Power Injector Sometimes it is useful to ...

Hot (and Cold) Attic Tempertures and Electronic Equipment

An unfinished attic can be an extreme environment for electronic equipment, with conditions that are very unlike what is experienced inside normal living spaces. What's the deal with installing electronic equipment in an unfinished and uninsulated attic?   I wanted to install a standard WiFi router in my attic to function as a Wireless ISP (WISP) gateway. My attic is a fantastic location from a radio signal perspective, but it is an uncomfortable place for both people and electronic gear. Although the attic is well insulated, that insulation is on the floor, designed to keep the living space of my home at moderate temperatures. As a WISP gateway, my WiFi router is best mounted above the insulation and close to the roof, where the only protection from weather extremes is the wood of the roof and a layer of asphalt shingles. Equipment Specifications and Extremes Almost all electronic equipment has a set of specifications regarding operating environment. These specifications state the...

Fixing a SodaStream Jet, part 1: Disassembly Guide

I've had my SodaStream Jet for years, and once in a while something has gone wrong. Disassembly is the first step to repair.  Start with this article to see how to disassemble the SodaStream, and then once you have that down, scroll through my other articles to see how I repaired specfic SodaStream problems. SodaStream Jet Disassembly Guide Tools Required Flat head screwdriver Phillips head screwdriver 1. Remove the Carbonator.  Duh. 2. Remove the black panel lever The front big black tilt lever needs to be removed first. Removing this panel is tricky, but it isn't impossible. Looking up at the bottom of the black panel, there are two tabs, one on the left and one on the right. These tabs fully secure the panel in place. The trick is to use a flat-head screwdriver under the plastic to gently lever the tabs out of the way.  Note in the pictures how I approach these tabs with my screwdriver.  I usually release the left side first, and then I release ...

Sodastream Carbonator Leakage, Usage, and Weight

SodaStream 60L "Carbonator" CO2 cylinders have a specific weight when empty, plus about 410 or so grams for the CO2 they should have when they're "full".  A little while ago I went to buy a replacement Carbonator from my local hardware store. The dealer pulled a new Carbonator out of the box and sensed it was lighter than usual.  He put the "light" Carbonator in the "empty" pile and sold me a different one.  At that moment I concluded that it would be smart of me to weigh both new and empty SodaStream carbonators.  Here are the results. Weighing a SodaStream Carbonator - for both Science and Consumer Protection.       The dealer told me that sometimes the carbonators leak after they leave the SodaStream filling facility.  That means there could be an opportunity for customers like me to get ripped off! The SodaStream cylinders I buy claim to have a net product weight of 410 grams - and that means that a full Soda Stream Carbonator shou...

Installing the Eve Smart MotionBlind Upgrade with my Large Roller Shade

I have a large window in the front of my house and a roller shade was just the right window treatment for it.  But I also wanted to automate it. My MotionBlind Upgrade kit and my new roller shade I looked around to buy something that I was comfortable with, but simple non-automated roller blinds can be expensive, especially when they're larger than 6 ft x 6 ft.   This is disappointing, as a roller blind is just a tube with a small amount of synthetic cloth but can easily cost hundreds of dollars. Plus, since I wanted a smarthome blind, we're talking $500 or more from the "service oriented shops". I'm a tech guy.  I think can do better. After thinking about DIY and creative solutions, I decided to try out the Eve MotionBlinds Upgrade (MBU) kit.  This kit transforms an ordinary roller blind into a smart blind.  The MotionBlinds mechanism is basically consists of a small motor and battery in a long metal tube.  This motor tube slides into a roller blind ...

Other Posts

Show more