侃 compilation and explanation

zhaozj2021-02-16  49

Get up in the morning boring, so write something to waste energy.

From CPU to operating system

The CPU can perform the instructions of binary representation, which is exactly the basic instruction. Then there is some micro-code in the CPU, and then some non-basic instructions can be used as an instruction, and the CPUs are interpreted interpreted these complex instructions. The operating system is on the hardware and provides some services and operations. The most common is for disk files, or support for process threads. In fact, it has once again extended the features you can use, but limits some of your permissions, such as you can't specify the address of the address directly. And your call to a disk file read and write function is expressed, which may be a gadget provided in some powerful systems in UNIX, and then get an output using something such as inter-process communication. It is also possible to use the DLL provided by some systems in Win32, and some APIs provided by the function in the C. It's also possible to use the assembly call to call directly, let the operating system processing interrupt results. It can be seen that from the system gadget, to the API to the system interrupt, there is a package. The package is actually an explanation, that is, what you call some readfile's API, then this operation is not static to become a binary code in the compile period, which is a class of instructions, but when running The system is interpreted, thereby executing. Therefore, it is actually a way to explain the implementation of the package. Of course, even the system interruption is actually considered to be explained, according to this.

From source code to executable

Another point to explain is between the source code of the executable file and characters expressed in the operating system. This is the most common interpretation and compilation of the place where it is analyzed. From the assembly source code to the executable of the executable, it is very famous, yes, but compiled. The source code of C is also. C is also, but some things of C are not entirely, such as abnormal processing. It can be seen that the functions supported when running are unable to translate, requires dynamic interpretation. The earliest Basic is a pure explanation, you enter the source code and then interpreted a row of reading, then give the output.

Play balance between compilation and interpretation

The most fun is to play a balance between explaining and compiling. These are all in Python and Java. They have made a certain compilation before explaining, such as Java turns the source code into a .class file, Python also has similar PYC files, in fact, it is possible to save the grammar and structural analysis, direct implementation It is a middle language. In fact, the interpretation is divided into two parts: compilation and explanation. The result of the compilation is another language, and the explanation is the kind of intermediate language. It is only the source code that can be read more suitable for running fast interpretation execution than pure human beings. But Java got some small tricks when he was truly explained, that is, the technique of so-called Just In Time. It reads in advance of the code represented by Byte Code, and then translate the BYTE CODE to a local machine code before you execute, so that the speed is quickly executed. The mystery is in advance and pre-compile. This is truly new to integrate the interpretation and compilation. The technology and CPU cache optimization techniques are very similar. Even this inspiration, we can also use the technical instructions of the Pipeline and data instruction dual cache in the CPU to interpretation of the interpretation language.

In short, interpretation and compilation are actually very useful. And everyone does not pay attention to a lot of things, nothing.

转载请注明原文地址:https://www.9cbs.com/read-26594.html

New Post(0)