Knowledge required to study virtual machines

Source: Internet
Author: User

Note: This article is only my personal understanding. I am not responsible for any mistakes caused by reading this article.

 

A virtual machine is a system. To learn and study this system, you must have a complete knowledge system. any part of the system is indispensable. Otherwise, you cannot have a clear understanding of the virtual machine. From Middle July to March, I have read the mudos source code to get a preliminary understanding of this system, and I am also aware of my own shortcomings. Now, for my understanding, I am going to open a list that contains the preparatory knowledge required to study virtual machines and the degree to which I have mastered this knowledge.

 

1. C Language

As far as I know, mudos, Java, and Python are written in C Language (a few JVM modules are compiled in assembly ). In order to implement a strong and efficient virtual machine, developers have high requirements for C Language Proficiency. They need to be familiar with not only syntax, but also some common usage and skills. The call of system functions must also be well known.

Degree of mastery: 60%-familiar with the syntax of C language. However, due to lack of practice, you have limited understanding of idioms, common skills, system functions, and algorithms.

 

2. Data Structure

The closer it is to the underlying layer, the higher the requirement on the data structure. Inefficiency at the underlying layer will be a nightmare for upper-layer applications. In mudos, applications of arrays, linked lists, HASH lists, and trees can be seen everywhere, such as the hash talbe used to manage memory. When bytecode is generated, pre-order and post-order traversal of the tree is performed.

Degree of mastery: 70%-I studied data structures for the elevation test during my college career and read the STL source code analysis by Hou Jie. therefore, I am very familiar with these data structures, but I have never learned graphs. The application of these data structures is also lacking in practice.

 

3. Operating System

The knowledge of the operating system mentioned here is limited to Linux or Unix applications. Mudos's current maintainer clearly states that he does not intend to support the Windows operating system. Therefore, it is necessary to learn how to manage Linux or UNIX, which is also a necessary knowledge for server programmers.

Degree of mastery: 5%-Shameful. Previously, I learned some basic commands to play with mud. I used cygwin during my work and set up a Linux environment with VMware. However, I still have a poor understanding of Linux, linux management is useless.

 

4. compiler and debugger

Compiling and debugging mudos in Linux use GCC and GDB respectively. Therefore, to read and track mudos code well, you need to use these two tools skillfully.

Degree of mastery: 50%-only two tools. It is not difficult to use them. I just don't know much about some parameters.

 

5. compilation technology

This is a key knowledge of virtual machines, so the knowledge involved is listed separately:

1) lexical analysis

The Lexical Analysis of mudos does not use lex/flex. Instead, it writes the lexical analysis part by itself. The lexical analysis part is not complicated, and it is entirely a word processing part. Carefully and carefully, it plays a decisive role in this part, if a line of code is written incorrectly, the entire yylex function will be discarded. Maybe it is better to use a tool?

Degree of mastery: 40%-this estimate may be overestimated, because I have not tried to write more complex lexical analysis programs and have no idea about the traps and complexity, in particular, the understanding of DFA, NFA, and regular expressions is ambiguous.

2) syntax analysis

Lexical analysis is used to construct a syntax tree. The syntax analysis of mudos uses the bison tool. The entire lexical analysis can even be said to be implemented by the entire virtual machine. The most complex part is the construction of ebnf syntax. This requires not only a deep understanding of the theoretical knowledge of lexical analysis, but also rich practical experience, building a good ebnf syntax requires some talent in my opinion.

Degree of mastery: 20% -- this part made me somewhat discouraged, and I had a vague understanding of theoretical knowledge. I also lacked practical experience in constructing a context-free grammar,

3) semantic analysis

Semantic Analysis involves creating correctness based on the rules of the programming language, and analyzing the execution of compiled programs to improve the running efficiency. This part of knowledge is actually used to ensure the construction of a correct syntax tree.

Degree of mastery: 10% -- not familiar with this knowledge, just read the mudos data type check code.

4) Code Generation

The previous syntax tree traversal is used to generate virtual commands used by virtual machines. This knowledge not only requires an understanding of the code generation technology, but also requires a very good understanding of tree traversal. Both mudos and Java use bytecode interpreter.

Mastery: 40%-lack of practice

5) virtual stack machine construction

This part is actually not the knowledge of compilation technology. The virtual stack machine interprets the compiled bytecode as the instruction of the physical machine. Therefore, you need to understand the construction of the stack machine.

Mastery: 40%-lack of practice

 

6. Network Programming

As the server of an online game, mudos naturally has high requirements on network programming. However, I don't know much about network programming, so I don't know how high the requirements are.

Degree of mastery: 10%-Volume 1 and 2 of the UNIX Network Programming license plate on hand. I know when I can finish it. Network Programming is limited to three-way handshakes ".

 

Summary:

In general, the understanding of virtual machines has basically reached 30%, achieving the expected goal.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.