[J2SE 5.0 topics] [3] virtual machines

Source: Internet
Author: User
Tags error handling garbage collection memory usage
With the release of J2SE 5.0, the JavaTM HotSpot virtual machine is also updated. New changes include data sharing, garbage collection, server-level machine detection, thread priority change, fatal error handling, and high-precision timing support.
Let's take a look at it one by one.
[Data sharing]
In the past Java versions, we may be quite confused about the startup speed of Java applications, so SUN made improvements in this regard when releasing a new JRE. This is data sharing.
To put it simply, class data sharing is automatically installed on JRE, or manually packed the core Java class at any time after installation and converted to the format recognized by the virtual machine, when the VM is started next time, it will map the data directly to the memory, instead of loading, and because the data is static, so it can be shared by all virtual machine processes. Therefore, after the class data is shared, the Java program starts up faster.
According to the documents provided by SUN, class data sharing does not support Windows 95/98/ME, and can only be used for Client VMS (customer virtual machines), and must use a serial garbage collector. It is also mentioned in this document: in Windows, the memory occupied by Java programs is increased, which is actually the reason for the Ing. The total memory usage is actually reduced.
The following are some related command lines:
Java-Xshare: dump manually generates class data sharing
Java-Xshare: off disable sharing
Java-Xshare: on Open share
Java-Xshare: auto automatically determines sharing (default)
For more information, see here.
[Garbage collector]
J2SE 5.0 optimizes and adjusts the garbage collection performance of virtual machines running on servers, this includes parallel GC by default, new default heap maximum and minimum values, new time-limit and space-limit parameters, and so on.
These changes are generally only for well-configured machines, and there is no time to study them carefully. For details, refer to here.
[Server-level machine detection]
This mechanism is used to automatically determine whether the host has the characteristics of the server machine when starting the Java program, and automatically select the appropriate Virtual Machine version. It should be noted that the release of J2SE 5.0 contains two versions of virtual machines, one Client VM and one Server VM, which are used in different situations.
To determine whether a machine is server-level, there is a standard: whether two or more CPUs are available, and whether two or more CPUs are available at the same time. Unfortunately, on all 32-bit Windows machines, only Client VMS are used by default. On Windows machines with 64-bit amd64bit, there is also only one option, namely Server VM. Therefore, we can basically conclude that Windows does not have this detection function.
For more details about server-level machine detection, refer to here.
[Thread priority change]
If I do not understand the error, these changes are only reflected in SUN's Solaris operating system. If you are interested, please check it out.
[Fatal Error Handling]
The fatal error reporting machine in J2SE 5.0 has made Enhancements: Improved debugging information output and reliability.
[High-precision timing support]
J2SE 5.0 introduces the new System. nanoTime () method, but the specific precision is platform-related.
Basically, except for the first type of data sharing, I did not find anything too attractive to me.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.