为什么虚拟机没有操作系统? [英] Why don't virtual machines have operating systems?

查看:422
本文介绍了为什么虚拟机没有操作系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编程语言的上下文中,如果已编译的代码在某种虚拟机上运行,​​为什么该虚拟机不需要操作系统?例如,对于Java,用Java编写的程序在JVM中运行,但据我所知,JVM没有操作系统.我知道操作系统是必需的,因为它们可以管理资源(例如哪个进程通过CPU进行处理),那么JVM怎么不需要一个呢?我对虚拟机的理解是它是具有自己的体系结构和指令的处理器,但是虚拟机"一词是否可以带有自己的操作系统?

In the context of programing languages, if compiled code runs on some sort of virtual machine why does the virtual machine not need an operating system? For example with Java, a program written in Java runs in the JVM but (as far as I'm aware) the JVM does not have an OS. I know operating systems are necessary because they manage resources (e.g.which process gets a turn with the CPU) so how can the JVM not need one? My understanding of a virtual machine is that it is its own processor with it's own architecture and instructions, but can the term "virtual machine" be though of as coming with its own operating system?

推荐答案

简短的答案是JVM不需要操作系统.

The short answer is that the JVM does not need an operating system.

JVM是单独指定的,与特定的操作系统分开.它很有用,而不必指定操作系统,并且,正如在其他地方指出的那样,存在诸如JVM之类的东西,而我们通常不将其视为操作系统.

The JVM is specified on its own, separate from a specific operating system. It is useful without having to specify an operating system, and, as pointed out elsewhere, there is such a thing as a JVM without what we usually think of as an operating system.

实际上,Java最初是为厨房用具而开发的-没有文件系统,没有鼠标或键盘,可能是键盘和一些7位数字的显示器,仅此而已.

Java was originally developed, in fact, for use in things like kitchen appliances -- no file system, no mouse or keyboard, maybe a keypad and some 7-digit display, that's it.

因此,当Java程序需要在足够复杂以需要操作系统的机器上运行时,Java便会与存在的任何操作系统(Windows,Mac OS,Unix等)进行交互,并且其中的一部分核心类将许多常规的操作系统操作抽象为一个单一的Java程序可以在其中任何一个程序上运行而无需更改的程度.当然存在困难-这是一件困难的事-但Java比我所知道的任何其他工具都更广泛,更好地做到这一点.

So when a Java program needs to run on a machine that IS complex enough to need an operating system, then Java interacts with whatever operating system is there -- Windows, Mac OS, Unix, etc. -- and parts of its core classes abstract many of the normal operating system operations to the extent that a single Java program can run on any of these without changes. Certainly there are difficulties with this -- it is a difficult thing to do -- but Java does this more broadly and better than anything else I'm aware of.

这篇关于为什么虚拟机没有操作系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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