How computers work (Part 1)

javaEE elementary learning content 0213

history of computer development

Many high-tech inventions in the world come from the military field.
Computers were originally used to calculate ballistic missile trajectories.

Ballistic missiles~~The most important weapon of the country, very important.
Two bombs and one satellite . Atomic
bombs, hydrogen bombs, satellites (the rocket launch technology behind them)

The calculation process of calculating ballistic missile trajectories is very complicated and requires a lot of calculations~~ But it can be calculated manually (when our country studied two bombs and one satellite, it was all calculated by an abacus) ~~ 1. The calculation is slow 2. The calculation is easy It may not be accurate => Therefore, there is an urgent need for a machine to help us calculate =>
The first computer (special computer) appeared, ENIAC, which was born in 1946 at Princeton University in the United States. It is mainly used for To calculate ballistic missile trajectories, the calculation speed (CPU main frequency) is 5000hz per second (5000 times per second), weighs dozens of tons, and covers an area of ​​several rooms~~ Although it is very low, it is still far faster than manual calculation
. Main notebook processor 12th Gen Intel® Core™ i5-12500H2.50 GHz ~~ 1GHz is one billion hertz (10^9 Hz), 2.5 billion calculations per second

Abacus Mental Arithmetic (Abacus Mental Arithmetic) ~~ Abacus, or mental arithmetic. Abacus
mental arithmetic talents who can get correct results in a very short time by looking at a long series of numbers that need to be calculated
are among the national strategic reserve talents!! !This kind of talent
can still calculate the trajectory of ballistic missiles and counterattack the enemy under extreme circumstances (that is, all electronic equipment has failed)

With the development of the times, general-purpose computers began to appear.
The vision of general-purpose computers was proposed by Turing and realized by von Loymann.

The two founders, Turing and von Leyman, belong to the same era. They were both geniuses of that era. Neumann was only 8 years older than Turing
~~ But von Leyman was in the United States and Turing was in the United States. British
von Loyman once extended an olive branch to Turing and invited him to study general computers, but unfortunately Turing rejected it, so the two ancestors never worked together.

Introduction to Turing

Turing was originally just a mathematician, but with the outbreak of World War II,
in the European battlefield, Britain, as the world's leader and known as the empire on which the sun never sets, was badly beaten by the rising star Germany.
In order to seek a counterattack, Britain launched an effective attack on Germany. , you need to obtain Germany’s military deployment.
At that time, communications in various countries were carried out through wireless telegraphy. As long as you had a radio station, you could receive the data.
However, since German wireless telegrams were all encrypted, they needed to be decrypted
~~ For For the decryption of wireless telegrams, many countries have specialized talent reserves, including the United Kingdom.
However, due to the emergence of Germany's famous encryption system Enigma , which uses machines to encrypt,
the use of human power to crack this method is useless and helpless. It's impossible to calculate it. Even if it is cracked,
you will find that the encryption method has changed a long time ago.

Since Turing has been studying computer-related content, Turing stood up and
proposed using magic to defeat magic!!! => By carefully studying the structure of Engima, he built an anti-Engima machine and
used the machine to Cracking the machine-encrypted data!!!
Therefore, through such a method, the British parsed out a lot of important military intelligence from Germany.
This intelligence directly promoted the famous Battle of Normandy at the time (an important turning point in the European battlefield). occurred,
and finally helped the Allies win World War II.

However, it is a pity that Turing was persecuted by the government after the war => In
1952, the British government convicted Turing of homosexuality, and Turing subsequently underwent chemical castration. On
June 7, 1954, Turing He was poisoned and died after eating apples containing cyanide. He was 42 years old.
On December 24, 2013, at the request of British Minister of Justice Chris Grayling,
Queen Elizabeth II issued a royal pardon to Turing and rehabilitated him.

The Turing Award , named after Alan Mathison Turing, is the highest international award in the computer field and is known as the " Nobel Prize in the computer industry ."



What is the difference between independent display and integrated display?

The integrated graphics is integrated inside the CPU.
The independent graphics is independent.
Compared with the products of the same generation, the best integrated graphics cannot beat the worst independent graphics.

CPU workflow

~~ (Not required for work & not tested for interviews)

logic gate

Electronic switch - mechanical relay (Mechanical Relay)

image-20230916112935398

~~ It can implement 1-bit basic logic operations

Gate Circuit
  • AND gate

    image-20230916105910183

  • OR gate

    image-20230916110834307

  • NOT gate

    image-20230916110956200

The implementation of AND gate, OR gate, and NOT gate relies on the special physical characteristics
of devices such as diodes. The input signal is bits such as 1 and 0. Through this gate circuit, the AND or NOT values ​​are calculated.

XOR gate ~~ The same is 0, the difference is 1

image-20230916112504463

Arithmetic Unit

~~ Arithmetic unit, responsible for all digital operations in the computer, such as four arithmetic operations

  • Half adder
    ~~ adds two bits

image-20230916114129049

  • Full adder
    ~~ adds three bits

image-20230916114729936

  • The adder ~~ consists of a half adder and a full adder
    ~~ It is used to add two binary numbers.
    It is not just a one-bit operation, but a multi-bit operation
    ~~ The adder can not only perform addition,
    but also Arithmetic subtraction => essentially adding the complement of the subtrahend. Multiplication
    => continuous addition.
    Division => continuous subtraction.
    With an adder, addition, subtraction, multiplication and division are all done!!!

image-20230916120441773

The design concept of the CPU is consistent with the Taoism proposed by the ancestors of Taoism - one life is two, two is three, and three is all things! It is recommended to
read the description of the human-column computer in the science fiction novel "The Three-Body Problem". Help deepen your understanding!!!
The blogger will briefly introduce to you
the background of the birth of the humanoid computer of <<Trisolaris>>:
Trisolarans (aliens), they live on a planet with three suns above it , the three suns are doing three-body motion, causing their motion trajectories to be
quite chaotic, which makes them unable to carry out normal agricultural production, social development is difficult, and civilization development even regresses!!!
At this time, their leader "Qin Shihuang" recruited talented people from all over the world to make a "perpetual calendar" to guide agricultural production and promote the development of the empire. Countless big bosses stepped forward and contributed their
own "perpetual calendars", but they all failed. .Until the two big guys appeared, Newton and von Loyman

Newton: Law of Universal Gravitation + Newton's Three Laws => Sequence of Equations~~ Equations concerning the trajectories of motion between stars and planets
Calculus => Solve the equations~~ You can get the "perpetual calendar"

Von Leymann: Your Majesty, give me 30 million well-trained soldiers!!! I will solve the equation.
Use three soldiers to demonstrate for Your Majesty.
Three soldiers stand in the finished glyph. The upper two represent input and the lower one represents Output.
Each soldier holds two small flags, one is a black flag (replaced by a red flag in the picture), and the other is a white flag (replaced by a green flag in the picture). The
red flag represents 0, and the green flag represents 1.
image-20230916141224973

Rules for soldiers waving flags:
If both input soldiers wave red flags~~ 2 0s are input => the output soldiers wave red flags~~ 1 0 is output.
If both input soldiers wave green flags~~ input 2 1s => The output soldier waved the green flag~~ 1 1 was output

If one of the two input soldiers waved a red flag and the other waved a green flag~~ One 1 and one 0 were input =>
The output soldier waved a red flag~~ One 0 was output~~=> This constitutes a AND Gate
If one of the two input soldiers waved a red flag and the other waved a green flag~~ 1 1 and 1 0 were input =>
the output soldier waved a green flag~~ 1 1 was output ~~=> constitutes an OR gate

Similarly, if two soldiers are used, one represents input and one represents output, the
red flag is waved for the input soldier~~ A 0 is input
=> The green flag is waved for the output soldier~~ A 1 is output,
and the opposite is :
Wave the green flag for the input soldier~~ A 1 was input
=> Wave the red flag for the output soldier~~ A 0 was output
~~=> These two soldiers form a NOT gate

With the basic AND gate, OR gate, and NOT gate, with more soldier combinations, you can form an XOR gate. More
XOR gates => you can form a half adder, a full adder, and
more half adders. and full adder => can form an adder

With more soldiers, more gate circuits are constructed, and then there are CPUs, and
furthermore there are memories, input devices, output devices...

At this time, a human column computer appeared, and von Leyman also wrote an operating system for this computer.
Based on this operating system, further equation solving operations were performed.

What was the result?
In the end, there was only one move missing. The Newtonian mechanics system was not accurate enough and
did not take into account the influence of the theory of relativity. There were errors in the calculations and the work fell short.
It was Newton who took the blame. The most annoying thing was that Newton ran away in the end! !!

This book is also helpful for us to find a job
because there are some non-technical questions in the interview.
What books are you reading recently?" (Common classic question)
You answered that the books you read must be meaningful.
On the other hand , It is a household name. The Three-Body Problem is a good choice. (Many programmers have seen it.) If you
talk about the Three-Body Problem with the interviewer, you will easily have a common language with the interviewer, gain a good impression, and improve your impression score.
For example, some of the Three-Body Problem are worthy of discussion. , controversial topics, "Is Zhang Beihai's approach correct?"
Let the interviewer know more about you!!!

Program Language

~~ It is regarded as a communication bridge between programmers and computers
. There is a big difference between programming language and daily use of natural language. Programming language must be rigorous and unambiguous. There are
many kinds of programming languages ​​in the world. They can be roughly divided into Three major categories


Note: A statement in a high-level language often corresponds to many instructions to complete.

  1. machine language

    Instructions composed of binary (0,1)~~ The CPU can identify
    the "instruction set" that the manufacturer will design when designing the CPU. Which instructions the CPU supports and how these instructions work. (This is similar to the API provided by the CPU. )
    ~~ But it is difficult for humans to understand machine language, so assembly language was invented

  2. Assembly language

    Use simple words as "mnemonics" to replace binary instructions.
    Assembly language and machine language have a one-to-one correspondence.
    Each machine instruction corresponds to an assembly statement.

    Different CPUs have different architectures and support different instruction sets.
    Even for the same architecture, different versions have different instruction sets, resulting in different assembly languages.

    When you are learning assembly, you must be clear about which series of CPU you are learning...
    CPUs include x86, arm, mips... many different architectures

    The assembly language you learn in school is most likely the assembly language under the 8086 CPU system
    => 16-bit assembly, which supports a limited number of instructions and a relatively small number of registers.
    Now it is a 64-bit CPU, which supports more instructions and a larger number of registers.

    8086CPU ~~ One of Intel's early classic CPUs was a 16-bit CPU.
    Later there were 286, 386, 486... and these later CPU models ending with 86
    ~~ are collectively called x86 (a very important CPU architecture. Today Mainstream PCs and servers are all x86 architecture)
    mobile phones, routers, mainly arm architecture.

  3. high level language

    C, C++, C# (pronounced C sharp)
    ~~ C++ is an improvement over C, with 2 more plus signs++
    ~~ C# is an improvement over C++, with 2 more plus signs++.
    ~~ A # is equivalent to 4 + (a tic-tac-toe can be composed of 4 +)

    Java,Python,PHP
    Ruby,JS(JavaScript),GO

U model
~~ is collectively referred to as x86 (a very important CPU architecture. Current mainstream PCs and servers are all x86 architecture)
mobile phones, routers, mainly arm architecture.

  1. high level language

    C, C++, C# (pronounced C sharp)
    ~~ C++ is an improvement over C, with 2 more plus signs++
    ~~ C# is an improvement over C++, with 2 more plus signs++.
    ~~ A # is equivalent to 4 + (a tic-tac-toe can be composed of 4 +)

    Java,Python,PHP
    Ruby,JS(JavaScript),GO

Guess you like

Origin blog.csdn.net/m0_73740682/article/details/132920670