In-depth understanding of the Java Virtual Machine - Java approached

This blog main reference Zhou Zhiming teacher "in-depth understanding of the Java Virtual Machine," Second Edition

Reading is a form of communication with big God. Read the "in-depth understanding of the Java virtual machine" benefit, to have a preliminary understanding of the Java virtual machine. Here write blog mainly for the following three purposes: one is to record, easy to read in the future; one is to deepen understanding of the content; one is for everyone to share, we want to help.

"In-depth understanding of the Java Virtual Machine." The book is summarized as follows:

No. content link address
1 In-depth understanding of the Java Virtual Machine - Java approached https://blog.csdn.net/ThinkWon/article/details/103804387
2 In-depth understanding of the Java virtual machine -Java memory area and memory overflow exception https://blog.csdn.net/ThinkWon/article/details/103827387
3 In-depth understanding of the Java virtual machine - the garbage collector and memory allocation strategy https://blog.csdn.net/ThinkWon/article/details/103831676
4 In-depth understanding of the Java virtual machine - virtual machine execution subsystem https://blog.csdn.net/ThinkWon/article/details/103835168
5 In-depth understanding of the Java virtual machine - a program compiled with code optimization https://blog.csdn.net/ThinkWon/article/details/103835883
6 In-depth understanding of the Java virtual machine - efficient concurrent https://blog.csdn.net/ThinkWon/article/details/103836167

Here Insert Picture Description

And there is no perfect program in the world, but we do not therefore discouraged, because writing program has always been a constant pursuit of perfection of the process.

Outline

Java is not only a programming language, or a technical system formed by a series of computer software and specifications, this system provides a complete technical support and software development environment for cross-platform deployment, and is widely used in embedded systems, The mobile terminal, enterprise servers, mainframes and other occasions, shown in Figure 1-1. Today, Java technology system has attracted more than 900 million software developers, this is the world's largest software development team. Use Java-enabled devices up to billions of units, including more than 1.1 million personal computers, three billion mobile phones and other handheld devices, a large number of smart cards, as well as a large number of set-top boxes, navigation systems and other devices.

Here Insert Picture Description

Java can get so widely recognized, except that it has a strict structure, object-oriented programming language, there are many advantages can not be ignored: it gets rid of the shackles of hardware platforms, to achieve the "write once, run anywhere" ideal; it offers a relatively safe access and memory management mechanisms to avoid most of the memory leaks and pointer cross-border issues; it implements the hotspot compiler and run-time code detection and optimization, which allows Java applications to run with the time increases for higher performance; it has a comprehensive application program interface, there are numerous third-party libraries from businesses and the open source community to help it achieve a variety of functions ...... Java brought these the benefits of the program development efficiency has been greatly improved. As a Java programmer to write programs in addition to fully utilize the various advantages of Java, you should also get to know and think about the Java technology technical characteristics of these systems is how to achieve. Understanding the nature of these technical operations, it is the basis and premise to think for themselves, "written procedures so bad". When we use a technique, if no longer depend on the book  and others will be able to get answers to these questions, then rose to be considered "middle age" realm.

This book will analyze Java technology with the most important principle to achieve those characteristics with readers. In this chapter, we will focus on Java technology and the Java System Content of the history, present and future trends.

Java technology system

从广义上讲,Clojure、JRuby、Groovy等运行于Java虚拟机上的语言及其相关的程序都 属于Java技术体系中的一员。如果仅从传统意义上来看,Sun官方所定义的Java技术体系包括以下几个组成部分:

  • Java程序设计语言
  • 各种硬件平台上的Java虚拟机
  • Class文件格式
  • Java API类库
  • 来自商业机构和开源社区的第三方Java类库

图1-2展示了Java技术体系所包含的内容,以及JDK和JRE所涵盖的范围。

Here Insert Picture Description

以上是根据各个组成部分的功能来进行划分的,如果按照技术所服务的领域来划分,或者说按照Java技术关注的重点业务领域来划分,Java技术体系可以分为4个平台,分别为:

  • Java Card : 支持一些Java小程序( Applets ) 运行在小内存设备(如智能卡)上的平台。
  • Java ME ( Micro Edition ) : 支持Java程序运行在移动终端(手机、 PDA ) 上的平台,对 Java API有所精简,并加入了针对移动终端的支持,这个版本以前称为J2ME。
  • Java SE ( Standard E d i t i o n ) : 支持面向桌面级应用(如Windows下的应用程序)的Java平台,提供了完整的Java核心API,这个版本以前称为J2SE。
  • Java EE ( Enterprise Edition): 支持使用多层架构的企业应用(如ERP、CRM应用)的 Java平台,除了提供Java SE API外 ,还对其做了大量的扩充- 并提供了相关的部署支持,这 个版本以前称为J2EE。

Java发展史

从第一个Java版本诞生到现在已经有18年的时间里。沧海桑田一瞬间,转眼18年过去了,在图1-3所展示的时间线中,我们看到JDK已经发展到了1.7版。在这18年里还诞生了无数和Java相关的产品、技术和标准。现在让我们走入时间隧道,从孕育Java语言的时代开始,再来回顾一下Java的发展轨迹和历史变迁。

Here Insert Picture Description

具体可以参考我的这篇博客Java发展历程

Java虚拟机发展史

上一节我们从整个Java技术的角度观察了Java技术的发展,许多Java程序员都会潜意识地把它与Sun公司的HotSpot虚拟机等同看待,也许还有一些程序员会注意到BEA JRockit和 IBM J9 ,但对JVM的认识不仅仅只有这些。

从1996年初Sun公司发布的JDK 1.0中所包含的Sun Classic VM到今天,曾经涌现、浬灭过许多或经典或优秀或有特色的虚拟机实现,在这一节中,我们先暂且把代码与技术放下,一 起来回顾一下Java虚拟机家族的发展轨迹和历史变迁。

  1. Sun Classic / Exact VM
  2. Sun HotSpot VM
  3. Sun Mobile-Embedded VM / Meta-Circular VM
  4. BEA JRockit / IBM J9 VM
  5. Azul VM / BEA Liquid VM
  6. Apache Harmony / Google Android Dalvik VM
  7. Microsoft JVM 及其他

展望Java技术的未来

在2005年,Java语言诞生10周年的SunOne技术大会上,Java语言之父James Gosling做了一场题为"Java技术下一个十年"的演讲。笔者不具备James Gosling博士那样高屋建瓴的视角 ,这里仅从Java平台中几个新生的但已经开始展现出蓬勃之势的技术发展点来看一下后续 1〜2个JDK版本内的一些很有希望的技术重点。

  1. 模块化,模块化是解决应用系统与技术平台越来越复杂,越来越庞大而产生的一系列问题的一个重要途径。最近几年OSGI技术的迅速发展正说明了通过模块化实现按需部署,降低复杂性和维护成本的需求是相当迫切的。
  2. 混合语言,今年原来越多语言运行在Java这个平台上,例如Groovy,JRuby,Clojure等。试想一下,在一个项目中,并行处理使用Clojure语言编写,展示层使用Jruby或Rails,中间层则是Java,每个应用层将使用不同的语言来完成,而且,接口对每一层的开发都是透明的,各种语言之间的交互不存在任何困难,因为它们最终都运行在一个虚拟机上。
  3. 多核并行,引入java.util.concurren包,能够轻松地利用多个CPU核心提供的计算资源完成一个复杂的计算任务。
  4. 进一步丰富语法,JDK不断升级改进语法
  5. 随着主流的CPU开始支持64位架构,JAVA虚拟机也在很早之前就推出了支持64位系统的版本

实战:自己编译JDK

想要一探 JDK 内部的实现机制,最便捷的路径之一就是自己编译一套 JDK 。通过阅读和跟踪调试 JDK 源码去了解 Java 技术体系的原理,虽然门槛会高一些,但肯定会比阅读各种文章、书籍更加容易切近本质。另外,JDK 中的很多底层方法都是 Native 的,当需要跟踪这些方法的运作或对 JDK 进行 Hack 的时候,都需要编译一套自己的 JDK 。

本章小结

本章介绍了 Java 技术体系的过去、现在和未来的发展趋势,并通过实践的方式介绍了如何自己来独立编译一个 OpenJDK 7。

Published 213 original articles · won praise 2317 · Views 150,000 +

Guess you like

Origin blog.csdn.net/ThinkWon/article/details/103804387