"The World is digital" reading notes the first part _ hardware

Source: Internet
Author: User

"The World is Digital" is a popular science books, from the hands of top computer scientist Brian W.kernighan, if you don't know who this person is, then you probably know the practice of programming (Chinese name Programming practice, K ( After mentioning that Brian W.kernighan is referred to as K:) and R.pick co-author), if you do not know the program design practice, then you must know the C programming Language (in the computer field is not known by the self wall to:-), Yes, this is the book of K&r, the father of Kernighan and C, who is known as the C-language Bible and affects generations of programmers.

As a non-expert computer enthusiasts, naturally can not miss the opportunity to listen to the master teachings, nonsense, or hurriedly follow the footsteps of the master to the computer world to a glimpse of it.

Any advanced technology is the same as Magic (C. Clark). The purpose of the K-book is to uncover the mysterious veil of magic, and to let readers know how the various systems that are closely related to computers work. how can Photos/music/Movies be spread around the world in a flash? How does the e-mail function? How private is your email? Why is spam easy to send but hard to clean? Does the phone really know where you are? What's the difference between Iphon and Android phones, and why are they fundamentally the same? following the footsteps of K, we will have a pretty good understanding of how computers and communication systems work, and how these technologies affect our lives.

What's in the computer?

The question can be seen in two ways: logically or functionally, the composition of what each part is, what to do, how to do it, how to connect it, and the physical structure of what each part looks like and how it is built.

    • Logical construction

The logical or functional architecture of a computer is composed of a processor (CPU), primary memory (memory), mass storage (hard disk), and a variety of other components, and a set of cables called a bus connects all of these and transmits information between the parts.

The basic components of a computer, including processors, storage of instructions and data, and input, which are often referred to as Von Nord Relievo architecture.

CPU: Processor, or Central processing Unit (abbreviated as CPU), is the brain of the computer. The processor operates, moves data back and forth, and controls everything else. The CPU has a single instruction table, which can perform a limited number of operations, but it performs very fast. Up to billions of times per second. Depending on the previous calculation structure, you can decide what instructions to execute next. When you buy a computer, you often see a description of the CPU and the like "Intel Duo Core 2.1GHz". This means that the CPU is made by Intel, which actually has two CPUs in a single package. The "nucleus" here is the meaning of the processor. The CPU uses an internal clock similar to the heartbeat or clock tick to control the tempo of the basic operation, and one of the metrics that measures the CPU is to see how many times the internal clock vibrates per second. A heartbeat or tick once per second is 1Hz. For a 2.1GHz processor, it beats 2.1 billion times per second. The human heartbeat is about 1Hz, which is about 100,000 hops a day, nearly 30 million times a year, so it takes 70 years for our heart to catch the number of times the CPU beats in a second.

main memory, which is random access memory (abbreviated RAM, memory), which holds the information that the processor and other parts of the computer are actively using The CPU can change the contents in memory. that the CPU needs to run to handle the data. This is the concept of a stored program so that the same computer can run a wide variety of programs as long as the appropriate instructions are placed in memory. Running programs, such as Word, QQ, or browser, whose instructions are placed in memory, such as the photos displayed on the screen, the document being edited, the music being played, etc., are also in memory, while Windows, Mac OS X, or other operating systems, That's why you can run multiple applications at the same time, and the instructions they run are still in memory. Memory is lost by power loss. So when working on a desktop, it's a good habit to be cautious, to keep the work you're doing, and accidentally kick off the power cord:-). The amount of memory on the computer is limited. The units representing the capacity are bytes, a byte-sized memory, which can be placed into a single character, can be placed into an integer such as 42, and can also be part of a large value. You can think of memory as a bunch of small boxes of exactly the same size, numbered from 1 to 1 billion or 2 billion, with a small piece of information in each box. In general, the larger the amount of memory available, the greater the amount of space (although all programs run at the same time, memory is not enough), which can often be said to calculate the faster. If you want your computer to run faster, buying more memory looks like the best strategy.

Disk and mass storage: memory capacity is large, but it is limited, and the content disappears after power-down. Large-capacity memory can still hold the information inside after power-down. Data, instructions, and information are stored on disk for a long time, and are temporarily read into memory only when needed. Disk space is 100 times times cheaper than memory, but it is much slower to access. The way the disk holds information is magnetized in different directions on the magnetic material on the surface of the rotating metal disc. When the computer is working, the hum and clicking sound is emitted when the disk moves the head to the correct position on the platter surface. The standard notebook platter is 2.5 inches (6.25 cm) in diameter. Some computers are equipped with solid-state drives (SSDs) that use flash memory instead of rotating mechanical parts. Flash memory is also non-volatile, the information is stored in the circuit of the charge, each circuit element of the charge does not need to power up to maintain its state. The stored charge can be tested to read the value, or it can be erased and overwritten with a new value. Flash memory is still more expensive than the same capacity of traditional hard drives, but fast, light, reliable and energy-saving, in mobile phones, cameras and other devices widely used in the future may replace the mechanical hard disk.

A variety of other devices also play a special role. Used to provide input to the user, such as a mouse, keyboard and touch screen, to provide users with output, such as monitors, printers, speakers; network components, such as Ethernet or wireless networks, are used to communicate with other computers. In architecture, these devices appear to be connected by a set of cables. Borrowed from the terminology of electrical engineering, this group of cables is called the bus. In fact, there are several sets of buses inside the computer, each with a feature that is appropriate for its function. For example, the bus between the CPU and memory, short lines, fast transmission, but the price is expensive, and the bus connected to the headphone jack, line long, slow transmission, but the price is cheap. Some buses also expose a part of the chassis, such as the ubiquitous universal serial bus, which is the USB bus used to plug the peripherals into the computer.

    • Physical Structure

One of the most important components of a computer electronic circuit is the logic gate circuit, which is used to calculate an output value based on one or two input values, that is, the input voltage or current signal to control the output voltage or current signal. As long as enough gate circuits are connected in the right way, any calculation can be performed. Charles Petzold's "coding and hiding in the computer hardware and software behind the language" is a good book to introduce this aspect (PS: He also wrote a book, called "Windows Programming", is also thunderclap piercing, the impact is very wide ah; In addition, I think the domestic books can be comparable to the Li Zhong of the "cross-computer fog ", are rare good books, worth flipping through). Gate Circuit gradually experienced the electron tube, transistor era, and now the logic gate circuit is created in the integrated circuit (integrated circuits, abbreviated to IC, also known as Chip or microchip), the integrated circuit in a very thin wafer plane contains all the parts of the board and wiring, It is produced through a series of complex chemical and photochemical processes, so that there is no discrete component and no conventional wiring circuitry. As a result, the circuit of the IC scoring parts is much more reliable.

    • Moore's Law

Moore's law was proposed by Gordon Moore, one of Intel's founders, Gordon Moore. The contents are as follows: When the price is constant, the number of components that can be accommodated on the integrated circuit will increase by one times every 18-24 months, and the performance will be increased by one times. In other words, the computer performance that every dollar can buy will be doubled by more than every 18-24 months. This exponential growth is what we call Moore's law. The basic values used to describe the scale of the circuit are the characteristic dimensions in the integrated circuit (i.e., the smallest size), such as the width of the wire. This number has been steadily shrinking over the years. Many of today's integrated circuits feature dimensions of 32 nanometers, or 32 meters of One-zero, and the next step will be 22 nm. In contrast, the thickness of a piece of paper or the thickness of a hair is 100 mm, or one-tenth mm. At some stage, Moore's law will fail. There have been several previous attempts to conclude that the limits of Moore's law have arrived, but later found a way to break the limits. Now, however, we are at this stage: some circuits contain only a handful of atoms, so small structures are hard to control. CPU speed is no longer doubled every two years.

bits, Bytes, and information representations

In this chapter, the author mainly discusses the three basic ideas of computer presentation information.

First, the computer is a digital processor . They store and process discrete information, which is represented as discontinuous blocks with discontinuous values, which are basically values. The relative simulation information is the value of the smoothed change.

Second, the computer uses BITS to represent information . A bit is a binary number, which is a value that is not 0 or 1. Everything in the computer is represented by bits. The computer uses binaries internally, rather than the familiar decimal.

Again, the larger information is represented by a bit group . values, letters, words, names, music, photos, movies, and the instructions contained in the program that processes the information are represented by a bit group.

    • Analog and digital

Things in life that have a simulated nature are: faucets, car steering wheels, thermometers, etc., whose values change smoothly with other factors. There is no interruption in the process of change, and a small change in one thing implies a slight change in another. and the digital system deals with discrete values: a small change in something, or a change in something else, or a mutation in something else that jumps from one discrete value to another. Many modern technologies are digital. data from the outside world-sound, pictures, motion, temperature, and so on-are converted to digital form as early as possible at the input and converted back to analog as late as possible on the output side. The reason is that digital data is easy to handle, no matter what the original source, digital data can be stored, transmitted and processed in many ways, but the simulation information is not. In addition, by removing redundant and unimportant information, you can also compress digitized information. It can be encrypted for security and privacy, it can be combined with other data, it can be copied without errors, it can be sent anywhere on the internet, and it can be saved to virtually unlimited devices. For analog information, many of these practices are simply not feasible.

    • Analog to digital conversion

How to convert analog information to digital form? Here are a few simple examples to illustrate some important ideas.

Photo: A film camera's imaging is achieved by exposing the film's photosensitive area to the light reflected by the object being photographed, and the amount of light received in different areas of the film is different, thus affecting the dye on the film. In the film development, printing phase, the number of color dyes determines the color changes displayed. For digital cameras, the lens focuses the image on a rectangular sensor array located behind a red, green, and blue filter, which consists of tiny photosensitive detectors. Each detector stores a certain amount of charge, proportional to the amount of light falling on it. These charges are converted to numeric values, and the digital representation of the photographs is the numerical sequence of the intensity of the light that is displayed. The smaller the detector, the more the quantity, the finer the result of the charge measurement, and the more clearly the digitized image will reflect the original image. Each cell of the sensor array consists of a set of detectors that capture red, green, and blue light, one pixel for each cell. The color of a pixel is usually represented by three values, which represent the intensity of red, green, and blue light, so a total of 6 million pixel images will store 18 million color values. When the screen displays images, it uses arrays of red, green, and blue triples, with brightness consistent with pixel brightness, and if we look at the phone or computer screen with a magnifying glass, it's easy to see each individual color block.

Music: What is a sound? The sound source through the vibration or rapid movement caused by the fluctuation of air pressure, the human ear to change the pressure changes in the nerve activity, after the interpretation of the brain formed a "voice." It is not difficult to visualize the air pressure over time, where the pressure can be expressed in any physical way, where we assume the voltage in the circuit. Of course, the current, the brightness of the light, and the pure mechanical device in the phonograph invented by Edison were no problem.

The height of the sound wave in the figure indicates the intensity or size of the voice, and the horizontal axis represents the time. The number of sound waves per second is the tone or frequency, assuming we continuously measure the height of the curve at fixed intervals (voltage values here), we get the vertical lines shown.

The measured values are connected together with the curve approximation, the more frequently the more accurate the results, the more consistent the result. The measured numerical sequence is the digitized representation of the waveform, which can be stored, copied, manipulated, or sent anywhere. Playback can be achieved if a device converts these values to a corresponding voltage or current and then drives the speaker or headset through voltage or current. From the sound wave to the value is the analog-to-digital conversion, the corresponding device is called A/d (analog/digital) converter, in turn, of course, is a digital analog conversion, or D/a. The conversion process is not perfect, and the conversion in two directions will lose a bit of information. But in most cases, this loss is invisible to people (of course, there are many record enthusiasts who say CDs are better than LP:).

Sounds and pictures are often compressed, because they contain a lot of details that humans simply do not perceive. For music, the typical compression technique is MP3, which compresses the volume of the audio file to One-tenth of the original, while making it feel less sound. For images, the most commonly used compression technique is JPEG (the acronym for the standard Joint Image Expert Group--joint photographic expert), which also has a compression rate of 10 times times or higher. Many of the processing mentioned above can be done for digital information, but it is difficult to simulate information, and compression is an example.

Film: Photographer Eadweard Muybridge in the 1870 's to show the world that a series of static images in a quick succession can create the illusion of motion. Today, movies show images at 24 frames per second, and TV is about 25 to 30 frames, a speed enough for the eye to perceive sequential images as animations. By combining (and synchronizing) sounds and images, you can create digital movies. The use of compression technology to reduce space consumption has spawned a standard film format including MPEG (Moving Picture Experts Group).

There is also some information that is convenient to represent in digital form, because there is no need to convert anything other than how to express it. Like text, letters, numbers, and punctuation in a book. We call it plain text. One of the most famous standards for plain text is called ASCII, which is American Standard Code for Information Interchange (U.S. Information Interchange standards codes). But it only contains all the English characters, and the different regions have different character set standards, so we need a universal standard, the Unicode code. It specifies a unique value for all characters in all languages.

Word, a digital representation can represent all of the above information, as well as any information that can be converted to a numeric value, so it can be processed with a digital computer.

    • Bits, bytes, and binaries

There are 10 kinds of people in this world: binary and not binary; there are 10 kinds of people in this world: binary, not binary, and wrong as a binary:-P

The digital system uses numeric values to represent all the information, but instead of the 10 binary that we are familiar with, it is binary (here you should do the meditation, the wonder, the suspicion).

First, it is easier to make a physical device with only two states than to make a device with 10 states. And the world's two election examples abound, switch, true and false, high and low, left and right, men and women (regardless of exception: P), can be represented by a bit. Second, a computer circuit that performs binary arithmetic is much simpler than a decimal arithmetic. Mr Frederick Fung It was a clear early recognition of Relievo that he said in 1946: "The most basic unit of our storage is naturally a binary system, because we do not intend to measure the different levels of charge." "

In some computer ads, we see the term "64-bit" ("Windows 7 Home Premium 64-bit"). What do you mean? When the computer is manipulating data internally, it is in blocks of different sizes that contain numeric values (32-bit and 64-bit values are convenient) and addresses, where the address is the location of the information in RAM. The 64 digits mentioned above refer to the address.

With regard to bits and bytes, it is important to know that the meaning of a set of bits depends on their context and that the bits can not be seen. A byte can represent a male or female with just one bit, the other 7 idle, or it can be used to hold a small integer, or an ASCII character, which can also be part of a character in another writing system, or a portion of a large number represented by 2, 4, or 8 bytes. A picture or part of a piece of music, even part of an instruction for the CPU to execute.

deep understanding of CPUs

The CPU can make a decision, albeit a simple decision: it can compare values (is this number larger than that one?). or compare other data (is this message the same as that one?) , and it's important to decide what to do next, because it means that the CPU can do much more than a calculator, but it can do its job unattended. As von Neumann said: "To make this machine fully automated, let it not rely on manual operation after the calculation begins." Since the CPU can decide what to do next, based on the data it processes, it can run the entire system on its own. Although the instruction system is small, or not complex, the CPU can perform billions of operations per second, so it can do extremely complex processing.

    • Toy computer

In this chapter, the author constructs an imaginary computer that teaches us some assembly instructions, the most important of which is branching and looping. Together with a few other instructions, it is enough to deal with any computation that a digital computer can perform--any calculation can be broken down into small steps that can be done with basic instructions. It is worth noting that the idea of task decomposition is important, especially in the field of computers.

How is the instruction and data represented in RAM? One possibility is that, for example, each instruction requires a memory location to store its numeric code, and in the case where the instruction refers to a memory location or has a data value, it needs to be followed by another position, so it takes up two memory units. The second unit holds the location where it is referenced, and also assumes that the data values occupy a position. This is a simplification, but the reality is similar.

    • The Real CPU

The real processor executes the loop: "Fetch instruction-decode-execute" process. But in order to speed up, but also equipped with a variety of well-designed mechanisms, but the core only loop.

The real computer consists of some instructions for moving data, some instructions for completing arithmetic operations and manipulating the values of different sizes and types, some comparison and branching instructions, and some instructions for controlling other components of the computer. Typical CPUs have dozens of to hundreds of different instructions, and instructions and data typically occupy multiple memory locations, typically 2 to 8 bytes. The real processor has multiple accumulators, usually 16 or 32, so you can save multiple intermediate results, all of which are extremely fast memory.

Computer architecture is a discipline that studies the connection between CPUs and other components of computers. A problem with computer architecture research is the instruction set, which is the instruction table provided by the processor. Do you design more commands to handle all kinds of calculations, or do you design fewer instructions to simplify manufacturing and speed up? The architecture involves a complex tradeoff that takes into account functionality, speed, complexity, programmability (too complex, programmers will not be able to take advantage of its functionality), power consumption, and other issues. Designers have a way of designing the architecture to make the processor run faster. For example, pipelining (the CPU is designed to take and execute instructions alternately, and at the same time there are several instructions at different stages of execution, and the result is that although a particular instruction still takes the same amount of time to complete, the other commands have the opportunity to be processed, and the overall instructions are much faster), parallel to the sequence (Parallel execution of multiple non-intrusive, non-dependent instructions, sometimes, as long as the operation of the instruction does not affect each other, even can not be executed sequentially), running multiple CPUs at the same time ("multicore"), a chip on the integration of more and more processors has become a clear trend. Because of the smaller size of the IC features, the number of transistors that can be integrated on a chip is bound to increase, and these transistors can form more CPUs and can form more caches.

Comparing the speed of different CPUs is not particularly meaningful. Even the most basic arithmetic operations can be handled in a completely different way, which is difficult to compare directly. For example, the same calculation of two numbers and save the results, some processors need to use three instructions, some need two, and some may only need one. Some CPUs have parallel processing capabilities, or can execute multiple instructions at the same time, allowing these instructions to be executed at different stages. To reduce the power consumption of the processor, it is common to sacrifice execution speed and even dynamically adjust the speed according to whether the battery is powered. It's not too serious to say that one processor is "faster" than another, because in many cases specific problems are analyzed.

    • Cache

How is the CPU connected to RAM and other components of the computer? The processor is very fast and usually executes an instruction that requires only fraction nanoseconds. RAM, by contrast, is too slow to tolerate-it takes about 25 to 50 nanoseconds to get data or instructions from memory. If the CPU does not have to wait for the data, it may have already done hundreds of instructions. Modern computers use a small amount of high-speed memory between the CPU and RAM to hold the most recently used commands and data, a high-speed memory called a cache. Caching is a widely used idea in the field of computers. In the CPU, the cache is a small but fast memory that stores recently used information to avoid access to ram. Typically, the CPU accesses certain data and instructions several times in a short period of time. These instructions and data can be placed in the cache to improve access speed.

A typical CPU has two to three caches, which increase in size, but decrease in speed, generally referred to as primary cache, level two cache, and level three cache. The largest cache can store data in megabytes. Most CPU instructions and data caches are independent. The key to caching is that the most recently used information is likely to be used again, and storing it in the cache means less waiting on the ram. Caches typically load a set of information blocks at once, such as requesting only one byte, but loading a contiguous address in RAM. Because neighboring information can also be used, they are also in the cache when they are used, in other words, references to neighboring information do not need to wait.

In addition to discovering performance improvements, users are not aware of this cache. But the idea of caching is everywhere, as long as the things you use now will soon be used, or may be used in neighboring things, it is right to use the caching idea. More than one accumulator in the CPU is essentially a cache, just a cache. Ram can also be used as a cache of disks, and both RAM and disk can be cached as network data. Computer networks often use caching to speed up access to remote servers, and servers in the province also have caches.

In order to check the effect of the cache, you can do an experiment, such as: open Word and other large programs, to see how long it will take from boot to load completion and can be used. Then quit the program and restart it immediately. Under normal circumstances, the speed of the second boot is significantly faster because the program's instructions are still in RAM, and RAM is acting as a disk cache. Using other programs for a period of time, the RAM fills the program's instructions and data, and the original program is removed from the cache.

    • Other computers

PC, MAC, mobile phone, tablet computer, digital camera with embedded system, camera, GPS navigation system, home appliances, game consoles and so on are all sorts of computers. All of these computer systems have the same rationale. They all use a universal processor, which can be programmed to accomplish endless tasks. Each processor has a finite simple instruction table that can perform arithmetic operations, compare data, and select the next instruction based on the result of the predecessor calculation. No matter how confusing the changes in physical structures are, their general architecture has not changed much since the 1940 's.

Hardware Section Summary

It can be seen that the function of the computer is very strong, but we still have a lot of things do not know how to use bits to express, let alone how to use the computer to deal with. For example, the most important things in daily life: art, creativity, truth, Beauty, love, honor and value. I think in a certain period of time, these things will be beyond the ability of the computer. If you come across a person who claims to know how to handle these things "through a computer", don't trust him casually: P.

All rights Reserved.author: Haifeng:) Copyright©xp_jiang. This article is a reading notes, hard work, reproduced please indicate the source: http://www.cnblogs.com/xpjiang/p/4472041.html
Above.

"The World is digital" reading notes the first part _ hardware

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.