?

Log in

No account? Create an account
entries friends calendar profile Previous Previous Next Next
Geeks love to work in 2s - or why your phone has 16Gb, not 20. - Ed's journal
sobrique
sobrique
Geeks love to work in 2s - or why your phone has 16Gb, not 20.
Have you ever wondered why you don't get 'round' numbers of gigabytes when you're buying a phone, or memory card?
No doubt you've seen it - you'll see 8, 16Gb, 32GB, and almost never a 10, 20Gb or 30Gb.

The reason is actually quite simple - because the simplest representation of information is the binary state - on or off. We call this the 'bit' - or Binary Digit and it doesn't matter if that's a light switch, or a punch card with holes and 'not holes'.

If you string together bits - you get a multiplying effect. If I have _two_ bits - each can be in two states, giving us 4 combinations. (ON/ON, ON/Off, Off/ON, and Off/Off).
As we add more bits, we end up with more potential combinations, and we simplify the two states into '1' for on, and '0' for 'off'.

This is where we get the start of binary - computer memory is incredibly simplistic, and you can think of it all as a long sequence of switches - that are either on or off.

A byte - with 8 'bits' - gives us 2 ^ 8 states - or 256.
So if we were wanting to represent numbers - we could convert any number between 0 and 255 into a 'byte'.
But it's cumbersome to write:
100 = 0110 0100

That's why hexidecimal is used - hexidecimal is base 16 - so each 'digit' goes from 0-15. (0-9A-F).
That's actually a much easier way of representing a binary number, as you can take each 'chunk' of 4 bits.
So that '100' in decimal, could be represented as 0110 (6) and 0100 (4). (the reason we have to use 'hex' is because the 4 bit block go up to 16, and so we need extra numbers).

But anyway - memory is - in effect - a bunch of switches. Each switch we add doubles the number of possible states - so where '8 bits' gives us 256 states, 9 gives us 512, and 10 gives us 1024.

The 'standard' size is 8 bits to make up a byte - that gives us 0000 0000 -> 1111 1111 - or to represent it in hexidecimal - 00 to FF. (You may see 0x in front of a hex number, just to make it clear that 0x64 is _not_ 64 in decimal.)

This is largely why you get memory sizes in multiples of 2.
1 Kb = 2 ^ 10 bytes.
1 Mb = 2 ^ 20 bytes.
1 Gb = 2 ^ 30 bytes
1 Tb = 2 ^ 40 bytes.

Because you double your number of 'states' by adding an extra bit, it ends up effectively wasteful to 'round down' to neat multiples of 10, as we're used to. If you want to hold 'up to 100 (decimal)' different states - 7 bits hold 2^7 states, which is 128. 6 bits holds 2^6 states - or 64.
So we'd need to use 7 bits, and - basically - throw away 28 of them, and never use them. Which is largely why we end up with 'nice neat' multiples of 2 for almost all our storage devices.
32 Gb being 2^35 bytes.

*We have Claude Shannon to thank for much of the grounding of information theory. http://en.wikipedia.org/wiki/Claude_Shannon,
Leave a comment