I am a computer science student with a basic knowledge of science and engineering. The source of my courses is Crash Course Computer Science.

B station link: www.bilibili.com/video/BV1EW…

Part of the figure in the article comes from video screenshots, and part is drawn by myself, using software: drawing, 100 million diagram diagram (drawing circuit diagram is very convenient).

The cover is old both color teacher pinch ヾ(>∀ <)(Blue ∀ ‘●) What a beautiful painting of the teacher!

1 The early history of computers

Computers have changed every aspect of our lives in the current “information Age”.

The earliest computing machine: abacus: manual computer

Able to store data and perform simple calculations

A basic variant of the abacus, which records data.

Throughout history, humans have created many machines for timing or processing data.

Charles Babbage, computer pioneer: “As knowledge grows and new tools are born, there will be less and less human Labour.”

Computers: Reduce your workload. It started as a profession, but later came to refer to machines.

Before the 20th century, manual computers were expensive and complicated to calculate, so they used pre-made tables to look up values. As soon as a number changes, the table needs to change and is very inflexible.

Analytical machine: “general purpose computer”, that is, automatic computer, the concept of the age.

According to the idea of analytical machine, inspired many people began to have computer thinking, programming thought.

In the U.S. census, due to the large number of immigrants, the census every ten years can not complete the expected target, so we have to use computers to process data and improve efficiency. Therefore, a tabulating machine was designed, and the attributes of people, such as “married”, were punched in the married place, switched on the level, and the gear +1, which can greatly improve the efficiency.

Computers can improve work efficiency, especially in iterative and complex calculations.

2 Electronic computer

With the development of science and technology, the step of human process requires the calculation of more complex data, which is difficult to be achieved manually and needs to rely on computers to complete.

One of the largest electromechanical computers: Harvard Mark I, 1944. The “brain” is the relay that controls the disconnect and connection of electronic circuits by controlling the switch of the relay. However, the mechanical arm has its own weight, which is difficult to meet the requirements of speed. In use, gear wear will occur, parts damage, the probability of failure increases, in order to normal use of the life is too short.

“Bug” : When I was repairing a relay at Harvard Mark I, I pulled out a dead worm. It was called a bug. This is where the bug came from.

Alternatives to relays: thermovalves

Thermionic tube: Two electrodes in an airtight glass bulb, vacuum tube. One of the electrodes can be heated to emit electrons, called “thermoelectron emission”. Another electrode attracts electrons, creating a current in the tap. But it has to be positive.

Improved for three-stage vacuum tube: add positive electric connection, add negative electric to prevent the flow of electrons, can control the line.

Computers switched from electromechanical to electronic.

Giant one: Made of vacuum tubes. The first programmable electronic computer.

In 1950, the vacuum tube reached its limits.

A new alternative: transistors.

The new computer age.

Transistor: Two electrodes separated by a material (semiconductor) that controls whether or not to conduct electricity. The transistor is controlled by a “gate” electrode, which changes the charge of the gate to control whether current is allowed to flow.

Smaller, cheaper to make, better performance and longer working life, computers began to enter the average home.

The common semiconductor material is “silicon”, which gives Silicon Valley its name.

Boolean logic and logic gates

Computers were originally electromechanical devices that counted in the decimal system. Later, with the use of transistors, computers had two “on/off” states, and information could be expressed using only two states, called binary.

You only need the true and false states, write 0 or 1.

Early computers had three or even five bases, but the more states there were, the harder it was to distinguish the signals, and the signals tended to get mixed up, making them less accurate. But if you use binary, it becomes easy to distinguish.

In mathematics, there is a basic theory that deals specifically with “truth” and “falsehood” and solves laws and operations called “Boolean algebra.”

Common mathematics is the addition and subtraction of numerical values, but Boolean algebra variables are true and false, can perform logical operations.

The basic operations in Boolean algebra are: NOT, AND, OR

NOT: Reverses the Boolean value

Design the circuit so that when the input is ON, the current can flow and ground, and the output has no current and the output is OFF.

AND: The output is true only if both inputs are true

OR: As long as one is true, the result is true

If A or B is ON, the output is ON.

Drawing of the door

XOR: XOR. Differs from OR in that the output is false when both inputs are true

4 binary

The decimal system is based on 10

Binary is based on two, and so on

8-bit: 8 bits with a maximum of 256 colors.

8 bits as a unit: byte

1 byte =8 bits, that is, 1 bytes =8 bits

KB: kilobytes, MB: million bytes, GB: billion bytes, TB: eight trillion bytes

In binary, 1 kilobyte = 2 to the tenth = 1024 bytes

To represent positive and negative, we usually use the first digit, where 1 is negative, 0 is positive, and the remaining 31 digits are numbers. But 32 bits still wasn’t enough, and then 64 bits.

To make it easier to find data in hundreds of millions of bytes, it’s labeled “address.”

Floating point: IEEE 754, which uses scientific notation to store decimal numbers.

32-bit floating-point numbers: the first digit represents a positive or negative number, the next eight bits are the storage exponent, and the following 32 bits are the significant number.

Computers use numbers to represent letters, ASCII, seven-bit code, enough to hold 128 different values. Represents upper and lower case letters and symbols. But this method only works with letters.

To solve the problem of Asian Chinese and Japanese, Unicode was born, the standard for unifying all encodings. It is 16-bit, sufficient for all languages.

Arithmetic logic unit

ALU: The component of a computer that performs calculations

The ALU has two units, an arithmetic unit and a logical unit.

Arithmetic unit: Responsible for all numerical operations in a computer.

Use logic gates to represent addition, with two-digit input,0+ 0=0,0+1=1,1+0=1, the same as XOR, but 1+1=10 (binary), requiring “carry”.

The “carry” can be solved by using an AND gate, which is added to the circuit, the half-adder.

But the half adder can only work up to 1+1, and up you need the full adder.

The full adder has three inputs and can be calculated up to 1+1+1. Combining the half adder and using an OR gate to check whether the carry is TRUE can make a full adder.

Take the full adder as a component, add up the three inputs ABC, output “sum” and “carry”

With the new component, you can add two eight-digit numbers.

Make an 8-bit adder, using one and a half adders and seven full adders, called an 8-bit travelling-wave carry adder, the last full adder having one carry output.

If the ninth digit, or carry, is TRUE, the sum of two digits is too large, exceeding eight digits, it is called overflow.

Overflow: The sum of two numbers is too large, exceeding the number of digits used to represent it, leading to errors and unexpected results.

In order not to overflow, you need more full adders to manipulate 16 or 32 digits. But the disadvantage is that many logic gates are required, and the round takes some time.

Modern computers use carry – ahead adders, which are programmed to operate. But simple ALU has no multiplication, which is done by using multiple additions.

The multiplication circuit is more complex than the addition circuit and requires more logic gates.

Logical unit: Performs logical operations. Can perform simple numerical tests, such as determining whether the input value is 0.

The 8-bit ALU can be represented by a V-shaped image. “1000” represents the addition command and “1100” represents the subtraction command.

FLAGS can be printed to determine whether two numbers are equal (A-B=0), negative FLAGS to determine the size of two numbers (A-B is positive or negative), and overflow FLAGS to determine whether the number overflows.