How Computers Work Tenth Edition: THIS BOOK was so much easier to write 20 years ago. Computers were relatively new, and they were all pretty much the same. There were just two vital contrasts—regardless of whether a PC was an Apple or a Wintel, that is, running Windows on an Intel processor. There were a few varieties in size, movability, and the customization aficionados could do by installing distinctive drives and development boards inside PCs.
Stuffing the newest-fangled components into my computer at PC Computing, the magazine where I worked, was a wonderful pastime and the source of many stories in the magazine. If I made a mistake and the computer groaned its last breath, that often made for an even better story.
How Computers Work, Interactive Web Version
The most amazing aspect of this whirlwind of technical progress is that it’s only taken 20 years to go from floppy to solid state, from displays that amounted to stick figures to animated graphics that are almost indistinguishable from film images. That cell phone in your pocket has more figuring power than those refrigerator-sized estimated centralized servers.
The wires that have been needed for communications for a century are likely to disappear completely in the next 10 years, along with the need for local data storage. It’s conceivable the mouse and keyboard will end up wiped out. In fact, much of the hardware we’re used to today, as it gets smaller and more efficient, may migrate from our desks and our pockets to become parts of our eyes, ears, and brain.
And that’s just in the next 20 years. Beyond that, we can’t imagine what will become of technology any more than one-celled organisms could have imaged a dinosaur. Let’s check back with each other after a couple of decades and then see what may be possible.
Ron White, San Antonio, TX
How Waves Take The Universe on a Joy Ride
WAVES DO FAR MORE than carrying surfers on a wet thrill ride. Waves are essential to the working of computers. They move data from one place to another and provide the beat that every PC component marches to. Without waves, we’d never be able to see the solutions, images, or words that result from the machine’s computations. Without waves, we’d be beached. Or we might not exist at all.
According to some theories of physics, waves are the ultimate stuff of the universe. Space, Earth, you, and I are no more than the interference patterns created by the crisscrossing of waves, which are created by tiny, tiny, tiny vibrating strings. Indeed, at times it seems as if the thing we think of as solid Earth is just an illusion. Under the right circumstances, waves pass through our buildings, rocks, water, other waves, and even our own bodies. It’s as if Earth itself is no more than a wad of soppy tissue. Here’s how this humming master of the universe reaches down to play its tunes on a computer.
1 If you’ve ever played with toys, you’re familiar with the two most common mechanical waves in the universe: transverse waves and longitudinal waves. When you and a friend move the ends of a jump rope up and down, the graceful humps traveling the rope are a transverse wave.
2 Examples of transverse waves include light, surface earthquake waves, surface water waves, magnetic waves, and the wave people in a football stadium create. Longitudinal waves are found in the depths of water and earth. A tsunami or earthquake moves tremendous energy through those media until they reach Earth’s surface or the shallows of the sea, where they convert to transverse waves. Freeway traffic jams, with their alternative congestion and fleeting moments of faster driving, are also longitudinal waves.
3 Both types of waves can carry energy, information, and destruction. They can be measures of time and distance. Both types are created when some force—vocal cords, a rock thrown in water, a meteor smashing into Earth—is exerted against their mediums. Transverse waves can travel through solids and liquids, but they do not travel through gases because air doesn’t have the elasticity needed to push the wave’s vibrating molecules back into place. Only longitudinal waves may use gases as a medium. Despite that difference, longitudinal waves can morph into transverse waves, and vice versa, when they confront a different kind of medium. Both waves have similar components. ‘
4 In both types of waves, two fundamental measurements are the wavelength and frequency. Wavelength is the distance between one crest, or compressed area, to the next. Frequency is the number of waves, measured by wavelength, that pass a stationary point in one second. The longer the wavelength is, the lower the frequency. Frequency is measured in hertz (Hz). Generally, the higher the hertz, the more energy a wave contains. In audio, higher hertz means higher pitched sound.
5 Transverse waves in the water and longitudinal sound waves in the air are both called mechanical because they depend on the mechanical mechanism of their media to propagate. That, however, is an illusion. The energy that goes into creating and maintaining waves is transferred by molecules knocking against each other, similar to how runners in a relay race hand off the baton. The next time you’re at a lake or beach, observe how a boat or bird floating on the surface of the water only bobs up and down in place when a wave passes under it. Its horizontal position doesn’t change.
6 Another type of wave, electromagnetic, is not mechanical. Electromagnetic waves encompass light, infrared light, radio, X-rays, gamma rays, and neutrinos. They are all part of the electromagnetic spectrum, in which waves range from a wavelength smaller than an atom to wavelengths bigger than the earth.
7 Electromagnetic waves do not require any type of media and are the only waves that can travel through the vacuum of space. Although not mechanical, electromagnetic waves are transverse— doubly transverse. They consist of electric and magnetic fields that, like other transverse waves, vibrate perpendicular to the direction in which the wave is moving. But the two fields vibrate at right angles to each other, and each expansion and collapse of a field creates an opposite field. The vibrations of electrical fields generate magnetic fields. Vibrations of magnetic fields generate electric fields. The result is a never-ending boot strap that pushes the wave forward at the speed of light.
How Information Rides the Waves
WHAT DO SURFING, LASERS, computer circuits, television, rock concerts, and the ever-popular death ray have in common? They all depend on waves. Without all the types of waves that surround us—and that penetrate us—at all times, and without the ability of waves to carry information nearly instantly to all parts of the globe, chances are civilization as we bask in it today would never have happened.
1 It takes no great technology to use waves to send information. You simply turn a wave on and off. It’s the basis for jungle drums, Morse code, and the earliest modems, and it’s called encoding. Regardless of the form of encoding, the sound or electrical waves are not changed. Information is encoded in how often a wave is created and how long the wave exists. Morse code and the first 300 baud modems use short and long pulses of electricity to create a simple binary code, a forerunner of how data is stored and transmitted in computers. The short dits and the long dash in different combinations represent letters of the alphabet. A total of nine pulses of electricity are enough code to represent three letters “S O S,” the Morse code distress cry. Note that the frequency and amplitude of the electrical signal do not change–only how long the same electromagnetic signal is broadcast.
2 Long and short drum beats are not possible with jungle drums. They depend on recognizable patterns in which the volume of individual beats and the length of silences between beats create a pattern that can convey information. Because we’re not fluent in jungle drums, here is a visualization of a 22-second drum solo by Gene Krupa from “Sing, Sing, Sing.” The breaks in the waveform depict bass drum beats. At the right end of the segment, you can see how intervals between each of the bass beats grow shorter, creating the type of pattern we could if we didn’t all have phones coming out our ears, use for communications.
3 Jungle drums and Morse code have obvious limitations. Both are slow and depend on a skilled person doing a hands-on job. What is needed are entirely different modulation methods. Three methods do the job: Frequency modulation (FM), amplitude modulation (AM), and pulse modulation.
4 Pulse modulation is the newest way to add information to waves—and get information out of them. It was developed because modems had reached a limit as to how quickly and accurately they could turn a signal on and off. The solution was to use different frequencies or amplitudes to stand for combinations of letters. This scheme is an enormous improvement over early modems, but it is limited to text and digital information. Transmitting analog signals without first converting them to digital signals requires AM or FM.
5 Either AM or FM can be used to convey information over radio waves or electrical circuits, using frequencies from 100,000Hz (radio) through microwave to 10,000 billion Hz (infrared). The higher the frequency, the smaller the wavelength. Radio waves are about as long as your average skyscraper is tall. Microwaves are the length of an adult person, and infrared waves are the size of a computer mouse. Various factors govern a wavelength usefulness for carrying data. Some radio waves penetrate brick and steel buildings. Others bounce off them. Generally, the higher the frequency, the more data it can carry, because the more often a wave moves between peaks and valleys, the more opportunities there are for modulating it to carry information.
6 To understand modulation, go to a pond or lake and throw rocks into the water. If you throw only a single rock, it creates waves that expand in concentric circles, smoothly and evenly from the point of impact. We’ll call this our carrier wave, and measure its wavelength, how quickly it expands, and how tall and deep are its crest and trough.
7 As the carrier wave spreads, toss a few pebbles across the width of the carrier. The pebbles make waves of their own. The pebbles’ waves change—as in modulate—the carrier wave wherever they meet. If we measured all the directions the combined waves moved, their speed, and where they eventually meet the shore, and then—using some sort of math I don’t even want to think about—we subtracted the influence of the carrier wave, we’d be left with the information we need to know: where each of the pebbles struck the water and the force behind each.
8 A radio carrier signal, like the watery carrier wave, is a simple, steady wave at a specific, known wavelength. We mix the carrier wave with a wave known as an input signal created by the sound—or sights—from another source. The two waves combine into a modulated signal that is then broadcast over airwaves or through wires. When a radio, TV, or other device receives the modulated signal, it removes the influence of the original carrier wave. What remains is a replica of the input signal that created the modulation.
How Electromagnetism Is the Ghost in the Machine
THIS BOOK BEGINS with a quote from Arthur C. Clarke: “Any sufficiently advanced technology is indistinguishable from magic.” Well, we’re still not past the first chapter and it’s already time to start the magic show. Like good magicians, electricity, and magnetism—the twin powers of electromagnetism—hide what they are doing. They mostly show the results—the rabbit coming out of the hat, not how it got into the hat.
We can see the effects of magnetism on iron filings, refrigerator doors, and the giant generators that supply much of our energy, but we cannot see magnetism itself. It’s the silent partner in the electromagnetic spectrum.
We can see electricity in the form of lightning and sparks from a shorting wall plug, and we can certainly feel electricity when static electricity (a build-up of surplus electrons) jumps from our fingers on a cold day.
Combined, magnetism, and electricity form the electromagnetic spectrum—the full frequency range of the mysterious waves that permeate the universe. This partnership continues into other areas, where these conjoined energy ghosts form the basis for most of the modern technology.
1 Electricity and magnetism cannot survive without each other. The previous illustration shows how magnetic and electric fields cooperate in a boot-strapping operation that allows electromagnetic waves, such as light, radio, and heat, to travel through a vacuum.
2 Let’s start with the electro half of electromagnetism. In some atoms, such as copper and silver, the attraction is weak between the atoms’ core—a nucleus made of positively charged protons— and the negatively charged electron clouds in the atom’s’ outer layers. In such conductive materials, it’s possible for electrons to jump freely from one atom to another. This movement of electrons, which occurs only under the right circumstances, is electricity, and it travels at the same speed as light (another form of electromagnetism)—186,000 miles each second.
3 We apply three measurements when working with electricity: voltage, amperage, and resistance. It’s convenient to think of voltage or charge, as being like water pressure—how much power is behind electricity. Amperage, or amps, is the measure of how much electricity is flowing through wires, similar to how we measure the gallons of water that pass through pipes. Resistance is how the material through which the electricity is flowing. In the examples here, higher water pressure overcomes a clogged pipe and doubling the voltage pushes through the same amount of current despite the addition of a resistor.
4 In some materials, such as rubber and glass, electrons are more closely bound to their nuclei and do not easily move from one atom to another. These nonconductive materials are insulators. Still, other materials, such as silicon, can act as either conductors or insulators under different conditions. These are semiconductors, an important component of microchips and transistors.
5 When electricity moves through a wire, it creates a magnetic field that surrounds the wire. The magnetic field in a straight piece of wire is too weak to pick up even the smallest iron filings.
6 Conversely, when a wire moves through a magnetic field, the interaction creates an electrical current in the wire. Note that in order for either of these phenomena to work, the wire must be moving through the magnetic field, or the magnetic field needs to be collapsing or expanding across the wire.
7 Both the magnetic fields caused by electricity moving through a wire and electricity created from magnetism can be made more powerful if the wires are wrapped around iron cores. Almost all the electricity we use comes from generators, in which massive magnets surround equally massive coils of wire. Water from a dam, or steam created by a nuclear plant or fuel-burning plant, spins the wire coil rapidly, creating a high-voltage alternating current that is transmitted via thick, low-resistance cables to electrical substations throughout urban areas.
How Computers Create Our World Using Numbers
WAVES, electromagnetic fields, particles, electrons, light waves, and quarks. These are the elements by which computers compute—measuring, comparing, adding, and subtracting. All that computing brilliance has to be communicated to us less-brilliant organic units in some way. Unfortunately, the native tongue of computers is numbers, which most of us stopped thinking about within days of completing Algebra II. Because we are not fluent enough in numbers to enter the world of computers, computers have devised ways of using numbers to recreate our world as we understand it. Their numerical constructs are so smooth we are rarely aware that they are made of only 0s and 1s.
1 There are two ways to take stock of the world around us: analog and digital. An analog instrument expresses measurements in a manner that is analogous to whatever it is measuring. An old-fashioned thermometer—an analog device—has a glass tube filled with red-dyed alcohol. As the thermometer gets warmer, the warmth causes the liquor to expand and rise within the tube. We can look at the markings along the tube and say that a person’s temperature is “about 99.5.” We say “about” because our reading of the temperature depends on the precision used in making the thermometer and the acuity of our vision.
2 A digital thermometer has an electrical component called a thermistor. Rising temperatures make the thermistor less resistant to electrical current, allowing an increased electrical flow to a mini-processor that converts the amount of electricity to numbers that represent the temperature. The numbers are displayed on a screen, but unlike the alcohol in the analog thermometer, the numbers don’t swell or shrink in proportion to temperature variations.
Most of today’s computers are digital because the transistors that jumble data are digital, either on or off and not some state in between. (Analog computers are used in situations involving constantly changing measurements, such as an automatic transmission or a bombardier’s sight.) Digital computers, however, often start out with analog measurements that must be converted to digital.
3 The computer-based digital camera replaces film with an image sensor, a microchip studded with photodiodes, transistors melded with substances that convert photo energy into electrical energy. Each of the photodiodes collects photons of light, building up electrical charges as long as the shutter is open. The brighter a part of a scene is, the more photons are focused on the pixels capturing that part of the scene. When the shutter closes, all the pixels have electrical charges that are proportional to the number of photons that hit each photodiode. If you picture photons piling up in mounds of glowing pebbles in buckets—some smaller, some larger—you’ve got the idea.
4 The camera’s circuitry moves the charges collected by the image sensor into a single row that passes through an amplifier. The amp converts what are little more than faint static charges into an electrical current with varying voltages in proportion to the parade of changing charges.
5 The current passes into an analog-to-digital converter (ADC). Every few milliseconds, the ADC measures the voltage of the current as it passes through. If the voltage is above a certain level, the ADC produces a 1 bit, which it adds to a stream of digital values that it passes on to other components. If the voltage is beneath that same level, the ADC adds a 0 bit.
6 Data that has only two values, 0 and 1, doesn’t have the versatility to represent in an analog format the real world of images and sounds that, ironically, have become the most popular use of computers. With only two values, such as black and white—no grays—an image looks like this two-bit Mona Lisa.
One can obtain more precise digital representations of analog signals through multi-bit sampling. The current being measured, whether generated by the energy of light, sound, or chemical reactions, passes through a series of resistors. Each resistor depletes some of the currents until it is no longer measurable. How many resistors it passes through determines a value, depending on the design, that is represented by 2, 4, or 8 bits—the bit rate. In Diagram A on the near right, with a bit rate of 4, there are four values the voltage could reach for each sample. Diagram B on the far right shows an ADC capable of registering eight values per reading.
7 Diagram B also demonstrates how the conversion’s resolution is made more accurate by increasing the sampling rate, the frequency at which samples of passing current are measured. In Diagram A, eight samples are taken for the period shown. Diagram B shows a sampling rate four times greater. If Diagram A were representing the digitizing of a music recording, it’s sampling, or frequency rate might be appropriate for a smooth slide on a trombone. Diagram B has the same general shape as the red line in A. But the higher sampling rate provides opportunities to capture variations in sound that the first example can’t handle, such as a rapid trill on a clarinet.
8 Having 16 bits for each sample might not sound particularly useful. But 16 bits in a binary number yields 256 different combinations. In creating video color, that means 16 bits can produce any of 256 shades of a color, as shown here with red. A bit value of 0000000000000000 binary or 0 in decimal is assigned to total black. All 1s—1111111111111111—binary or 256 decimal represents as pure and intense a red as a monitor can produce. Take any two adjacent red squares shown here and the difference between them is less than the human eye can distinguish. Combine 256 shades of red with 256 shades of each of the other two colors that go into a video image, green and blue, and the result is an amazing 16,777,216 possible colors.
9 An ADC has a functional mirror image in a DAC, or digital-to-analog converter. Some monitors and most sound speakers require analog currents. A DAC changes a string of digital values into rapidly changing voltages in an electrical current by routing a feeder current through a matrix of resistors that partially block the current. The resistors are weighted to represent different degrees of resistance. Sending current through resistors on different pathways turns out a final stream of current that corresponds to the digital data.