运行时和内核之间的区别?
Difference between runtime and kernel?
我正在阅读这个 docker 教程:
It’s important to note that Docker containers don’t run in their own virtual machines, but share a Linux kernel. Compared to virtual machines, containers use less memory and less CPU.
However, a Linux runtime is required for Docker. Implementations on non-Linux platforms such as macOS and Windows 10 use a single Linux virtual machine. The containers share this system.
我想知道 linux 内核和 linux 运行时之间有什么区别。
我找到的内核定义:
The kernel is the lowest level of the operating system. The kernel is the main part of the operating system and is responsible for translating the command into something that can be understood by the computer.
我找到的运行时定义:
Runtime is when a program is running (or being executable). That is, when you start a program running in a computer, it is runtime for that program. In some programming languages, certain reusable programs or "routines" are built and packaged as a "runtime library." These routines can be linked to and used by any program when it is running.
tl;dr:没有区别,Linux 内核是一种 运行time。
详细解释:
运行时间
引用的定义不是 "runtime" 的一个很好的定义。在软件构建上下文中,运行时间是软件获取您构建的软件、解释它并执行它(通常)instruction-by-instruction。
例如,当您为 Java 构建 jar 文件时,它们包含使用称为 "Java bytecode" 的语言的指令,以及 运行 执行这些指令的时间 [=54] =] 程序是 运行ning 是 JVM。
当您编写 Python 脚本时,执行这些 Python 指令的 运行 时间是 Python 解释器。
OSes 和正在加载
运行时还具有将程序从文件加载到可以解释的形式的作用。
当您用 C 语言构建程序时,它会被编译为机器码,而不会被任何软件解释,而是由硬件直接编译 (CPU)。此类程序有时称为 "native"。但是,C 标准库通常不与您的软件捆绑在一起,它们必须独立存在于 运行 编译您的代码的机器上,这些有时也被称为 "The C runtime",部分原因是它们包含每个 C 程序的 bootstrap 代码。
即使是这样的本地程序也被编译成本地可执行格式(Linux 使用的格式称为 ELF),OS 内核必须知道如何将该格式读入指令并加载以 CPU 可以解释和执行它们的方式。因此,OSes 也是 运行 次。 (请注意,虽然 OS 内核是 OS 的主程序,但通常其他程序也是此 运行 时间的一部分,例如动态链接器。)
如您所见,运行时间经常堆叠:您可以拥有 Intel x86 硬件 运行ning MacOS 内核 运行ning 管理程序 运行正在使用 Linux 虚拟机 运行正在使用 JVM。
Docker 运行时间
现在,您将遇到的所有 docker 图片都是基于 Linux 的。这些映像中安装的所有本机程序,包括 运行 次像 JVM 和 Python 解释器,都是为 Linux(即 ELF 可执行文件)编译的本机程序。
当您 运行 docker 容器在 Linux 中时,需要发生两件事:
首先,docker 需要设置一个容器(设置诸如覆盖文件系统和控制组之类的东西)。
其次,docker 需要以某种方式将容器中的一些 (ELF) 可执行文件(例如 JVM 或您的本机容器化 C 程序)获取到 运行。
这两件事都归入"program loading"类别,这是运行时间的责任。
Linux 是唯一具有所有这些功能的操作系统内核 - 覆盖文件系统、控制组和 ELF 加载 - docker.
使用这些功能
例如MacOS,这些技术不存在 (AFAICT),因此为了 运行 一个 docker 容器,docker 需要 运行 它的容器在一个Linux 虚拟机,作为 运行 可以加载图像的时间。
我正在阅读这个 docker 教程:
It’s important to note that Docker containers don’t run in their own virtual machines, but share a Linux kernel. Compared to virtual machines, containers use less memory and less CPU.
However, a Linux runtime is required for Docker. Implementations on non-Linux platforms such as macOS and Windows 10 use a single Linux virtual machine. The containers share this system.
我想知道 linux 内核和 linux 运行时之间有什么区别。
我找到的内核定义:
The kernel is the lowest level of the operating system. The kernel is the main part of the operating system and is responsible for translating the command into something that can be understood by the computer.
我找到的运行时定义:
Runtime is when a program is running (or being executable). That is, when you start a program running in a computer, it is runtime for that program. In some programming languages, certain reusable programs or "routines" are built and packaged as a "runtime library." These routines can be linked to and used by any program when it is running.
tl;dr:没有区别,Linux 内核是一种 运行time。
详细解释:
运行时间
引用的定义不是 "runtime" 的一个很好的定义。在软件构建上下文中,运行时间是软件获取您构建的软件、解释它并执行它(通常)instruction-by-instruction。
例如,当您为 Java 构建 jar 文件时,它们包含使用称为 "Java bytecode" 的语言的指令,以及 运行 执行这些指令的时间 [=54] =] 程序是 运行ning 是 JVM。
当您编写 Python 脚本时,执行这些 Python 指令的 运行 时间是 Python 解释器。
OSes 和正在加载
运行时还具有将程序从文件加载到可以解释的形式的作用。
当您用 C 语言构建程序时,它会被编译为机器码,而不会被任何软件解释,而是由硬件直接编译 (CPU)。此类程序有时称为 "native"。但是,C 标准库通常不与您的软件捆绑在一起,它们必须独立存在于 运行 编译您的代码的机器上,这些有时也被称为 "The C runtime",部分原因是它们包含每个 C 程序的 bootstrap 代码。
即使是这样的本地程序也被编译成本地可执行格式(Linux 使用的格式称为 ELF),OS 内核必须知道如何将该格式读入指令并加载以 CPU 可以解释和执行它们的方式。因此,OSes 也是 运行 次。 (请注意,虽然 OS 内核是 OS 的主程序,但通常其他程序也是此 运行 时间的一部分,例如动态链接器。)
如您所见,运行时间经常堆叠:您可以拥有 Intel x86 硬件 运行ning MacOS 内核 运行ning 管理程序 运行正在使用 Linux 虚拟机 运行正在使用 JVM。
Docker 运行时间
现在,您将遇到的所有 docker 图片都是基于 Linux 的。这些映像中安装的所有本机程序,包括 运行 次像 JVM 和 Python 解释器,都是为 Linux(即 ELF 可执行文件)编译的本机程序。
当您 运行 docker 容器在 Linux 中时,需要发生两件事:
首先,docker 需要设置一个容器(设置诸如覆盖文件系统和控制组之类的东西)。
其次,docker 需要以某种方式将容器中的一些 (ELF) 可执行文件(例如 JVM 或您的本机容器化 C 程序)获取到 运行。
这两件事都归入"program loading"类别,这是运行时间的责任。
Linux 是唯一具有所有这些功能的操作系统内核 - 覆盖文件系统、控制组和 ELF 加载 - docker.
使用这些功能例如MacOS,这些技术不存在 (AFAICT),因此为了 运行 一个 docker 容器,docker 需要 运行 它的容器在一个Linux 虚拟机,作为 运行 可以加载图像的时间。