In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
2.1 programming language
In essence, CPU can only run instructions in binary format, that is, binary instructions defined by the instruction set in CPU.
It is too difficult for programmers to program through binary, and few people can program through binary. But human beings need a lot of people to be able to program, so it is necessary to make the programming code close to the way of thinking that human beings can understand. So programming languages can be divided into high-level languages and low-level languages.
The closer a programming language is to a machine, the lower it is, and the closer it is to people, the more advanced it is. Advanced does not mean that it is powerful, nor does it mean that it is powerful, but that it is closer to human natural language.
High-level language is easy for human beings to understand, but computers can not understand it, so if a program written in a high-level language can be executed in CPU, it must first be converted into binary instructions that CPU can understand.
As shown in the figure, there are usually three layers from machine to human, which are machine language-> assembly language (microcode language)-- > high-level language.
2.1.1 the execution process of programs written in high-level languages
There are usually two processes for programs written in high-level languages to execute:
A) convert the high-level language to assembly language (into the assembly language supported by the corresponding CPU chip)
B) convert assembly language into calls to machine instructions
If it is the C language, the first step is called the compilation process.
The conversion process from a high-level language to an assembly language depends on the format of the underlying CPU chip. Different models of CPU produced by different manufacturers are different.
2.1.2 usage scenarios of programming languages
Assembly language (microcode programming): used to write some special hardware-related code, driver development, etc.
High-level language C _ ~: used to write system-level applications, applications with high performance requirements, driver development, etc.
High-level language java,python,php: for developing applications
2.2 General Software
2.2.1 background of passing the software
As mentioned above, CPU produced by different manufacturers contains different instruction sets. Similarly, the memory resources that a program can use are different between running in 512m memory and running in 4G memory. Therefore, when writing a program, you must tell the program how much memory resources are available. Any programmer who writes any program has to consider who the underlying machine is, what manufacturer's chip is, how fast it runs, how many resources it has, and so on. If you write a program with 512m memory, you can only run on a machine with 512m memory, not if you change it a little bit. This is very troublesome, so if we want to achieve the purpose of flexible use, we must eliminate these underlying differences. So how to eliminate these underlying differences?
For example, we are going to travel to many countries, and the languages of each country are different. If we want to travel alone, we have to learn multiple languages. If we do not know the languages of these countries, we can find an interpreter who understands the languages of these countries.
By the same token, in order to avoid programmers having to deal with different situations of various machines when writing programs, we find a translator, which itself can cope with different situations at the bottom, but the interface for the upward output is uniform. This is general-purpose software.
General software is a program that abstracts all kinds of computing power provided by the underlying computer into a unified interface. Whether the underlying layer is AMD's CPU or Intel's CPU, it can be unified into an interface that provides computing power. No matter how many gigabytes of memory, 32-bit systems support up to 4G memory and 64-bit systems support up to 4G memory.
With the general software (operating system), programmers do not have to consider the underlying implementation, but only need to program against the interface of the operating system. In this way, the programming process is greatly simplified and the efficiency is naturally improved.
2.2.2 OS (Operation System)
OS is a general software program.
As we said in the previous chapter, in any case, an ordinary program cannot perform a privileged operation directly, it must apply to the kernel.
When the system is running, the operating system monitors the privileged instructions at any time. Once a program is found to execute the privileged instructions, it can only send a request to the operating system, and the operating system agent can complete the privileged operation. So the operating system must be able to receive requests from the program at any time. So what requests are allowed by the operating system? Here is what the operating system does:
A) hardware driver
B) process management
C) memory management
D) Network management
E) Security management
Every request that the operating system allows to receive is called a system call (System Call).
2.3 programming level
Hardware Specification (hardware specifiacation): for hardware programming
System call (system call): programming for operating system
Library invocation (library call): integrate a lot of underlying functions to provide functionality closer to the final goal
Programmers write programs for either hardware specifications or operating systems. And the operating system is too low-level, so someone abstracts the operating system up another layer, that is, the above-mentioned library calls. At this point, the process of programmer programming is much simpler.
The following figure is an architectural diagram of the programming level:
2.3.1 ABI and API
As we all know, applications under windows cannot be run under Linux.
Once an application is made into a binary format, its applicable operating system platform is determined. Those compiled into exe format can only run under windows, while those compiled into elf format can only run under Unix-like systems. This is specified by the application binary interface, that is, ABI (Application Binary Interface)
ABI is an operating system interface format and a specification that defines which platform the system belongs to.
Applications for different operating systems are not compatible on different platforms after being compiled into a binary format. However, without compilation, if the source code of the application is written for the same interface on different platforms, then the source program can be compiled across platforms. In other words, the source program can be compiled under windows or under a Unix-like system, and the format of the compiled binary program is different.
Here we are talking about the same interface for different platforms, which refers to the application programming interface API (Application Programming Interface).
API is an application programming interface, and programmers generally program against API.
Windows and linux have different application formats, but the programming interface API may be compatible. This means that the program source code written by programmers in compatibility mode under windows is compatible with linux. Although the source code is compatible, once compiled into binary format, those compiled under linux can only run under linux, and those compiled under windows can only run under windows.
When programming for libraries, the programmer writes the application source code for API, and once compiled into binary format, it is for ABI.
2.3.2 UI (User Interface)
GUI (Graphic User Interface): graphical user interface, such as windows desktop
CLI (Command Line Interface): a command line interface, such as a command line terminal under Unix/Linux
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.