How the computer evolved from 0

Foreword

Modern computers have evolved very complex to understand how computers are running have become extremely difficult, although we can not go in person to make his, but we can understand how the system is under computer from 0 evolved.

Logic gate

Logic gate is the basis of elements of a computer, it can be done by the logic operation (also known as Boolean operations), the input and output of this amplifier are both 0 and 1.

AND gate

Executive "and" operation, two inputs and one output, only when both inputs are 1, the output is only 1, is 0 otherwise.

Write pictures described here

OR

Execute "or" operation, two inputs and one output, as long as the two inputs to one output is 1 to 1.

Write pictures described here

NAND gate

Performs "not" operation, an input an output signal taken opposite input.

Write pictures described here

These three basic logic gate can be realized by all logic operations, the nature of the computer is implemented by these three basic door, achieved by calculating thousands of logic gates.

addition

All addition is the foundation of all operations, we look at how to achieve by adding logic gate said before. Different computers and human calculation, decimal common human, and good computer, the computer calculates for binary to binary.

Exclusive OR gate (XOR) gate to give a combination of three of the most basic, XOR gate following structure.

image

Abbreviated as,

image

Combined into a half adder, as follows,

image

Denoted by,

image

We can only handle half adder adding two binary digit, and can not handle binary previously calculated. To carry processing, two and a half adder may be connected to the OR gate, consisting of full adders, as follows,

image

Full adder can only process three binary digit (which is a carry input) are added. To the addition of n-bit binary data, it requires the use of n full adders connected.

The reason why the addition is the foundation of all operations, because mathematicians have proven to achieve through the addition of other operations, such as multiplication, division, square, square root, logarithm, and so on.

Machine instructions

Although with logical operators have been able to help people complete the calculation, but this direct human use are very unfriendly and inefficient, for example, to do (11+22+33)+(44+55)the operation, we were required to enter three numbers and adding them together to manually record intermediate results, similarly a need to additionally record intermediate result, and then again two input numbers addition operation is performed.

To make the above-described process can be automated, to engage in human memory, which can be used to store data, the memory can be regarded as a lot of blocks, each block corresponding to an address, data can be stored with the address, read and modify. Here are the relevant data into memory.

image

  • Read address 000 to the adder count
  • The number of addresses applied to the adder 001
  • The number of addresses applied to the adder 002
  • Save adders 003 to point to the address location
  • Read address 004 to the adder count
  • The number of addresses applied to the adder 005
  • Save adders 006 to point to the address location
  • Read address 003 to the adder count
  • The number of addresses applied to the adder 006
  • Stop adder.

This process involves four operations, reading (Load), storage (Store), plus (the Add) and stop (halt). And may also encode these operations, such as can be represented by 100,101,102,103. The above process can be used following instructions.

load 000
add 001
add 002
store 003
load 004
add 005
store 006
load 003
add 006
halt
复制代码

Corresponds to instruction encoding,

100 000
102 001
102 002
101 003
...
103
复制代码

With the above command, save them to memory, so that the computer can perform a strip down, without human intervention, to run until the stop command until the end, the entire process is automatic.

More than a brief introduction to the process of adding the instruction operation process, and the real need for more computer instruction set, which also requires more hardware to support. For the instruction set of the computer system is designed with two approaches: ① streamlined instruction set design and programming through complex calculations. ② complex instruction set design, complex instructions directly implemented by hardware, this operation faster, but increases the complexity and cost of the hardware.

register

The actual hardware design, because the calculation process often involves some number of common operation, so designed to register the data transfer needs to be temporarily stored, temporarily stores such a manner rate much faster than the memory mode, fast to As well match the CPU to perform. Similar to the previous adder adds the calculation result stored in the adder.

FIG below two directly reflected first comparison storage at different rates, some second example of a command.

Write pictures described here

Write pictures described here

Programming language

Through the design and implementation of various types of logic gates and the operation instruction, so that a computer system is designed to complete. When the computer is running can be stored in memory by reading the program instructions, and performing various calculations and operations.

Similar 100 000machine instructions for humans is difficult to remember, so it was easy to remember encoded into human form, for example load 000, that assembly language. But assembly language may not be enough to human-friendly, such as the following,

image

On the left is high-level language C language, and the right of assembly language, you can see that although the compilation has been a lot easier than the machine language, but if compared to the high-level language, compilation inefficient or too much trouble, which is why high-level language born.

As a result of the introduction of high-level language, but also a need for additional high-level language compiler to translate into assembly language. Then the whole process is as follows: high-level language -> Assembly Language -> machine instructions -> CPU execution.

operating system

Are calculated from the gates to the programming language of a computer system do, such as addition, subtraction, if only just to do the calculation is estimated there will be so many people addicted to the computer, so it has been with the development of the computer screen , with a variety of audio input and output, with the keyboard and mouse, so that the computer can do more things, such as game film.

To the computer system adds so much equipment to interact with these devices will need a variety of drivers, to facilitate linking them work together, there was an operating system, hardware shield the different operating systems can achieve through the bottom, and it also it provides a number of system calls to achieve a variety of functions.

image

to sum up

Above describes the relevant principles of the computer. From a logic gate to machine instructions, then register, then the programming language, and finally to the operating system, the computer system from 0 super now developed into a complex system.

------------ ------------- Recommended Reading

I'm open source project summary (machine & deep learning, NLP, network IO, AIML, mysql agreement, chatbot)

Why write "Tomcat core design analysis"

2018 summary data structure algorithms papers

2018 Summary machine learning articles

2018 Summary Java depth articles

2018 Summary Natural Language Processing articles

2018 Summary depth learning articles

2018 Summary JDK source article

2018 Summary of concurrent Java core papers

2018 Summary reading articles


Welcome concern: artificial intelligence, reading and feelings and talk about mathematics, distributed, machine learning, deep learning, natural language processing, algorithms and data structures, Java depth, Tomcat kernel and other related articles

Guess you like

Origin juejin.im/post/5d37c397f265da1bb5653aba