Chapter 3.

How Computers Measure and Transfer Data
In this chapter •Measurement: Bits, Bytes, and Beyond •Numbering Systems Used in Computers •Serial Versus Parallel Information Transfer How do computers measure information? By the byte. It's the basic unit of measurement for all parts of the computer that involve the storage or management of information (RAM, storage, ROM). Here are a few examples: •Software stored on a floppy or hard disk occupies a finite number of bytes. •RAM is measured in megabytes (1MB = 1,000,000 bytes). •Drive capacity is measured in gigabytes (1GB = 1,000,000,000 bytes). Understanding bytes and the other measurements derived from bytes is essential to choosing the correct sizes for RAM configurations, storage media, and much more. Some of the A+ Certification test questions typically deal with RAM and hard disk size measurements, as will your day-to-day work. The CD included with this book contains important Study Lab material for this chapter, as well as Chapters 2 –22 in this book. The Study Lab for each chapter contains terms to study, exercises, and practice tests—all in printable PDF format (Adobe Acrobat Reader is included on the CD, too). These Study Lab materials will help you gear up for the A+ Exam. Also, the CD includes an industry-leading test engine from PrepLogic, which simulates the actual A+ test so that you can be sure that you're ready when test day arrives. Don't let the A+ test intimidate you. If you've read the chapters, worked through the Study Lab, and passed the practice tests from PrepLogic, you should be well prepared to ace the test! Also, you'll notice that some words throughout each chapter are in bold format. These are study terms that are defined in the Study Lab. Be sure to consult the Study Lab when you are finished with this chapter to test what you've learned. So, what's a byte? If you are storing text-only information in the computer, each character of that text (including spaces and punctuation marks) equals a byte. Thus, to calculate the number of bytes in the following sentence, count the letters, numbers, spaces, and punctuation marks:
"This book is written by Mark Edward Soper." 12345678901234567890123456789012345678901234 | | | |

10

20

30

40

From this scale, you can see that the sentence uses 44 bytes. You can prove this to yourself by starting up Windows Notepad (or using MS-DOS's EDIT) and entering the text just as you see it printed here. Save the text as EXAMPLE.TXT and view the directory information (MS-DOS) or the File properties. You'll see that the text is exactly 44 bytes. Do most computer programs store just the text when you write something? To find out, start up a word-processing program, such as Windows WordPad or Microsoft Word. Enter the same sentence again, and save it as EXAMPLE.If you use WordPad, save the file as a Rich Text Format (.RTF) file and as a Microsoft Word (.DOC) file. Depending upon the exact version of WordPad or Microsoft Word you use, the file takes up much more space. For example, WordPad for Windows XP saves text as an RTF file, using 243 bytes to store the file. The same sentence takes 19,968 bytes when saved as a .DOC file by Microsoft Word XP! What happened? The next section explains this apparent oddity.

File Overhead and Other Features
When data you create is stored in a computer, it must be stored in a particular arrangement suitable for the program that created the information. This arrangement of information is called the file format A few programs, such as MS-DOS Edit and Windows Notepad, store only the text you create. What if you want to boldface a certain word in the text? A text-only editor can't do it. All that Edit and Notepad can store is text. As you have seen, in text-only storage, a character equals a byte. In computer storage, however, pure text is seldom stored alone. WordPad and other wordprocessing programs such as Microsoft Word and Corel WordPerfect enable you to boldface, underline, italicize, and make text larger or smaller. You can also use different fonts in the same document (see Chapter 10, "Printers," for more about that). Most modern programs also enable you to insert tables, create columns of text, and insert pictures into the text. Some, such as Microsoft Word, have provisions for tracking changes made by different users. In other words, there's a whole lot more than text in a document. To keep all this non-text information arranged correctly with the text, WordPad and other programs must store references to these additional features along with the text, making even a sentence or two into a relatively large file, even if none of the extra features is actually used in that particular file. Thus, for most programs, the bytes used by the data they create is the total of the bytes used by the text or other information created by the program and the additional bytes needed to store the file in a particular file format. Because different programs store data in different ways, it's possible to have an apparent

software failure take place because a user tries to open a file made with program A with program B. Unless program B contains a converter that can understand and translate how program A stores data, program B can't read the file, and might even crash. To help avoid problems, Windows associates particular types of data files with matching programs, enabling you to open the file with the correct program by double-clicking the file in Explorer or File Manager. You'll learn more about file associations in Chapter 18, "Using and Optimizing Windows."

Numbering Systems Used in Computers
Three numbering systems are used in computers: decimal, binary, and hexadecimal. Decimal is also known as base 10. Binary is also known as base 2, and hexadecimal is also known as base 16. Here's an illustration to help you remember the basic differences between them. You already are familiar with the decimal system: Look at your hands. Now, imagine your fingers are numbered from 0–9, for a total of 10 places. Decimal numbering is sometimes referred to as base 10. The binary system doesn't use your fingers; instead, you count your hands: One hand represents 0, and the other 1, for a total of two places. Thus, binary numbering is sometimes referred to as base 2. The hexadecimal system could be used by a pair of spiders who want to count: One spider's legs would be numbered 0–7, and the other spider's legs would be labeled 8, 9, A–F to reach a total of 16 places. Hexadecimal numbering is sometimes referred to as base 16.

Decimal Numbering System We use the decimal or base 10 system for everyday math. A variation on straight decimal numbering is to use "powers of 2" as a shortcut for large values. For example, drive storage sizes often are defined in terms of decimal bytes, but the number of colors that a video card can display can be referred to as "24-bit" (or 224), which is the same as 16,777,216 colors.

tip

Although all data in the computer is stored as a stream of binary values (0s and 1s), most of the time you will use decimal ("512MB of RAM") or hexadecimal ("memory conflict at C800 in upper memory") measurements. The typical rule of thumb is to use the system that produces the smallest meaningful number. If you need to convert between these systems, you can use any scientific calculator, including the Windows Calculator program (select View, Scientific from the menu).

Binary Numbering System All data is stored in computers in a stream of 1s (on) and 0s (off). Because only two characters (0 and 1) are used to represent data, this is called a "binary" numbering system. Text is converted into its numerical equivalents before it is stored, so binary coding can be used to store all computer data and programs. Table 3.1 shows how you would count from 1 to 10 (decimal) in binary.

Table 3.1. Decimal Numbers 1–10 and Binary Equivalents

Decimal Binary

1 1

2 10

3 11

4 100

5 101

6 110

7 111

8 1000

9 1001

10 1010

Because even a small decimal number occupies many places if expressed in binary, binary numbers are usually converted into hexadecimal or decimal numbers for calculations or measurements.

tip

Table 3.2 provides a listing of powers of 2, but you can use the Windows Calculator in scientific view mode to calculate any power of two you want. Just enter 2, click the x^y button, and enter the value for the power of 2 you want to calculate (such as 24). The results are displayed instantly (you add the commas). Use the Edit menu to copy the answer to the Windows Clipboard, and use your program's Paste command to bring it into your document. Sure beats counting on your fingers!

There are several ways to convert a decimal number into binary: •Use a scientific calculator with conversion. •Use the division method. •Use the subtraction method. To use the division method

Divide the number you want to convert by 2. Record the remainder: If there's no remainder, enter 0. If there's any remainder, enter 1. Divide the resulting answer by 2 again. Repeat the process, recording the remainder each time. Repeat the process until you divide 0 by 2. This is the last answer. When the last answer is divided, the binary is recorded from Least Significant Bit (LSB) to Most Significant Bit (MSB). Reverse the order of bit numbers so that MSB is recorded first and the conversion is complete. For example, to convert the decimal number 115 to binary using the division method, follow the procedure listed in Figure 3.1.

Figure 3.1. Converting decimal 115 to binary with the division method.

If you use a scientific calculator (such as the scientific mode of the Windows Calculator) to perform the conversion, keep in mind that any leading zeros will be suppressed. For example, the calculation in Figure 3.1 indicates the binary equivalent of 115 decimal is 01110011. However, a scientific calculator will drop the leading zero and display the value as 1110011. Once you understand how binary numbering works, you can appreciate a joke going the rounds on the Internet and showing up on T-shirts near you: "There are 10 kinds of people in the world—those who understand binary and those who don't." T-shirts are available from Think Geek (www.thinkgeek.com).

To use the subtraction method

Look at the number you want to convert and determine the smallest power of 2 that is greater than or equal to the number you want to subtract. Table 3.2 lists powers of 2 from 20 through 217. For example, 115 decimal is less than 27 (128) but greater than 26 (64).

Subtract the highest power of 2 from the value you want to convert. Record the value and write down binary 1. Move to the next lower power of 2. If you can subtract it, record the result and also write down binary 1. If you cannot subtract it, write down binary 0. Repeat step 3 until you attempt to subtract 20 (1). Again, write down binary 1 if you can subtract it, or binary 0 if you cannot. The binary values (0 and 1) you have recorded are the binary conversion for the decimal number. Unlike the division method, this method puts them in the correct order; there's no need to write them down in reverse order. For example, to convert 115 decimal to binary using the subtraction method, see Figure 3.2.
Figure 3.2. Converting 115 decimal to binary with the subtraction method.

Table 3.2. Powers of 2

Power of 2 20 21 22 23 24 25 26 27 28

Decimal Value 1 2 4 8 16 32 64 128 256

Power of 2 29 210 211 212 213 214 215 216 217

Decimal Value 512 1024 2048 4096 8192 16384 32768 65536 131072

Hexadecimal Numbering System A third numbering system used in computers is hexadecimal. Hexadecimal numbering is also referred to as base 16, a convenient way to work with data because 16 is also the number of bits in 2 bytes or 4 nibbles. Hexadecimal numbers use the digits 0–9 and letters A–F to represent the 16 places (0–15 decimal). Hexadecimal numbers are used to represent locations in data storage, data access, and RAM. Table 3.3 shows how decimal numbers are represented in hex.

caution You might need to convert decimal to binary numbers for the A+ Certification exam, so try both pencil and paper methods (division and subtraction) and get comfortable with one of them.

Table 3.3. Decimal and Hexadecimal Equivalents

Decimal Hexadecimal

0 0

1 1

2 2

3 3

4 4

5 5

6 6

7 7

8 8

9 9

10 A

11 B

12 C

13 D

14 E

15 F

To convert decimal to hexadecimal, use the same division method listed previously, but use 16 rather than 2 as the divisor. Figure 3.3 demonstrates how to use this conversion process to convert the decimal number of 65,536 (the start of upper memory) to its hexadecimal equivalent (A0000).
Figure 3.3. Converting 65,536 decimal to hexadecimal.

Note that if you use the Windows Calculator in scientific mode to perform this conversion that you will get an answer of 100000. The initial value 10 is the numeric equivalent of hex A (refer to Table 3.3). The most typical uses for hexadecimal numbering are •Upper memory addresses for add-on cards and for memory-management use •I/O port addresses for use with an add-on card

Binary Versus Decimal MB/GB Although a byte represents the basic "building block" of storage and RAM calculation,

most measurements are better performed with multiples of a byte. All calculations of the capacity of RAM and storage are done in bits and bytes. Eight bits is equal to one byte. Table 3.4 provides the most typical values and their relationship to the byte.

Table 3.4. Decimal and Binary Measurements

Measurement Bit Nibble Byte Kilobit (Kb) Kibibit (Kib) Kilobyte (KB) Kibibyte (KiB) Megabit (Mb) Mebibit (Mib) Megabyte (MB) Mebibyte (MiB) Gigabit (Gb) Gibibit (Gib) Gigabyte (GB) Gibibyte (GiB)
[*] [1] [2] [3] [4] [5] [6]

Type[*] Number of Bytes/Bits 1/8 of a byte 1/2 of a byte 8 bits 1,000 bits 1,024 bits (128 bytes) 1,000 bytes 1,024 bytes 1,000,000 bits 1,048,576 bits (131,072 bytes) 1,000,000 bytes 1,048,576 bytes (1,024KiB) 1,000,000,000 bits 1,073,741,824 bits 1,000,000,000 bytes 1,073,741,824 bytes

Calculations Byte/8 Byte/4 (4 bits) bit*8

Note s

D B D B D B D B D B D B

[1] [2] 1 kilobit[2] 1 kibibit[2] 1,000KB 1 kilobyte[2] 1 kilobit[3] 1 kibibit[3] 1 kilobyte[3] 1 kibibyte[3] [3] [4] [5] [6]

D=Decimal B=Binary Also known as binary kilobit Also known as binary kilobyte Also known as binary megabit Also known as binary megabyte Also known as binary gigabit Also known as binary gigabyte

Until December 1998, the terms kilobit, kilobyte, megabit, megabyte, gigabit, and gigabyte were officially used to refer both to decimal and binary values. A great deal of confusion in the industry has been caused by the indiscriminate use of both types of measurements for hard disk storage. Although the binary multiples shown in Table 3.4 are an IEC standard, many vendors in the computer business don't yet use the term kibibits or other binary multiples yet. Floppy and hard disk manufacturers almost always rate their drives in decimal megabytes

(multiples of 1 million bytes) or decimal gigabytes (multiples of 1 billion bytes), which is also the standard used by disk utilities, such as CHKDSK, ScanDisk, and FORMAT. However, most BIOSs and the MS-DOS/Windows FDISK and Windows NT/2000/XP Disk Management utilities list drive sizes in mebibytes (binary megabytes) or gibibytes (binary gigabytes). Mebibytes are also used to specify the size of rewritable and recordable CD and DVD media. Although the actual number of bytes is identical, the differences in numbering are confusing.

tip Because the industry has not yet widely adopted the terms kibi, mebi, and gibi, the A+ Certification Exam might use KB, MB, and GB to refer to either type of numbering system.

Take a hard disk rated by its maker as 8.4GB. This is 8,400,000,000 bytes (decimal). However, when the drive is detected and configured by the BIOS and partitioned with FDISK, its size is listed as only 7.82GB (binary GB—more accurately referred to as GiB). At first glance, you might believe you've lost some capacity (see Figure 3.4).

Figure 3.4. The capacity of an 8.4GB hard disk size is 8.4 billion bytes (top bar), but most BIOSs and Windows FDISK/Disk Management measure drives in binary gigabytes (bottom bar).

However, as you've already seen, there is a substantial difference between the number of bytes in a binary gigabyte and one billion bytes. This different numbering system, not any loss of bytes, accounts for the seeming discrepancy. Use this information to help explain to a customer that the "missing" capacity of the hard disk isn't really missing (see Figure 3.5).

Figure 3.5. A gibibyte (or binary gigabyte) has over 73 million more bytes than a decimal gigabyte (1 billion bytes).

Use the values in Table 3.4 to convert between decimal and binary values for drive sizes or other measurements. For the exam, keep in mind that values that can be divided by 1,000 are decimal, while values that can be divided by 1,024 are binary.

Serial Versus Parallel Information Transfer
Information flows through the computer in many ways. The CPU is the central point for most information. When you start a program, the CPU instructs the storage device to load the program into RAM. When you create data and print it, the CPU instructs the printer to output the data. Because of the different types of devices that send and receive information, two major types of data transfers take place within a computer: parallel and serial. These terms are used frequently, but if you're not familiar with the differences between them, check out Figure 3.6.

Figure 3.6. Parallel data transfers move data 8 bits at a time, whereas serial data transfers move 1 bit at a time.

Parallel Information Transfers Parallel transfers use multiple "lanes" for data and programs, and in keeping with the 8 bits = 1 byte nature of computer information, most parallel transfers use multiples of 8. Parallel transfers take place between the following devices: •CPU and RAM •CPU and interface cards (see Chapter 8) •LPT (printer) port and parallel printer •SCSI port and SCSI devices •ATA/IDE host adapter and ATA/IDE drives •RAM and interface cards (either via the CPU or directly with DMA) Why are parallel transfers so popular? •Multiple bits of information are sent at the same time. •At identical clock speeds, parallel transfers are faster than serial transfers because more data is being transferred. However, parallel transfers also have problems: •Many wires or traces (wire-like connections on the motherboard or expansion cards) are needed, leading to interference concerns and thick, expensive cables. •Excessively long parallel cables or traces can cause data to arrive at different times.

This is referred to as signal skew (see Figure 3.7).
Figure 3.7. Parallel cables that are too long can cause signal skew, allowing the parallel signals to become "out of step" with each other.

•Differences in voltage between wires or traces can cause jitter. As a result of these problems some compromises have had to be included in computer and system design: •Short maximum lengths for parallel, ATA/IDE, and SCSI cables •Dual-speed motherboards (running the CPU internally at much faster speeds than the motherboard or memory) Fortunately, there is a second way to transmit information: serial transfers.

Serial Transfers A serial transfer uses a single "lane" in the computer for information transfers. This sounds like a recipe for slowdowns, but it all depends on how fast the speed limit is on the "data highway." The following ports and devices in the computer use serial transfers: •Serial (also called RS-232 or COM) ports and devices •USB (Universal Serial Bus) 1.1 and 2.0 ports and devices •Modems (which can be internal devices or can connect to serial or USB ports) •IEEE-1394 (FireWire, i.Link) ports and devices •Serial ATA (SATA) host adapters and drives Serial transfers have the following characteristics: •One bit at a time is transferred to the device.

•Transmission speeds can vary greatly, depending on the sender and receiver. •Very few connections are needed in the cable and ports (one transmit, one receive, and a few control and ground wires). •Cable lengths can be longer with serial devices. For example, an UltraDMA/66 ATA/IDE cable can be only 18 inches long for reliable data transmission, whereas a Serial ATA cable can be almost twice as long. Although RS-232 serial ports are slow, newer types of serial devices are as fast or faster than parallel devices. The extra speed is possible because serial transfers don't have to worry about interference or other problems caused by running so many data lines together. For more information about serial, parallel, USB, and IEEE-1394 ports, see Chapter 8, "Input/Output Devices and Cables." For more information about RAM, see Chapter 7, "RAM." For more information about ATA/IDE, Serial ATA, and SCSI, see Chapter 14, "Storage."

Study Lab
Don't miss the Study Lab materials found on the CD accompanying this book. Each Study Lab is tailored to the individual chapters in this book, meaning that you'll quickly be able to determine which topics you understand well enough to pass the exam and which topics need more study. The Study Labs are presented in printable PDF format so that you can take them with you to study at work, on the road, or even in your car just before test time!

The Absolute Minimum Here are the high points of this
chapter. Review these just before you take the exam to brush up on the major topics and help you identify what you need to review. The basic unit of measurement for storage or information management is the byte. When stored as plain text, one character uses one byte of disk space. Other file formats require more space than .TXT (plain text) files because they reserve space for formatting and document management information stored as part of the file. Binary numbering uses two digits, 0 and 1. Binary is also called base 2. Decimal (base 10) uses digits 0–9. Binary (base 2) uses digits 0–1. Hexadecimal (base 16) uses digits 0–9 and A–F. Decimal numbers can be converted to binary or hexadecimal numbers through a process of division. Decimal values such as kilo, mega, and giga are based on multiples of 1,000. Binary values such as kibi, mebi, and gibi are based on multiples of 1,024. Parallel transfers use eight wires or multiples of eight wires for data. Serial transfers use a single wire (or pair or wires) for data. Parallel transfers are faster than serial transfers performed at the same speed. Fast serial interfaces such as USB, IEEE-1394, and Serial ATA are as fast or faster than parallel interfaces and will eventually replace most parallel-

based interfaces.