考虑到计算机组织,JVM如何工作? [英] How does the JVM work considering computer organization?

查看:70
本文介绍了考虑到计算机组织,JVM如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以为我一直都理解Java为什么是可移植的,直到我学习了计算机组织.

I thought I've always understood why Java was portable, until I took Computer Organization.

这是我从头到尾对C程序的解释:

This is my interpretation of a C program from start to finish:

C程序->编译器->汇编->机器代码-> ISA->微型体系结构(计算机解释ISA的方式)->逻辑门->电路->设备

C program --> compiler --> assembly --> machine code --> ISA --> micro architecture (how the computer interprets ISA) --> logic gate --> circuit --> device

编译器必须了解ISA的地方.另外,汇编代码和机器代码将因ISA而异.

Where the compiler must have knowledge of the ISA. Also, the assembly and machine code will vary based on ISA.

Java是这样的: (在JVM内部):Java程序->编译器->字节码

Java is as such: (inside JVM): Java program --> compiler --> bytecode

字节码是JVM的ISA.

bytecode is the ISA for a JVM.

所以,我想JVM也有它自己的微体系结构来解释它. ISA(字节码).

So, I am guessing the JVM also has it's own micro architecture to interpret it's ISA (bytecode).

这准确吗?

因此,整个周期为: (在JVM内部)Java程序->字节码(ISA)-> JVM微体系结构->主机硬件

So the overall cycle would be: (inside JVM) Java program --> bytecode(ISA) --> JVM micro architecture --> host hardware

此外,如果在处理器中实现了微体系结构,那么JVM是否需要使用主机的处理器之一?

Also, if the micro architecture is implemented in the processor, does the JVM need to use one of the hosts' processors?

推荐答案

它更像是(按照C进行分层):

It's more like (following your layering for C):

Java program --> Java compiler --> bytecode --> JVM compiler --> assembly 
--> machine code --> ISA --> micro architecture (how the computer interprets ISA)
--> logic gate --> circuit --> device

请注意,实际上有两个 编译器.这就是Java实现可移植性的方式.

Note that there are essentially two compilers. That's how Java achieves portability.

这篇关于考虑到计算机组织,JVM如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆