Did I get all of the memory/disk I paid for?
Sunday, April 11th, 2010 | Author: Bruce

It’s a frequent source of confusion – things on the box don’t seem to match what you see in a program.  The confusion arises because computers don’t have 10 fingers.

The problem is that we have always used our 10 fingers (also known as digits) to count.   Unlike the Romans who didn’t use a numbering scheme where the position of the number indicated value, we have grown to use a numbering scheme where the same symbol (1) can have different meaning depending upon its postion – the ‘1′ is in the numbers 1, 10, 100, etc. has a different meaining in each.  We make use of 10 symbols to represent a value:  0,1,2,3,4,5,6,7,8,9.

It works out that when you have a 1 as the left-most position in a number, the position of that 1 corresponds to a power of 10.

Computers don’t have 10 fingers, they don’t have 10 representations of value.  Instead they have to work with just two possible representations – 0 and 1, reflecing the state of being either elecronically OFF or ON for memory, or magnetically charged or not charged for disk memory etc.  Eveb with just the two possible digits we have the capability of counting – we just have to consume more positions.  Here’s counting to 15 in binary:

0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111

This table shows the number of binary digits, 1,2,3,… the power of 2 that the left-most bit position that power represents in base 10, and the maximum number in base 10 that you can represent with that many binary digits.

# of Bits, Left-most Bit Value, Capacity
1             1             1    0 or 1  ( 1 in binary is also 1 in base 10)
2             2             3   0, 1, 10, 11    ( 11 in binary is 3 in base 10 )
3             4             7   0, 1, 10, 11, 100, 101, 110, 111 ( 111 in binary is 7 in base 10)
4             8             15
5             16            31
6             32            63
7             64            127
8             128           255
9             256           511
10            512           1023
11            1024          2047     1 “K”
12            2048          4095
13            4096          8191
14            8192          16383
15            16384         32767
16            32768         65535
17            65536         131071
18            131072        262143
19            262144        524287
20            524288        1048575
21            1048576       2097151    1 “M”
22            2097152       4194303
23            4194304       8388607
24            8388608       16777215
25            16777216      33554431
26            33554432      67108863
27            67108864      134217727
28            134217728     268435455
29            268435456     536870911
30            536870912     1073741823
31            1073741824    2147483647  1 “G”
32            2147483648    4294967295

While we think of 1,000 as K for Kilobyte, you will note that there is no representation in the table that matches 1,000.  The closest thing to that is 1024.  By the time we get up to M for Megabyte you see that the ’spread’ between what we think of as a nice round number and the actual number is quite large.  It has just become common practice to use the abbreviations for KB, MB, GB, TB etc. for a number in base 10 ( 1,000; 1,000,000, etc. that are nice numbers with sets of 3 zeros – but those numbers don’t line up well with the powers of 2 that are actually used to address the bytes in memory or on the disk.

Category: Miscellaneous