可以将 Davlik 移入 Linux 内核以提高性能吗?
这是一个非常高级的架构问题。为什么没有将 JVM 移入 Linux 内核,它可以更高效(包括即时编译的代码)。
我意识到这对于最小内核粉丝来说是令人厌恶的,但 Linux 不是这些操作系统之一, 它似乎。可以通过 /dev
条目控制 JVM 内核模块。
为什么不呢?
This is a very high-level architecture question. Why hasn't a JVM been moved into
the linux kernel, where it could be more efficient (including just-in-time compiled code).
I realize this is abhorrent to minimal-kernel fans, but Linux is not one of those OSs,
it seems. A JVM kernel module that could be controlled via a /dev
entry would be possible.
Why not?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将某些内容移入内核本身并不会“使其运行得更快”。在某些特殊情况下,它可以做的是允许使用替代方法。除非您有某种方法可以利用内核的优势,否则内核绝对没有任何好处。
Moving something into the kernel does not, by itself "make it go faster". What it can do in some exceptional cases is allow alternate approaches to be used. Until you have some way of taking advantage of being in kernel, there is absolutely no benefit to being in kernel.
我至少可以说出几个原因(当然还有更多):
I can name at least several reasons (surely there are much more):
它可能不会更有效率;它的效率可能较低。每次你想要处理数据时,数据都位于内核之外(除非你也将你的程序和它们想要的任何数据直接加载到内核中),并且至少需要发生两次上下文切换;如果解释器位于内核之外,则不需要上下文切换(除非必须从某处读取数据(文件、用户、网络等)。
此外,那些“从某处读取”的情况将产生额外的上下文即使内核请求,也会进行切换,因为在幕后需要进行很多工作才能获取该数据
(上下文切换非常昂贵。它们有点像踢 CPU 的头,然后再进行切换。当它不再看到星星时,告诉它看别的东西;然后它需要记下你踢它之前它在做什么,然后去阅读它关于你刚刚告诉它做什么的注释。)
It might not be more efficient; it might well be less efficient. Every time you want to work with data, the data lives outside the kernel (unless you've also loaded your programs and whatever data they want directly into the kernel) and at least two context switches will need to happen; if the interpreter is outside of the kernel, no context switches are necessary (unless that data has to be read from somewhere (a file, the user, the network, whatever).
Moreover, those "read from somewhere" cases will incur additional context switches even if requested by the kernel, because there's a lot of stuff going on behind the scenes to get that data.
(Context switches are expensive. They're a bit like kicking the CPU in the head and telling it to look at something else when it stops seeing stars; then it needs to write down what it was doing before you kicked it, and then go read its notes about what you just told it to do.)