Joke Collection Website - Cold jokes - Whoever dares to be a computer expert will come!

Whoever dares to be a computer expert will come!

I'll give you a rough idea (just what I said myself, please forgive me if I can't make it clear)

For example, if you want to run a program, you must first send a request (interrupt request) to the CPU, and the CPU will judge the priority of the interrupt request. If the priority is higher than that being executed, the execution of the interrupt request is suspended (including stopping the executing program to protect the scene so as to return to continue execution after executing the requested interrupt, that is, restoring the scene).

Hardware working principle

The final work should be performed by CPU. When all the programs you want to execute are put into the cache first (the process of executing programs is to apply first and then queue up for execution), that is, the information extracted by the CPU is extracted from the memory, not directly from the hard disk (the speed of the hard disk is too slow). So part of the hard disk is classified as virtual memory to alleviate this situation (but definitely not directly equivalent to memory).

Moreover, the program you applied for may have obtained some resources, waiting for another (some) necessary resources, and then releasing all the resources you own after execution. So, when you occupy one resource and wait for another, another program just occupies the resource you need and is waiting for the resource you have. If this happens, they will wait endlessly (that is, deadlock will occur). You can't continue until another program is interrupted (for example, the program you usually encounter is unresponsive, which may be a deadlock, but when you close some of it, it will return to normal. Before the 98 system, there was a blue screen directly, and XP system could forcibly end some programs through the task manager). . .

Mingfacheng | My Message (0/9) | Baidu Home | Baidu Space | Stop 2008 Mystery Man from keeping a diary and recording a mood; Simple is me, ordinary is true ~ ~ ~ Home Blog Album | Personal File | Friends View Articles

Basic working principle of computer: overview of computer system July 2007 13 Friday at 08:35 pm.

Computer system includes hardware system and software system. Computers run by executing programs. When computers work, software and hardware work together, and both are indispensable.

Hardware is the physical equipment that constitutes a computer, and it is a tangible entity that can be seen and touched. The computer hardware system consists of five functional components: calculator, controller, memory, input device and output device.

Hardware is the material basis of computer operation. The performance of a computer, such as operation speed, storage capacity, calculation accuracy and reliability, largely depends on the hardware configuration. A computer with only hardware and no software support is called bare metal. It is inconvenient and inefficient to run only machine language programs on bare metal.

Software refers to the programs, data and related technical documents needed for computer operation. Software is the soul of a computer and the key to its function. With software, people can use computers conveniently and flexibly without knowing the structure and principle of the machine itself. Software shields the concrete computer hardware at the bottom and forms an abstract logical computer (also called virtual machine), which bridges the gap between users and computers (hardware).

Software usually falls into two categories: system software and application software. System software is the software provided by computer manufacturers to use and manage computers, including operating system, language processing system and common service programs. Application software is software developed by computer users to solve various practical problems by using computers and various system software provided by them.

First, the main knowledge points to be mastered

(1) Master decimal numbers, binary numbers, hexadecimal numbers, octal numbers and their mutual conversion methods.

(2) Master the rules of arithmetic and logical operation of binary numbers and the representation method of data in the computer.

(3) Master the concepts of BCD code, ASCII code and Chinese character coding.

(4) Familiar with the composition of CPU and the functions of main internal components.

Second, an overview of knowledge points

(A) the representation of data in the computer

The main function of a computer is to process information, such as numerical values, words, sounds, graphics and images. In a computer, all kinds of information must be digitally encoded before it can be transmitted, stored and processed. Therefore, it is very important to master the concept and processing technology of information coding. The so-called coding is to use a small number of basic symbols and choose a certain combination principle to represent a large number of complex and diverse information. The types of basic symbols and the combination rules of these symbols are two major elements of all information coding. For example, using 10 Arabic numerals to represent numbers and 26 English letters to represent English words is a typical example of coding.

1. carry counting system

In a digital system with carry counting, if only R basic symbols (such as O, 1, 2, …, R- 1) are used to represent numerical values, it is called radix -r number system, and R is called the radix of this number system. For different digital systems, their * * * characteristics are:

Every number system has a fixed set of symbols. For example, for a decimal number system, there are 10 symbols: 0, 1, 2, …, 9; For a binary number system, there are two symbols: 0 and 1.

Use positional notation. That is, symbols in different positions represent different values and are related to the weight of their positions. For example, the decimal number 1234.55 can be expressed as

1234.55 = 1× 103 + 2× 102 + 3× 10 1 + 4× 100 + 5× 10- 1 + 5× 10-2

It can be seen that in various carry counting systems, the value of the weight is only a certain power of the radix. Therefore, the number expressed in any carry counting system can be written as the sum of polynomials expanded by weight, that is, any R-ary number n can be expressed as

Among them: Di is the basic symbol used in this number system; Ri is right; R is the radix, and different radix represents different decimals. The table 1- 1 shows several decimal numbers commonly used in computers.

Table 1- 1 Several representations of binary numbers commonly used in computers

Binary octal decimal hexadecimal

The rules are every two, one, eight, one, ten, one and sixteen.

Cardinal r = 2 r = 8 r = 10 r = 16.

Operators o, 1 o, 1, 2, …, 7 o, 1, 2, …, 9 o, l, 2, …, 9, a, b, …, f.

Right 2i 8i 10i 16i

official delegate

2. Arithmetic and logical operations

(1) binary addition. Binary addition is similar to decimal addition, except that the rule of binary addition is "every binary is one", that is,

O+0 = 01+0 =1=11+1= 0 (with carry)

(2) Binary subtraction. In binary subtraction, when subtraction is not enough, you need to borrow, and the high bit 1 is equal to the next bit 2, that is, "borrowing one into two". The algorithm is as follows:

0-0 = 01-0 =11= 001=1(available)

(3) binary multiplication. Binary multiplication is the same as decimal multiplication, but because the binary number only consists of 0 and 1, binary multiplication is simpler, and its algorithm is as follows:

O×O = O 1×O = 0 O× 1 = 0 1× 1 = 1

(4) binary division. Binary division is the inverse operation of binary multiplication, and its operation method is the same as decimal division.

(5) Binary AND operation is also called logical multiplication, and its operation algorithm is as follows:

O∧0 = O O∧ 1 = 0 1∧O = 0 1∧ 1 = 1

(6) Binary or logical addition, the algorithm is as follows:

0∨O = 0 0∨ 1 = 1 1∨0 = 1 1∨ 1 = 1

(7) The binary XOR algorithm is as follows:

O O = 0 0 1 = 1 1 0 = 1 1 1 = 0

3. Number of machines and coding system

The representation of various data in a computer is called machine number, which is characterized by using O and 1 to represent the symbols of the number, such as "0" for the positive sign and "1" for the negative sign, and the decimal point is implicit and does not occupy a position. The actual value corresponding to the number of machines is called the real value of the number.

There are two kinds of machines: unsigned number and signed number. Unsigned number means positive number, and there is no sign bit in the machine number. For unsigned numbers, if the position of the agreed decimal point is after the lowest digit of the machine number, it is a pure integer; If the position of the agreed decimal point is before the highest digit of the machine number, it is a pure decimal point. For signed numbers, the highest bit of the machine number is the sign bit indicating the sign, and the rest of the binary bits indicate the value. If the position of the agreed decimal point is after the lowest digit of the machine number, it is a pure integer; If the position of the agreed decimal point is before the highest digit of the machine number (after the sign digit), it is a pure decimal point.

In order to facilitate the operation, the signed phone number can be coded by different coding methods, such as original code, complement, complement, etc., which is called code system.

4. Chinese character coding

Chinese character processing includes Chinese character coding input, Chinese character storage and Chinese character output. In other words, when a computer processes Chinese characters, it must first encode, that is, encode.

1) Enter the code

(1) digital coding. Digital coding is to use a number string to represent the input of a Chinese character, commonly used in national standard area code. The international location code divides 6763 second-level Chinese characters published by the National Bureau of Standards into 94 regions, with 94 digits in each region. In fact, Chinese characters are represented as a two-dimensional array, with two decimal digits representing positions and position codes. Therefore, it takes four keystrokes to input a Chinese character. For example, the word "Zhong" is located in the 48th position of the 54th district, and the area code is 5448:

(2) Pinyin code. Pinyin code is an input method based on Chinese pronunciation. Because there are too many homophones in Chinese characters, the input rate of duplicate codes is very high. Therefore, homophones must be selected after pinyin input, which affects the input speed.

(3) font coding. Glyph coding is a coding determined by the shape of Chinese characters. Although there are many Chinese characters, they are all composed of strokes, and the components and strokes of all Chinese characters are limited. Therefore, a Chinese character can be represented by encoding the stroke parts of Chinese characters with letters or numbers and inputting them in the stroke writing order. Five-stroke font, table code and so on are such coding methods. Wu Bi glyph coding is the most influential coding method.

2) Internal code

Chinese character internal code (abbreviated as Chinese character internal code) is the most basic expression form of Chinese characters in equipment or information processing system, and it is the code used to store, process and transmit Chinese characters in equipment and information processing system. In western computers, there is no difference between interchange code and internal code. There are many Chinese characters. It can't be distinguished by one byte, and the national standard code of Chinese characters specified in National Bureau of Standards GB23 12-80 is adopted. Two bytes store the internal code of a Chinese character, and the highest bit of each byte is "1" as the internal code of the Chinese character. Because each byte uses 7 bits, it can represent 16 384 distinguishable internal codes. Taking the Chinese character "Da" as an example, the national standard code is 3473H, the high order of two bytes is "1", and the internal code is B4F3H.

In order to unify the characters representing countries all over the world, 1993 International Organization for Standardization issued the international standard ISO/IEC 10646, abbreviated as UCS(Universal Code Set). UCS includes Chinese, Japanese, Korean and other languages. This standard provides a unified coding scheme for all kinds of languages in use, including Chinese characters.

3) Font code

Chinese font codes are font data representing Chinese fonts, which are usually represented by dot matrix, vector function, etc. When a font is represented by a lattice, the Chinese font code refers to the code of the Chinese font lattice. Character code, also known as character code, is a Chinese character code expressed by dot matrix, which is the output mode of Chinese characters. According to the different requirements of outputting Chinese characters, the number of lattice is also different. Simple Chinese characters are 16× 16 lattice, and high-precision Chinese characters are 24×24 lattice, 32×32 lattice, 48×48 lattice, etc.

(2) Central processing unit

Composition of 1.CPU

As mentioned earlier, CPU is mainly composed of arithmetic unit and controller. The block diagram of CPU is shown in figure 1-2.

1) operator

Arithmetic unit is a component for processing data, which mainly completes arithmetic operation and logical operation, and completes data processing and processing. Different computers have different operator structures, but the most basic structure is composed of arithmetic/logic operator (ALU), accumulator (ACC), register group, multiplexer, data bus and other logic components.

2) Controller

The basic operations that a computer can perform are called instructions, and all instructions of a computer constitute an instruction system. Instruction consists of operation code and address code. The operation code indicates the type of operation, while the address code indicates the address where operands and operation results are stored.

Figure1-2 block diagram of main components of CPU

The main function of the controller is to fetch instructions from the memory, point out the position of the next instruction in the memory, send the fetched instructions to the instruction decoder through the instruction register, and send out corresponding control and timing information after analyzing the instructions, so as to control and coordinate the orderly work of all computer components and complete the operations specified in the instructions.

The controller consists of a program counter (PC for short), an instruction register, an instruction decoder, a status condition register, a timing generator and a micro-operation signal generator, as shown in figure 1-3.

Figure 1-3 controller composition block diagram

(1) program counter. When the program is executed in sequence, every time an instruction is fetched, a value is automatically added to the PC content to point to the next instruction to be fetched. When the program is transmitted, the transmission address is sent to the PC, and then the PC points to the new program address.

(2) instruction register. Used to store the instruction to be executed at present.

(3) instruction decoder (ID). Used to analyze the current instruction and determine the instruction type, the operation to be completed by the instruction and the addressing mode.

(4) Time sequence generator. It is used to generate timing pulses and beat potentials to control the computer to work orderly.

(5) Status/condition register. Used to save the condition code generated after instruction execution. For example, whether there is overflow in the operation, whether the result is positive or negative, whether there is carry and so on. In addition, the status/condition register also stores information such as interrupts and system working status.

(6) Micro-operation signal generator. The operation signal provided by the instruction, the timing signal provided by the timing generator and the state signal fed back by the control function unit are integrated into a specific operation sequence, so as to complete the execution control of instruction fetching.

A controller usually consists of an instruction register (IR), a program counter (PC), a timing component, a micro-operation forming component and a program status word register (PSW). The function of the controller is to control the components of the whole computer to work in an orderly way, and its basic function is to fetch and execute instructions from the memory.

Executing an instruction includes four steps: fetching the instruction, decoding the instruction, executing according to the instruction operation code, and forming the address of the next instruction.

The function of 2.2. cpu

The basic functions of CPU are as follows.

(1) program control. It is an important function of CPU to control the execution sequence of programs by executing instructions.

(2) Operation control. The realization of an instruction function requires several operation signals. The CPU generates the operation signal of each instruction and sends it to different components to control the corresponding components to operate according to the functional requirements of the instruction.

(3) Time control. The CPU controls various operations in time, which is time control. The CPU should strictly control the whole execution time of each instruction. Meanwhile. It is necessary to strictly control the occurrence time, duration and timing of operation signals during instruction execution.

(4) Data processing. CPU processes data through arithmetic and logical operations, and the results of data processing are used by people. Therefore, data processing is the most fundamental task of CPU.

It must be pointed out that there is no clear dividing line between hardware and software in computer systems. Generally speaking, any operation completed by software can also be directly implemented by hardware, and any instruction executed by hardware can also be completed by software. The boundary between software and hardware is constantly changing. Today's software may be tomorrow's hardware, and vice versa.

Computer hardware system composition

Functionally, the hardware system of a computer consists of an arithmetic unit, a controller, a memory, an input device and an output device, which are connected by a bus. The controller and the arithmetic unit are called CPU (Central Processing Unit).

Basic working principle of computer

Von Neumann principle

The first computer in the world is based on the principle of von Neumann, and its basic idea is: stored program and program control. Stored program means that people must input the sequence of computer execution steps (that is, programs) and the data needed in the operation in advance, and store them in the memory of the computer in a certain way. Program control means that when the computer is running, it can automatically take out the instructions in the program one by one, analyze and execute the specified operations. Today, although the computer has developed for four generations, its basic working principle has not changed. According to the concepts of stored program and program control, two kinds of information actually flow in the process of computer operation. One is data stream, including original data and instructions, which have been sent to main memory in advance before the program runs, and they are all encoded in binary form. When running the program, the data is sent to the arithmetic unit to participate in the operation, and the instructions are sent to the controller. The other is the control signal, which is sent by the controller according to the content of the instruction, and directs all parts of the computer to perform various operations or operations specified in the instruction to control the execution flow. The instructions here must be directly understood and executed by the computer.

Computer instruction and instruction system

An instruction is a command for a computer to complete basic operations. Computer hardware can understand and execute instructions. Instruction is a statement in computer machine language and the smallest language unit of programming.

The set of all instructions that a computer can execute is called the instruction system of this computer. The instruction system fully illustrates the computer's ability to process data. Different kinds of computers have different instruction numbers and formats in their instruction systems. The richer and more complete the instruction system, the more convenient and flexible the programming will be. Instruction system is designed according to the requirements of computer use.

A computer instruction is represented by a string of binary codes, which usually contains two aspects of information: operation code and address code. Opcode is used to characterize the operating characteristics and functions of instructions, that is, to indicate what operation to perform; The address code indicates the address of the data involved in the operation in the memory. The source data involved in general operations or the result data after operations are all in memory, and the contents in the address can be accessed through the address, that is, the operands can be obtained.

It takes some time for CPU to access memory. In order to improve the operation speed, sometimes the data or intermediate results involved in the operation are stored in CPU registers or directly in instructions.

The full name of the computer should be called "General Electronic Digital Computer". This name explains many properties of the computer.

"Universal" means that the computer is not a special equipment, and we can compare it with the telephone. The telephone can only be used as a communication tool and has no other use. Computers can not only be used as the basis of calculation, but also as a communication tool with suitable software, and can have endless other uses.

"Electronics" is the physical basis of computer hardware realization. The computer is a very complicated electronic device, and the operation of the computer is finally realized by the current and potential in the electronic circuit.

Digitalization is the information representation basis of all computer processing work. In a computer, all information is represented in digital form, no matter what it is at first. Whether it is numerical value, text, graphics, sound, etc. , they are all unified into binary digital representation in the computer. Digitalization is the basic feature of computer, and it is also the important foundation of computer popularization.

"Computer" means that this is a machine that can perform calculations. The basic action that a computer can accomplish is nothing more than a very simple calculation of number addition, subtraction, multiplication and division. However, when it is under the command of the program, it may have completed a very important thing by completing trillions of basic actions at the speed of electrons. What we see outside the computer is the combined effect of these actions. In this sense, the computer itself does not have many remarkable places. The only remarkable thing is that it can act according to orders and do it quickly. In fact, what is even more remarkable is the program and software. Each program or software is special and specially designed and implemented for the problems it faces.

At present, another popular name of computer is "computer", which is the translated name of broadcasting in Hong Kong and Taiwan and is widely used at present. In fact, this name is not appropriate, and it is easy to lead people's understanding in the wrong direction (perhaps this is the goal of some people intentionally or unintentionally). We never call the wooden sticks used by primitive people to beat the fruits on the trees "wooden hands" or the trains "iron feet". Because both wooden sticks and trains have their own special-purpose strengths and strengths, they can only be used in a very narrow aspect of human hand and foot functions, which is not comparable to the universality of hand and foot functions. Similarly, what computers can help people accomplish is only those things that can be transformed into calculation problems. Compared with the range and ability of human brain, the application range of computer is dwarfed.

The core processing component of a computer is CPU (Central Processing Unit). At present, the CPU of various computers is made of semiconductor integrated circuit technology. Although small, its internal structure is extremely complicated. The basic material of CPU is a silicon chip smaller than the size of fingernail. Through complex processes, millions and tens of millions of tiny semiconductor components have been manufactured on this silicon wafer. Functionally, CPU can perform a set of operations, such as obtaining one data and calculating another result from one or several data (such as addition, subtraction, multiplication and division). ), send a data, etc. Each action corresponds to an instruction, and the CPU will do the corresponding action after receiving the instruction. A series of instructions constitute a program, which may make the CPU complete a series of actions, thus completing a complex job.

When the computer was born, the program that instructed the CPU to complete the work was still placed outside the computer, usually displaying a stack of punched cards. At work, the computer automatically reads cards one by one, and after reading one, it completes an action. The actual card reading is done by card readers (interestingly, IBM started by making card readers). In this way, the working speed of the computer is bound to be limited by the mechanical card reader, and it is impossible to be fast.

American mathematician von Neumann first saw the crux of the problem and put forward the famous "stored program control principle", which led to the birth of computers in the modern sense.

The central part of a computer, except CPU, is mainly memory. When the computer was born, this kind of memory was only used to store the data being processed. When the CPU executes instructions, it extracts relevant data from the memory, and then saves the calculation results back to the memory. The new scheme proposed by von Neumann is that the program should also be stored in the memory, and the CPU is responsible for extracting instructions from the memory, executing the instructions, and performing these two actions circularly. In this way, in the process of executing the program, the computer can completely get rid of the external drag and run automatically at its own possible speed (electronic speed). This basic idea is "stored program control principle", and the computer constructed according to this principle is "stored program control computer", also called "von Neumann computer".

So far, all mainstream computers are of this kind, and this kind of computer is what we are discussing here. With the in-depth study of computing process and computer, people have realized some shortcomings of von Neumann computer and carried out a lot of research work aimed at exploring other computer models. But so far, the achievements of these works are far from reaching the level of manufacturing information processing equipment that can compete with von Neumann computer in performance, price, universality and natural ease of use. I don't intend to introduce these aspects further here. )

From the level of abstract actions of CPU, the execution process of computer is very simple, and it is a simple cycle of two-step actions (Figure 1.5), which is called the basic execution cycle of CPU. Every time the CPU fetches the next instruction that needs to be executed from the memory, it will follow this instruction and complete the corresponding action, and so on, until the program execution is completed (when it meets the instruction that needs the CPU to stop working), or it will work endlessly.

The CPU is an absolutely obedient and obedient waiter. It always follows orders, and it does whatever the program tells it to do. There are not many basic operations that CPU can perform. Usually, a CPU can execute dozens to 200 kinds of instructions. On the other hand, in all fields of real society, computers are needed in all aspects of social life, which is very different and complicated. How can such a simple computer cope with such colorful and complicated social needs? The answer is actually very simple: the program. By arranging different instructions properly, the number of programs that people can write is endless. It's like having only 26 English letters, but there are infinitely many letters, articles, poems, plays and novels written in English. Computers are not complicated in principle. It is the colorful programs that enable computers to meet the endless needs of society.

This working principle of the computer has brought two effects. On the one hand, computers are universal, and one (or several) computers can meet the needs of the whole society, enabling people to produce in the form of large-scale industrial production, improving production efficiency, enhancing computer performance and reducing costs. This makes computers cheaper and cheaper, but at the same time, their performance is getting stronger and stronger. On the other hand, by running different programs, different computers or the same computer can behave as different special information processing machines at different times, such as calculators, word processors, notebooks, information browsing and retrieval machines, account book processors, design drawings, game machines and so on. Even the same computer has many different information processing machines at the same time (as long as several different programs run on this computer at the same time). It is this perfect unity of universality and particularity that makes the computer the sharpest weapon in the process of mankind moving towards the information age.

We say that CPU is not complicated, which is in principle. Today, the most advanced CPU is extremely complex, and it may even be the most complex product ever manufactured by human beings. There are many reasons for this, and here are two of the most important reasons:

First, people's demands for CPU performance are getting higher and higher, because the work that needs computers to complete is becoming more and more complicated (the real society always puts forward new problems and needs computers to solve them). When a complex problem is solved, people will see the hope of solving another more complex problem, so they will work hard. More and more instructions need to be executed to complete a job. One difficulty that can never be overcome is that it takes time for computers to execute instructions (please remember this essential shortcoming of computers, which is extremely important for understanding computers). Although the speed of computer executing instructions is amazing (hundreds of millions of instructions can be executed every second), the speed of CPU is always too slow for the most complicated tasks that people want to solve with computers. In order to improve the speed of CPU in practical calculation, people have developed many ingenious technologies, and the realization of these technologies will greatly increase the complexity of CPU itself.

Second, more and more data need to be processed by computer. Early computers mainly dealt with numerical data, such as integers and real numbers (expressed in a way called "floating point number" in computers), and CPU only needed to provide a batch of instructions around the calculation process related to these data types. With the development of computer, new application requirements emerge one after another. For example, when computers are widely used to process graphics, images and sound signals, although the CPU can be kept unchanged in theory (the original instructions are enough to complete the work, as long as the corresponding programs are written), people have also found that adding some new special instructions can handle these special data forms more effectively. The addition of new instructions can greatly improve the efficiency of CPU in processing special data forms (sometimes necessary, for example, to process high-definition three-dimensional animation in real time), and a side effect is that CPU becomes more complicated.

It used to be said that the development of computers went through four stages: electron tubes, transistors, integrated circuits and large-scale integrated circuits. Computers constructed by these methods are also called first generation, second generation, third generation and fourth generation computers respectively. Looking back today, this sentence doesn't make much sense. The change in the equipment for manufacturing computers is not fundamental (although its significance cannot be underestimated, for example, in reducing cost and volume). This change process is only a short groping stage for people to find a suitable way to make computers, which has been completed in about twenty years. Since then, the basic manufacturing technology of computers has not changed much. On the other hand, other events in the history of computer development are much more important. For example: the miniaturization of computers and the emergence of personal computers, the emergence and development of computer networks, the changes in the use and appearance of computers, etc. These are all done in the scope of large-scale integrated circuits.

Today, people have been studying very new computers. As an alternative information processing tool that is essentially different from ordinary computers, can they be invented? When will it appear? Can it have the perfect unity of cost performance, universality and specificity of today's computers? Can it replace the popular electronic digital computer? We will wait and see.