The only thing that computer hardware can directly execute is "machine language". The computer can only recognize 0 and 1, and all information is stored in the machine in the form of 0 and 1 (ie binary); and machine language is a set of machine instructions represented by binary code that the computer can directly recognize and execute. , consisting of two parts: operation code and operand; machine language is the operating function given to the computer by the computer designer through the computer's hardware structure.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
Computer hardware can only directly execute "machine language".
The computer can only recognize 0 and 1. All information is stored in the machine in the form of 0 and 1 (ie binary), and the storage unit used is bytes.
The machine language instruction is a binary code, which consists of two parts: opcode and operand.
Machine language is a set of machine instructions represented by binary code that a computer can directly recognize and execute. It is the operating function given to the computer by the computer designer through the computer's hardware structure. Machine language has the characteristics of flexibility, direct execution and high speed. The machine languages of different types of computers are incompatible. A program compiled according to the machine instructions of one type of computer cannot be executed on another type of computer.
An instruction is a statement in machine language. It is a set of meaningful binary codes. The basic format of the instruction is such as the operation code field and the address code field. The operation code specifies the operation nature and function of the instruction. , the address code gives the operand or the address of the operand.
To write programs in machine language, programmers must first memorize all the instruction codes of the computer used and the meaning of the codes. When hand-programming, programmers have to handle the storage allocation and input and output of each instruction and data by themselves, and they also have to remember the state of the work unit used in each step of the programming process. This is a very tedious job. The time it takes to write a program is often dozens or hundreds of times longer than the actual running time. Moreover, the programs compiled are all instruction codes of 0s and 1s, which are not intuitive and prone to errors. Except for professionals from computer manufacturers, the vast majority of programmers no longer learn machine language.
General situation and main shortcomings of machine language
General situation
1. A lot of complexity Trivial details constrain programmers, making it impossible for them to have more time and energy to engage in creative work and perform tasks that are more important to them. Such as ensuring the correctness and efficiency of the program.
2. Programmers must not only control the overall situation of programming but also go deep into every part until the details of implementation. Even programmers with superior intelligence often miss one and often make mistakes, so the programs they write are reliable. Poor performance and long development cycle.
3. Since the way of thinking and expression of programming in machine language is very different from people's habits, only programmers who have undergone long-term professional training can be competent, making programming high-key.
4. Because its written form is all "secret" code, it has poor readability and is inconvenient for communication and cooperation.
5. Because it relies heavily on the specific computer, it has poor portability and poor reusability.
Weak generality
The computers designed and produced by various computer companies have differences in the number and functions of instructions, instruction formats, addressing methods, and data formats. Even if Some commonly used basic instructions, such as arithmetic and logical operation instructions, transfer instructions, etc. are also different. Therefore, although the high-level languages of various types of computers are basically the same, the differences between high-level language programs after they are compiled into machine language are also very large. Therefore, it is almost impossible to transplant programs expressed in machine language to other machines. From the development process of computers, we have seen that due to the rapid development of the basic hardware that constitutes computers, computers are updated very quickly, which raises the problem of how software can keep up. As we all know, when a new machine is launched and delivered for use, only a small amount of system software (such as operating system, etc.) can be submitted to users. A large amount of software is constantly being enriched, especially applications, a considerable part of which are continuously generated by users when using the machine. , this is the so-called software provided by a third party.
In order to alleviate the contradiction between the launch of new machines and the continued use of original applications, the series machine idea adopted when designing the IBM360 computer in 1964 solved this problem better. From then on, although the hardware implementation methods of the same series of computers produced by each computer company can be different, the instruction system, data format, I/O system, etc. remain the same, so the software is fully compatible (on this basis, compatible computers were produced) ). When developing new models or high-end products of this series of computers, although the instruction system can be greatly expanded, all the original instructions are still retained to maintain the upward compatibility of software, that is, the software on low-end machines or old models will not Modifications can be made to run on newer machines that are more advanced than it to protect the user's investment in the software.
For more related knowledge, please visit the FAQ column!
The above is the detailed content of What can computer hardware directly execute?. For more information, please follow other related articles on the PHP Chinese website!