Tags

, , , , , , , , , , , ,

As I was watching my virus scanning program nearing completion of scanning all the files on my computer, I noted the detail information.  One of the details was how fast it was scanning: 29.5 megabytes per second.  Wow.  Think about that.  In one second the program was scanning twenty-nine million, five-hundred thousand bytes–IN ONE SECOND! Absolutely mindboggling.

For readers who are geeks or near so, the rest of this will be quite boring, but for readers who are interested in bits and bytes, I hope you appreciate the lesson that follows.

What are bytes?  What are bits?  I’m glad you asked.  (Insert chuckle here.)  This post is in English, obviously.  But English is not the point.  The point is whether it is in English, German, French, or whatever, it is a language used to communicate with other people.

Machines, i.e., computers and other “smart” electronic devices, must also communicate, but they aren’t very good with accents, so they use what is called ‘machine language‘.  Machine language is comprised of just two states: high and low, meaning five volts or zero volts; a “one” or a “zero”.

In an electronic circuit. zero volts is considered a low or a zero, while five volts is considered a high, or a ‘one’.  That is the basis of machine language.  It consists of ones and zeroes combined together like letters of our alphabet to communicate.

A bit is one of those states.  In other words, a bit is either a one or a zero.  With only two possible states, not much communication is possible, so eight bits are combined to form a byte.  With a byte (8 bits) there are 256 combinations.  This is what I mean:

This is a byte consisting of all ones:   11111111    In machine language, also called binary (binary meaning only two possibles), all those ones seem to add up to only 8, but actually there is another combination:  all zeroes or 00000000.  If you think that counts up to nine, you would be incorrect.  You see, in machine or binary language, there must be a way to “count” or identify letters, numbers and symbols.  Each letter, comma, period, semicolon–everything on this page is actually a binary byte.  Machines do not understand our alphabet, but they understand bits: a one or a zero or five volts or zero volts.

When an electronic device in a circuit senses five volts, it understands that means a “one”, and when it senses less that three volts (it’s given a margin for imperfection or error) it knows that means a zero.  When eight of those bits are combined we get a byte.  Now we have 256 possible combinations, but I need to explain that.

We humans who speak languages like English, German, and so on, read from left to right.  Machine language reads from right to left.  So, if we examine a byte consisting of eight bits, we look at the bit position at the far right to start.  If it is a zero, it counts as a zero.  If it is a one, it counts as a one.  As we move to the left, each position doubles.  So, if the second bit is a one, it actually represents “two”.  The next bit, if it is a one, represents “four”, because each position doubles.  The last bit to the left, if it is a one, represents 128.

So, if a machine sees this:  00000001, it knows that is a one.  If it sees: 00000010, it knows that is a two.  To show a three, the byte would look like this:  00000011.  We count the first position at the right as a one and the next position as a two, and combining them makes the number equal to three.  To count a four, the byte would look like this:  00000100.  The third position to the left is the “four” position, and since there is a “one” there (a high bit) it is saying the number it represents is four.  If we want to represent the number five, we need to add a one, so that would look like this:  00000101.  We have a four and a one, which adds to five.

If I want to show the number 97, for instance, that would look like this: 01100001.   The far left one bit represents 64, the next to the right represents 32, and the bit at the far right represents one.  Added together, we get 97.

Have I lost you, yet?  I hope not.  It’s really very simple.  If I want to show the number 136, that would look like this:  10001000.  The one bit at the far left represents 128, and the next one bit is in the “8” position, so added together we get 136.  Remember, as you move from the first position at the far right to the next position to the left, each position doubles.  So, counting from right to left, we would count, one, two, four, eight, sixteen, thirty-two, sixty-four and finally one hundred twenty-eight.

If all the positions had a one in them, the number would add to 255, but!!–there is also a combination of all zeroes, so that makes 256 possible combinations.

Each key on your keyboard is represented by a byte, or eight bits.  Even the ‘space bar’ has a byte assigned to it. When you hit a key, a byte (8 bits) is sent to the CPU (Central Processing Unit–the computer’s brain).  The computer sees those eight bits and understands those eight bits represent a letter or symbol or something else.  If, for instance, you hit the lowercase ‘h’ key, eight bits are sent to the CPU, and it knows to put up on your display the lowercase letter ‘h’, which is made up of pixels, but that is another topic.  The combination of bits for the keyboard is referred to as ASCII or American Standard Code for Information Interchange.  It is pronounced askee.

Here is a web site where you can type something from your keyboard and see what the number is for that key.  You will see a numeric number, but that number is actually a byte. For instance, the ‘space bar’ is assigned the number 32, which in machine language, or byte, is actually 00100000.  The one is in the ’32’ position, so that is how the machine knows it is a 32.  Then, when the CPU receives that byte that adds up to 32, it moves the cursor one position by inserting a space on the screen.

http://www.cs.carleton.edu/faculty/adalal/teaching/f05/107/applets/ascii.html

Now that you understand what machine language is and that a byte is actually eight bits, let’s rethink this thing about how fast my virus scanner was working.  My scanner was scanning twenty-nine million, five hundred thousand BYTES per second!  That is 236 million bits per second!  TWO HUNDRED THIRTY-SIX MILLION BITS PER SECOND!!  I’m talking MILLIONS.  Two hundred and thirty-six million!  PER SECOND!  Absolutely mindboggling!

Try picturing in your head the computer scanning 236 million bits in one second.  Mindboggling.

Every alphabetic character you see on this page, each punctuation mark, each space is represented by a byte.  Each time I hit a key on my keyboard, a byte is sent to the CPU, which converts those bytes into a character on the screen that we can read.  All the graphics you see are also just a combination of bits and bytes.  That is all the computer understands: bits and bytes.

The next step up from a byte is a computer word.  A computer word is comprised of bytes put together.  You might have heard someone say or read somewhere about 32 bit computers and maybe even 64 bit computers.  What that means is a computer recognizes 32 bit words or 64 bit words.  A 32 bit word is actually four bytes combined, while a 64 bit word is eight bytes combined to make one 64-bit word.

A 64-bit word would look like this if it was all ones:  1111111111111111111111111111111111111111111111111111111111111111

Aren’t you glad we don’t have any 64 letter words in the English language?  (Insert LOL here).

If you added all those ones using the binary code where each position from right to left doubles, the number would be:

like quadrillions, gazillions, tregabillions, incredibillions, supercalifragilisticbillions!   The number is so big I got halfway through calculating it and it was just too incredible to continue.

In reality, we would not use a 64-bit word to represent an actual number.  Well, maybe scientists and geeks would, but not us common folks.

In order to make things easier to notate for us humans, binary can be converted into what is called ‘octal’.  That is three bits each.  So, if you saw   10011010,  in decimal that would be 154.  If you broke down those 8 bits into octal, you would have only two bits in the far left section instead of three, since each ‘octal’ number is three bits.  However, in Octal, only two bits are needed in the far left.

Now, starting from the far right, take the first three bits 010. You know that counts to two, so you would write ‘2’.  Then the next three bits (011) is a binary three, so you would write a ‘3’.  The last two bits (10) adds to two, so the last octal number would be a ‘2’.  Now you will have the octal number 232.  In order for someone to know this is an octal number and not a binary number, we have to make some sort of indication of that.  We don’t want to put something that looks like we “squared” or “cubed” the number, so we would put the number “8” [meaning this is an octal number] as a subscript, not a superscript.

The decimal number ‘8’ is in binary 1000.  In octal it would be 00 001 000 and when you separate the bits into groups for octal, you get the octal number ‘010’.

Wait. I’m not done.  There is another conversion called hex or hexadecimal.  That is sixteen bits.  Since we only have ten numbers in the decimal system ( 1 2 3 4 5 6 7 8 and 0), numbers more than nine are represented by capital letters in hexadecimal.  For instance, the number 15 in decimal is 1111 in binary, 017  in Octal (00 001 111), and F in hexadecimal.

In hexadecimal, the number 10 is the letter A, 11=B, 12=C, 13=D, 14=E, and 15=F.   Actually, F is the sixteenth number, because we can’t forget about zero:  00000000.  In hexadecimal, zero is zero.  The number 9 is a 9, but 10 is represented by the letter A.

So, decimal 9 is 9, binary is 1001, octal is (binary 00 001 001) 011, and hexadecimal is 9.  Then decimal number 10 is binary 1010, octal (binary 00 001 010) 12, and hexadecimal is the letter A.

Here is the web site for conversion of decimal, binary, octal and hexadecimal numbers:

http://ascii.cl/conversion.htm

Wow.  So much information just from thinking about how fast my virus scanner was working!  Absolutely Mind Boggling!

Advertisements