Bits, Bytes, and Measurement Terms 19 Binary Representation of Data Computers are electromechanical devices made up of electronic switches. At the lowest levels of computation, computers depend on these electronic switches to make decisions. As such, computers react only to electrical impulses. These impulses are understood by the computer as either on or off states (1s or 0s). Computers work with and store data using electronic switches that are either on or off. Computers can only understand and use data that is in this two-state (binary) format. 1 represents an on state, and 0 represents an off state. These 1s and 0s represent the two possible states of an electronic component in a computer. These 1s and 0s are called binary digits or bits. The American Standard Code for Information Interchange (ASCII), the most com- monly used code for representing alphanumeric data in a computer, uses binary digits to represent the symbols typed on the keyboard. When computers send on/off states over a network, electricity, light, or radio waves represent the 1s and 0s. Each charac- ter has a unique pattern of eight binary digits assigned to represent the character. Bits, Bytes, and Measurement Terms Bits are binary digits. They are either 0s or 1s. In a computer, they are represented by on/off switches or the presence or absence of electrical charges, light pulses, or radio waves. For example: ■ A binary 0 might be represented by 0 volts of electricity (0 = 0 volts). ■ A binary 1 might be represented by +5 volts of electricity (1 = +5 volts). Computers are designed to use groupings of 8 bits. This grouping of 8 bits is called a byte. In a computer, 1 byte represents a single addressable storage location. These stor- age locations represent a value or a single character of data, such as an ASCII code. The total number of combinations of the eight switches being turned on and off is 256 (or 2 8 ). The value range of a byte is from 0 to 255. So, a byte is an important concept to understand when working with computers and networks. Most computer coding schemes use 8 bits to represent each number, letter, or symbol. A series of 8 bits is called a byte; 1 byte represents a single addressable storage location (see Table 1-2). 1102.book Page 19 Tuesday, May 20, 2003 2:53 PM 20 Chapter 1: Introduction to Networking The following are commonly used computer measurement terms: ■ Bit—The smallest unit of data in a computer. A bit equals 1 or 0, and it is the binary format in which data is processed, stored, and transmitted by computers. ■ Byte—A unit of measure used to describe the size of a data file, the amount of space on a disk or another storage medium, or the amount of data being sent over a network. 1 byte equals 8 bits of data. ■ Kb (kilobit)—Approximately 1000 bits. ■ KB (kilobyte)—Approximately 1000 bytes (1024 bytes exactly). ■ Mb (megabit)—Approximately 1 million bits. ■ MB (megabyte)—Approximately 1 million bytes (1,048,576 bytes exactly). A megabyte is sometimes called a “meg.” The amount of RAM in most PCs is typically measured in MB. Large files are often some number of MB in size. ■ GB (gigabyte)—Approximately 1 billion bytes. A gigabyte is sometimes called a “gig.” Hard drive capacity on most PCs is typically measured in GB. ■ TB (terabyte)—Approximately 1 trillion bytes. Hard drive capacity on some high-end computers is measured in TB. ■ kbps (kilobits per second)—One thousand bits per second. This is a standard measurement of the amount of data transferred over a network connection. ■ kBps (kilobytes per second)—One thousand bytes per second. This is a standard measurement of the amount of data transferred over a network connection. Table 1-2 Units of Information Unit Bytes * Bits * Bit (b) 1/8 byte 1 bit Byte (B) 1 byte 8 bits Kilobyte (KB) 1000 bytes 8000 bits Megabyte (MB) 1 million bytes 8 million bits Gigabyte (GB) 1 billion bytes 8 billion bits Terabyte (TB) 1 trillion bytes 8 trillion bits * Common or approximate bytes or bits N O TE It is common to con- fuse KB with Kb and MB with Mb. Remem- ber to do the proper calculations when comparing transmis- sion speeds that are measured in KB with those measured in Kb. For example, modem software usually shows the connection speed in kilobits per second (for example, 45 kbps). However, popular browsers display file- download speeds in kilobytes per second. This means that with a 45-kbps connec- tion, the download speed would be a maximum of 5.76 kBps. In practice, this download speed cannot be reached because of other fac- tors that consume bandwidth at the same time. Also, file sizes are typically expressed in bytes, whereas LAN band- width and WAN links are typically expressed in kilobits per second (kbps) or Megabits per second (Mbps). You must multiply the number of bytes in the file by 8 to determine the amount of bandwidth consumed in bps. 1102.book Page 20 Tuesday, May 20, 2003 2:53 PM Bits, Bytes, and Measurement Terms 21 ■ Mbps (megabits per second)—One million bits per second. This is a standard measurement of the amount of data transferred over a network connection. Basic Ethernet operates at 10 Mbps. ■ MBps (megabytes per second)—One million bytes per second. This is a standard measurement of the amount of data transferred over a network connection. ■ Gbps (gigabits per second)—One billion bits per second. This is a standard mea- surement of the amount of data transferred over a network connection. 10G or 10 Gigabit Ethernet operates at 10 Gbps. ■ Tbps (terabits per second)—One trillion bits per second. This is a standard mea- surement of the amount of data transferred over a network connection. Some high-speed core Internet routers and switches operate at more than Tbps. ■ Hz (hertz)—A unit of frequency. It is the rate of change in the state or cycle in a sound wave, alternating current, or other cyclical waveform. It represents one cycle per second. ■ MHz (megahertz)—One million cycles per second. This is a common measure- ment of the speed of a processing chip, such as a computer microprocessor. Some cordless phones operate in this range (for example, 900 MHz). ■ GHz (gigahertz)—One thousand million, or 1 billion (1,000,000,000), cycles per second. This is a common measurement of the speed of a processing chip, such as a computer microprocessor. Some cordless phones and wireless LANs operate in this range (for example, 802.11b at 2.4 GHz). Because computers are designed to work with on/off switches, binary digits and binary numbers are natural to them. However, humans use the decimal number system in their daily lives. It is hard to remember the long series of 1s and 0s that computers use. Therefore, the computer’s binary numbers need to be converted to decimal numbers. Sometimes, binary numbers need to be converted to hexadecimal (hex) numbers. This is done because hex numbers can represent a long string of binary digits with just a few hexadecimal digits. This makes it easier to remember and work with the numbers. Base 10 Number System A number system consists of symbols and rules for using those symbols. Many number systems exist. The number system used most frequently is the decimal, or Base10, number system. It is called Base10 because it uses ten symbols. These ten symbols are the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Combinations of these digits can represent all possible numeric values, as documented in Table 1-3. NOTE PC processors are get- ting faster all the time. The microprocessors used in PCs in the 1980s typically ran at less than 10 MHz (the original IBM PC was 4.77 MHz). Currently, PC processors are pushing speeds up to 3 GHz, with faster processors being devel- oped for the future. 1102.book Page 21 Tuesday, May 20, 2003 2:53 PM 22 Chapter 1: Introduction to Networking The decimal number system is based on powers of 10. The value of each column posi- tion from right to left is multiplied by the number 10 (the base number) raised to a power (exponent). The power that 10 is raised to depends on its position to the left of the decimal point. When a decimal number is read from right to left, the first (right- most) position represents 10 0 (1), and the second position represents 10 1 (10 ∗ 1 = 10). The third position represents 10 2 (10 ∗ 10 = 100). The seventh position to the left rep- resents 10 6 (10 × 10 ∗ 10 ∗ 10 ∗ 10 ∗ 10 = 1,000,000). This is true no matter how many columns the number has. For example: 2134 = (2 ∗ 10 3 ) + (1 ∗ 10 2 ) + (3 ∗ 10 1 ) + (4 ∗ 10 0 ) There is a 4 in the ones position, a 3 in the tens position, a 1 in the hundreds position, and a 2 in the thousands position. This example seems obvious when the decimal num- ber system is used. Seeing exactly how the decimal system works is important, because it is needed for you to understand two other number systems, binary (Base2) and hexa- decimal (Base16). These systems use the same methods as the decimal system. Human- readable IP addresses are expressed in Base10 (decimal). The IP address 172.16.14.188 is made up of four decimal numbers separated by dots or periods. Base 2 Number System Computers recognize and process data using the binary, or Base2, number system. The binary number system uses only two symbols (0 and 1) instead of the ten symbols used in the decimal, or Base10, number system. The position, or place, of each digit repre- sents the number 2 (the base number) raised to a power (exponent) based on its posi- tion (2 0 , 2 1 , 2 2 , 2 3 , 2 4 , and so on), as documented in Table 1-4. Table 1-3 Base 10 Number System Number of Symbols Ten Symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Base Exponent 10 3 10 2 10 1 10 0 Place Value 1000 100 10 1 Example: 2,134 2 ∗10 3 1 ∗10 2 3 ∗10 1 4 ∗10 0 1102.book Page 22 Tuesday, May 20, 2003 2:53 PM Bits, Bytes, and Measurement Terms 23 Example: 10110 = (1 ∗ 2 4 = 16) + (0 ∗ 2 3 = 0) + (1 ∗ 2 2 = 4) + (1 ∗ 2 1 = 2) + (0 ∗ 2 0 = 0) = (16 + 0 + 4 + 2 + 0) = 22 If the binary number (10110) is read from left to right, there is a 1 in the 16s position, a 0 in the 8s position, a 1 in the 4s position, a 1 in the 2s position, and a 0 in the 1s position, which adds up to decimal number 22. Machine-readable IP addresses are expressed as a string of 32 bits (binary). Base 16 Number System The Base16, or hexadecimal (hex), number system is used frequently when working with computers because it can represent binary numbers in a more readable form. The computer performs computations in binary, but there are several instances in which a computer’s binary output is expressed in hexadecimal form to make it easier to read. The hexadecimal number system uses 16 symbols. Combinations of these symbols can represent all possible numbers. Because only ten symbols represent digits (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9) and because Base16 requires six more symbols, the extra symbols are the letters A, B, C, D, E, and F. The A represents the decimal number 10, B represents 11, C represents 12, D represents 13, E represents 14, and F represents 15, as shown in Table 1-5. The position of each symbol (digit) in a hex number represents the base number 16 raised to a power (exponent) based on its position. Moving from right to left, the first position represents 16 0 (or 1), the second position represents 16 1 (or 16), the third position represents 16 2 (or 256), and so on. Network adapter or NIC addresses are expressed as a string of 12 hexadecimal characters. Table 1-4 Base 2 Number System Number of Symbols Two Symbols 0, 1 Base Exponent 2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 Place Value 1286432168421 Example: 10110 00010110 1102.book Page 23 Tuesday, May 20, 2003 2:53 PM 24 Chapter 1: Introduction to Networking Example: 1A2C = (1 ∗ 16 3 = 65536) + (10(A) ∗ 16 2 = 2560) + (2 ∗ 16 1 = 32) + (12(C) ∗ 16 0 = 12) = (65536 + 2560 + 32 + 12) = 68144 Decimal-to-Binary Conversion You can convert decimal numbers to binary numbers in many different ways. The flowchart shown in Figure 1-10 describes one method. This process involves trying to figure out which values of the power of 2 are added together to get the decimal num- ber being converted. This method is one of several that can be used. It is best to select one method and practice with it until it always produces the correct answer. Here’s an example: These steps convert the decimal number 168 to binary: Step 1 128 fits into 168, so the leftmost bit in the binary number is a 1. 168 – 128 = 40 Step 2 64 does not fit into 40, so the second bit from the left is a 0. Step 3 32 fits into 40, so the third bit from the left is a 1. 40 – 32 = 8 Step 4 16 does not fit into 8, so the fourth bit from the left is a 0. Step 5 8 fits into 8, so the fifth bit from the left is a 1. 8 – 8 = 0, so the remaining bits to the right are all 0s. Step 6 As a result, the binary equivalent of the decimal value 168 is 10101000. For more practice, try converting decimal 255 to binary. The answer should be 11111111. Table 1-5 Base 16 Number System Number of Symbols 16 Symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Base Exponent 16 3 16 2 16 1 16 0 Place Value 65536 256 16 1 Example: 1A2C 1A2C 1102.book Page 24 Tuesday, May 20, 2003 2:53 PM Bits, Bytes, and Measurement Terms 25 Figure 1-10 Decimal-to-Binary Conversion Process 1102.book Page 25 Tuesday, May 20, 2003 2:53 PM 26 Chapter 1: Introduction to Networking This flowchart works for decimal numbers of 255 or less. It yields an eight-digit binary number. This is appropriate for translating decimal IP addresses. Larger numbers can be converted by starting with the highest power of 2 that fits. For example, the number 650 can be converted by first subtracting 512. This yields a ten-digit binary number. Binary-to-Decimal Conversion As with decimal-to-binary conversion, there is usually more than one way to solve the conversion. The flowchart in Figure 1-11 shows one example. Binary numbers can also be converted to decimal numbers by multiplying the binary digits by the base number of the system (Base2) raised to the exponent of its position. Here’s an example: Convert the binary number 01110000 to a decimal number. 0 ∗ 2 0 = 0 + 0 ∗ 2 1 = 0 + 0 ∗ 2 2 = 0 + 0 ∗ 2 3 = 0 + 1 ∗ 2 4 = 16 + 1 ∗ 2 5 = 32 + 1 ∗ 2 6 = 64 + 0 ∗ 2 7 = 0 112 (The sum of the powers of 2 that have a 1 in their position) Decimal-to-Binary Conversion In this exercise, you practice converting decimal values to binary values. N O TE Work from right to left. Remember that anything raised to the 0 power is 1; there- fore, 2 0 = 1. 1102.book Page 26 Tuesday, May 20, 2003 2:53 PM Bits, Bytes, and Measurement Terms 27 Figure 1-11 Binary-to-Decimal Conversion Process Start with Binary Number. Decimal Total = 0 Total Now = Decimal Stop 128 Bit = 1? No Yes Total = Total + 0 Total = Total + 128 64 Bit = 1? No Yes Total = Total + 0 Total = Total + 64 32 Bit = 1? No Yes Total = Total + 0 Total = Total + 32 16 Bit = 1? No Yes Total = Total + 0 Total = Total + 16 8 Bit = 1? No Yes Total = Total + 0 Total = Total + 8 4 Bit = 1? No Yes Total = Total + 0 Total = Total + 4 2 Bit = 1? No Yes Total = Total + 0 Total = Total + 2 1 Bit = 1? No Yes Total = Total + 0 Total = Total + 1 128 64 32 16 8 4 2 1 1102.book Page 27 Tuesday, May 20, 2003 2:53 PM 28 Chapter 1: Introduction to Networking As with the flowchart shown in Figure 1-10, the flowchart shown in Figure 1-11 also works for decimal numbers of 255 or less that start with an eight-digit binary number. Larger binary numbers can be converted by increasing the power of 2 for each bit on the right. For example, if you have a ten-digit binary number, the tenth digit is worth 512, and the ninth is worth 256 if they are turned on (have a value of 1). Hexadecimal and Binary Conversion Converting a hexadecimal number to binary form and vice versa is a common task when dealing with the configuration register in Cisco routers. Cisco routers have a configuration register that is 16 bits long. That 16-bit binary number can be repre- sented as a four-digit hexadecimal number. For example, 0010000100000010 in binary equals 2102 in hex. Layer 2 Media Access Control (MAC) addresses are typically written in hex. For Ethernet and Token Ring, these addresses are 48 bits, or six octets (one octet is 1 byte). (“Oct” comes from the Greek word for eight.) Because these addresses consist of six distinct octets, they can be expressed as 12 hex numbers instead. Every 4 bits is a hex digit (2 4 = 16), as you will see in Table 1-6 in a moment. Instead of writing 10101010.11110000.11000001.11100010.01110111.01010001 you can write the much-shorter hex equivalent: AA.F0.C1.E2.77.51. To make handling hex versions of MAC addresses even easier, the dots are placed only after every four hex digits, as in AAF0.C1E2.7751. The most common way for computers and software to express hexadecimal output is by using 0x in front of the hexadecimal number. Thus, whenever you see 0x, you know that the number that follows is a hexadecimal number. For example, 0x1234 means 1234 in base 16. Like the binary and decimal number systems, the hexadecimal system is based on the use of symbols, powers, and positions. The symbols that hex uses are 0 through 9 and A through F. Table 1-6 shows the binary and decimal equivalents of hex digits. Binary-to-Decimal Conversion In this exercise, you practice converting binary values to decimal values. 1102.book Page 28 Tuesday, May 20, 2003 2:53 PM . Exponent 2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 Place Value 12 864 3 21 6 84 21 Example: 10 110 00 010 110 11 02. book Page 23 Tuesday, May 20 , 20 03 2: 53 PM 24 Chapter 1: Introduction to Networking Example: 1A2C = (1. 11 111 111 . Table 1- 5 Base 16 Number System Number of Symbols 16 Symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Base Exponent 16 3 16 2 16 1 16 0 Place Value 65 5 36 25 6 16 1 Example: 1A2C 1A2C 11 02. book. Value 10 00 10 0 10 1 Example: 2 ,13 4 2 10 3 1 10 2 3 10 1 4 10 0 11 02. book Page 22 Tuesday, May 20 , 20 03 2: 53 PM Bits, Bytes, and Measurement Terms 23 Example: 10 110 = (1 ∗ 2 4 = 16 ) + (0 ∗ 2 3