什么是程序的Runtime?

背景

资料中常见一些关于Runtime的名词,比如Java Runtime Environment(JRE),Spark Runtime,Runtime到底是什么呢?

Runtime来源

Runtime是指程序在运行阶段的时间,与Runtime对应的是程序生命周期中的其它阶段,例如compile timelink timeload time. 程序生命周期内的一些具体操作如下:

When a program is to be executed, a loader first performs the necessary memory setup and links the program with any dynamically linked libraries it needs, and then the execution begins starting from the program's entry point.

Runtime environment & Runtime library

每一种编程语言都有自己的执行模型(Execution model),执行模型定义了语言的一些规范,包括:什么是一个独立的工作单元,这些工作单元执行的约束条件。

For example, the addition operation is an indivisible unit of work in many languages, and in sequential languages such units of work are constrained to take place one after the other.

Runtime environment 是执行模型的实现部分。这个环境解决程序运行时的一些问题:应用如何分配内存,程序如何使用变量,程序之间传递参数的机制,与操作系统的交互。具体的,Runtime Environment 会建立和管理堆和栈,管理垃圾回收和线程操作等。
Runtime library (RTL) 封装了底层的操作,编译器用Runtime library产生的二进制文件来构建Runtime Environment.

Java Runtime Environment

The Java Runtime Environment is a software layer that runs on top of a computer's operating system, providing additional services specific to Java.
正是由于JRE,Java的 write once, run anywhere 原则才得以实现。


JRE vs JVM

"rt.jar" 代表runtime JAR, 包括所有用于构建核心Java Runtime environment的所有编译好的类,例如java.lang.String, java.lang.Thread, java.util.ArrayListjava.io.InputStream.

Java JDK Libary and Binary

Ref: What is rt.jar in Java/JDK/JRE? Why it’s Important?

Spark Runtime Environment

Spark Runtime Environment (SparkEnv) is the runtime environment with Spark’s public services that interact with each other to establish a distributed computing platform for a Spark application.
Running Spark: an overview of Spark’s runtime architecture 介绍了Spark 是如何进行计算的。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,130评论 0 10
  • 如意听了山子的倾诉,沉默了很久,她想不到,自己尊重的山子,真正的知识分子,家乡山村里走出来的第一个大学生,竟然也有...
    孤独膨胀成猪阅读 21,455评论 9 55
  • “妈妈,今天是你的生日,”远在外省读大学的女儿微信提醒我,我一脸懵逼,啥,我生日?我根本就不知道,不是不记得,是不...
    霞啊霞阅读 3,715评论 10 9
  • 假如我的生命只剩最后一天 我记得我问过你,如果你的生命只剩下最后一天,你会做什么。 你想了想说了这么一句话,...
    薄荷味儿的雅典娜阅读 3,030评论 7 11
  • 有时候会想下一个目标,下一个成就是什么,现在在做的肯定不是,思考着过程算不算得上。生活中的很多事都是向着与愿...
    聂一一阅读 734评论 0 0