> For the complete documentation index, see [llms.txt](https://minguw.gitbook.io/jvm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://minguw.gitbook.io/jvm/mooc-minilab/lab-design.md).

# 整体实验结构

Java虚拟机（JVM）的内容其实是非常之多的，在实验中不可能做到面面俱到。我们设置的实验只是作为一个引导，希望在这个过程中能够帮助你掌握阅读JVM规范和阅读JDK源码的能力，以及帮助你掌握一定的debug、coding技巧。

{% hint style="info" %}
在阅读这篇之前建议先阅读 [《从计算机的视角看待JVM》](/jvm/mooc-minilab/view-of-computational-model.md)
{% endhint %}

那么我们到底在这门课上设计了一个怎么样的实验？

首先，我们大致可以把JVM的内容分成四个模块，所有的知识点都是围绕着他们来展开的。加载、线程、内存、执行，由于大家目前的专业知识还不足够，例如很多编译原理、操作系统、并发的知识都还没有掌握或者了解，为了让大家尽可能不受到这些因素的影响，我们把JVM中最关键的部分抽了出来。其中白色的代表我们实验中会涉及到的知识点，灰色则是同模块下的相关知识点。后者大部分都比较复杂困难，也都是相对前沿的研究热点。想要弄清楚灰色的部分，那首先必须对白色的部分有一个非常好的基础理解。

![](/files/-M8TSuXmuMNZaK_-60yG)

尽管列出来了这些知识点你依旧不知道整个框架是如何联系起来的？

整个实验框架中，我们模拟的是在java源文件编译成class文件**之后**，JVM执行class文件的过程。下面这张图从上到下用箭头表示了作业的顺序，而上下层级也意味着它们之间存在着一定的依赖，即后面部分需要依赖于前面部分的正确执行。

![](/files/-M8TScjQX-YXJ47MeZEm)

step0 命令行：提供了框架与用户交互的接口

step1 读文件：加载的第一步，这步完成之后就可以拿到要执行的目标文件

step2 解析：能够更方便地读取目标文件中的信息

step3 运行时环境：为执行目标文件提供了结构的基础，长生命周期的例如对象、类，短生命周期的例如局部变量等等都有了存储的空间

step4 类加载：往往一个class文件不能够解决所有问题，它还需要一些相关的class文件一起来协作解决。类加载为这种class文件之间的协作提供了基础

step5 指令集：执行目标文件就是将要完成的任务转换成一个指令序列，每一个独立的指令都是一个更小的任务，小任务的集合最终能够完成一个完整的任务

step6 方法调用：提供了切换线程栈上下文的基础(和Return类的语句一起实现了这个功能)

step7 解释执行：负责指令调度


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://minguw.gitbook.io/jvm/mooc-minilab/lab-design.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
