Differences between 32bit and 64bit Based on x86 and JVM

Source: Internet
Author: User
Tags intel core i7
Preface

32-bit and 64-bit systems are often mentioned in the computer field, but many people do not know the difference between 32-bit and 64-bit systems. Therefore, I have compiled some documents online, I hope to share with you. For 32-bit and 64-bit, this article will explain from the processor, operating system, and JVM respectively.

IA Introduction Introduction

Speaking of processors, most people use Intel's processors. Therefore, this article mainly explains 32-bit and 64-bit processors from Intel's processors.
Generally, an Intel-based server is called an IA (IntelArchitecture) architecture server, or a CISC (ComplexInstructionSetComputer Complex Instruction Set) architecture server, because the server in the IA architecture is a PC-based x86 processor system, the server in the IA architecture is also called a PC server or x86 server.
Although the IA architecture server started with PC, after continuous development, the IA architecture server has gone far beyond the concept of PC.
According to intel's official statement, the IA architecture is divided into the following three types:
1 IA-32
2 Intel 64
3 IA-64

History

The x86 architecture was first introduced in 1978 as an Intel 8086 processor. It evolved from an Intel 8008 processor, while 8008 was developed from Intel 4004. 8086 was selected for ibm pc three years later, and x86 became the standard platform for personal computers and the most successful CPU architecture ever since.

Other companies also have x86-based processors, including Cyrix (now acquired by VIA), NEC group, IBM, IDT, and Transmeta. AMD is the most successful manufacturer outside Intel.
8086 is a 16-bit processor. This architecture was maintained as 16 bits until the 32-bit 1985 development in 80386.
The launch of Intel 80386 32-bit Processors may be the biggest advance in the x86 architecture so far. Linux, iisbsd, Windows NT, and Windows 95 are both 386 in the beginning, and the basic architecture of this 386 has become the foundation for the development of all the x86 series in the future.

Intel now calls the x86-32 IA-32 "Intel Architecture, 32-bit ".

Then the IA server went through several stages, including the 486 system, PentiumPro system, PII system, PIII system, and XEON system. The processing capability of processor system is greatly improved, while the bus structure of server system is always IA-32 bus system.
After the development of IA-32 server to 8-channel XEON server, the architecture has begun to become a bottleneck restricting the performance of the server.
As a result, hp and Intel have been working together to develop IA-64-based processors since 1994. The IA-64 structure is neither an Intel 32-bit x86 expansion nor a fully hp 64-bit PA-RISC structure, it is a brand new design style. Currently officially announced support for IA-64 platform Monterey, Linux64, hp-UX, Solaris, Win2000, Windows xp and other operating systems.
IA-64 stands for the Itanium processor, which is specifically used in high-end enterprise 64-bit computing environments against IBM Power4/5, HP PA-RISC, sun UltraSparc-III and DEC Alpha's high-end enterprise processor.

However, because it cannot well solve the compatibility with the previous 32-bit application, so the application is subject to a large limit, and AMD added a 64-bit register in the IA-32, and compatible with early 16-bit and 32-bit software to form the AMD64 version. Although Intel has adopted a variety of soft, hard methods to make up for this deficiency, but with the full investment in AMD64 processor, Intel's IA-64 architecture of the two processor prospects are not optimistic.

The application software set up for the x86 system is too large. Intel sees the success of using the Opteron and Athlon 64 of AMD64, and it needs to attack competitors, also developed compatible with early 16-bit and 32 64-bit processors, Intel named it "IA-32E", meaning an extension of the IA-32, which was changed to EM64T after weeks. Although the core of the processor is almost the same as that of AMD64, In the past Intel marketing, Intel always degraded AMD products as their own technology counterfeits, Intel for its own face, we certainly won't admit that we use the technology of our rival AMD, so Intel launched the technology in the name of EM64T. Later, Intel simply named the technology Intel 64.

Intel 64 instruction sets are used on Pentium 4, Pentium D, Pentium Extreme Edition, celeon D, Xeon, Intel Core 2, and Intel Core i7 processors.

Because AMD64 and Intel64 are basically the same, many software and hardware products use a word that does not tend to be on either side to indicate their compatibility with both architectures. For this purpose, AMD's original title for this CPU architecture-"x86-64" is used from time to time and there is a variant "x86_64 ". Other companies such as Microsoft and Sun computer systems use "x64" in marketing materials as the abbreviation of "x86-64.

EM64T Technical details

Intel officially defines EM64T as follows: EM64T full name Extended Memory 64 Technology, the 64-Bit Memory extension Technology, an extension of the Intel IA-32 architecture (Intel Architectur-32 extension, and compatible with the original architecture. By increasing the Bit Width of the CPU, you can increase the bit width between the cpu and the memory, so that the system can support larger local memory capacity (32-bit processors can only support a maximum of 4 GB of memory capacity, the 64-bit location is up to 64 GB ). Theoretically, although the EM64T architecture can run well at most 64 bit memory addressing, not all EM64T processors can reach the theoretical upper limit due to design and manufacturing processes.

Intel supports EM64T technology processor can be divided into two categories: Traditional IA-32 mode and IA-32e expansion mode, under the two categories can be divided into a variety of operating modes

EM64T Running Mode

       

Traditional IA-32 Mode

   

IA-32e expansion mode

 

Protection Mode

Real address mode

Real 8086 Mode

Compatibility mode

64-Bit mode

 

In traditional IA-32 mode, like IA-32 mode, we can install windows xp 32bit, install 32-bit hardware driver, and install 32-bit applications. At present, most people use Intel 64 processors and have installed windows xp 32. The program runs well, including 16bit and 32bit programs.
 

In compatibility mode, the operating system and hardware drivers are both 64-bit. Computers can run most traditional 32-bit applications without pre-compilation in 64-bit operating systems, this is basically the same as in traditional IA-32 mode, 32-bit applications still only have access to 4G memory, but this limit is only at the process level, not at the system level.
 

In compatibility mode, hardware drivers are required to be 64-bit, so the biggest disadvantage of 64-bit Windows is compatibility, and the most prominent aspect of compatibility is the drivers of various hardware devices ., If the developer of your hardware device has not developed a driver for 64-bit Windows XP, either the device cannot be used in 64-bit Windows XP, either use the general driver that comes with the operating system to barely use it, but the performance and functions will be affected.
As for other software programs, there is generally no major problem. In 64-bit Windows XP, only 16-bit applications are completely unavailable, while 32-bit applications can continue to be used. However, when installing these applications, you should also note that some applications, although not related to hardware, but in order to implement some special features of the software, when installing the software, the driver is also installed into the system, which cannot be used in 64-bit Windows before the 64-bit version is released.
For example, if the famous software SnagIt is used by default, a virtual printer will be installed in the system, which can output documents into the graphic format. Because a virtual device is installed, the program does not provide a 64-bit version. Therefore, an error occurs when you use the default option in 64-bit Windows XP, this virtual printer is not installed unless we customize the installation options.
 

However, for servers, the server does not need any peripherals. Poor hardware compatibility has little impact on the server.

In 64-Bit mode, the operating system, drivers, and applications must be 64-bit. In this case, the operating system cannot run 32-bit programs, and the compatibility is the worst, however, the advantage of the 64-bit architecture is fully utilized.

 

Operating System 32 bit And Operating System 64 bit

64bit computing has two main advantages: it can perform integer operations in a larger range; it can support larger memory.
The 64-bit CPU can extract 64-bit data at a time, which is twice higher than the 32-bit CPU. Theoretically, the performance will be doubled. However, this is based on the 64-bit operating system and 64-bit software.
However, we cannot simply think that 64-bit processor performance is twice the performance of 32-bit processor. In fact, in 32-bit applications, the performance of 32-bit processors is even stronger. Even 64-bit processors have higher performance in 32-bit applications. Therefore, we need to recognize the advantages of the 64-bit processor, but do not believe that 64bit.

Under what circumstances do we need to upgrade to the 64-bit operating system?
This depends on the application type. The following example shows the benefits of 64-bit processing:
Encryption program: Most encryption algorithms are based on a large amount of integer data and are suitable for processing in 64-bit General registers and encoders.
Scientific Computation: Scientific Computation of integer data will benefit from 64-bit processing, and floating point operations will not benefit from it, because even 32-bit processors have reached 80-128-bit floating point registers.
Applications that require more than 4G, such as database servers, graphics processing, and video compression applications.

In theory, the 64-bit virtual memory space can support direct access to 2EB. However, the current so-called 64-bit processor cannot really achieve this. The reason is very simple. Currently, there is no physical memory as large as that supported by machines. EM64T provides 40-bit addressing capability and supports up to 1 TB of memory.

 

JVM 32 bit And JVM 64 bit

JVM is an essential tool for Java developers, and JVM also has 32 bit and 64 bit.
So what is the difference between 32-bit and 64-bit JDK?
The differences between JVM 32bit and JVM 64bit are as follows:
1 currently, only the server VM supports 64bit JVM, and the client does not support 32bit JVM.
2. The Java Plug-in, AWT Robot and Java Web Start components currently do not support 64bit JVM
3. Influence of local code: it does not affect the JNI programming interface, but the code written for 32-bit VM must be re-compiled to work in 64-bit VM.
The maximum size of 4.32-bit JVM heap is 4 GB. On 64-bit VMs, the size of Java heap is limited by the physical memory and virtual memory provided by the operating system. (The Heap here is not rigorous)
5. Default thread stack size: 32-bit JVM on windows. The default maximum stack size is 320 k 64-bit JVM and 1024 K.
6. performance impact:
(1) Compared with 32bit JVM, 64bit JVM has less performance loss when a large amount of memory access occurs. When the AMD64 and EM64T platforms run in 64-Bit mode, the Java Virtual Machine obtains some additional registers that can be used to generate more effective native instruction sequences.
(2) In terms of performance, when a java application is transplanted from the 32bit platform to the 64bit jvm on the 64bit platform, the performance will be reduced by about 10-20%, on AMD64 and EM64T platforms, the range of performance loss is 0-15%.

Above from http://java.sun.com/docs/hotspot/HotSpotFAQ.html#64bit_description

 

JVM Performance Analysis

Sun's official website says that when a java application is transplanted from the 32bit platform to the 64bit jvm of the 64bit platform, the performance of the application will be compromised. I believe many people will be puzzled.
From the numerical point of view, we generally think that 64-bit JDK is better than 32-bit JDK, but as mentioned above, "In fact, in 32-bit applications, the performance of 32-bit processors is even stronger, even a 64-bit processor, it is still more powerful in 32-bit applications ".

Many simple truths in the world of Datong include the larger the better, the more difficult it is to move to the computer field. When processing multiple CPUs, you will think that the processing units that are multiple cores are very useful, but if you work only on a single thread, what you need to do is to let the other core side rest.

The comparison between 32-bit and 64-bit is more subtle. The x86-64 architecture not only increases the number of registers based on the x86 architecture, but also increases the number of registers. Basically, this will bring better performance (because more registers allow the compiler to create better machine code ). However, unfortunately, so far, the performance of Java has been reduced from 32 to 64-bit.

Java Virtual Machine (JVM) is a software specification. Its 32-bit and 64-bit versions have different performance, but they all include JIT compilers and garbage collection functions (GC ), its performance depends on the execution efficiency of JIT compiler and garbage collection. The JIT compiler implements dynamic translation of Java bytecode to hardware machine code before program execution. The idea behind the JIT compiler is that the bytecode is smaller and easier to compile than the Java source code, however, it takes a little time to compile the Java bytecode into a machine code, but it is much less time than to compile the Java source code directly into a machine code. In 32-bit and 64-bit JVMs, the corresponding JIT takes a little time to compile the Java bytecode into the final machine code, but some optimizations can be made; in addition, the overall performance of clients and server programs in IBM and Sun versions is also different. Garbage collection will reclaim the memory that the object no longer needs. It must be executed frequently to release the Java heap that the object no longer accesses. Because the data size in the Java heap changes on 32-bit and 64-bit platforms, the performance of the 32-bit and 64-bit JVMs is different, however, the larger the pointer, the more difficult GC management, resulting in different garbage collection performance.

 

64bit JVM Testing Performance ----- Higher horsepower doesn't always mean stronger performance

Next, we will focus on two widely used 64-bit platforms, AMD64 and PowerPC64, and use the Java Virtual Machine (JVM) provided by the Java language giants IBM and Sun Microsystems ), through the SPECjvm98 and SPECjbb2000 tests, the performance of the 32-bit and 64-bit JVM is evaluated. The following items are used to test client performance. 2_201_compress, a popular compression program. 2 _ 202_jess, a Java version of the nasa clips rule-based expert system. 2 _ 209_db, data management Benchmark Testing Software. 2_213_javac, JDK Java compiler. 2 _ 222_mpegaudio, an audio decoder for MPEG-3. 2 _ 227_mtrt, a two-thread program that processes image files. 2 _ 228_jack, an analysis program generator.

Summary of the test results:
1. Based on the test results of the PowerPC64 platform running the Linux operating system, it indicates that if the ibm jvm is used on the platform, then those programs that do not require the 64-bit feature, let them run in the 32-bit JVM, because the 64-bit JVM has lower performance than the 32-bit JVM in all test results on this platform.

2 Based on the test results of the AMD64 platform running Linux operating system, it indicates that the performance of 32-bit and 64-bit is in the middle of Sun or IBM's JVM. Note that, performance differences depend on specific applications and JVM. To achieve optimal performance, you must test a specific program in a specific execution environment, to evaluate the potential performance improvement caused by the conversion to 64-bit.

Considering the length, here not to list detailed test reports, detailed test reports please refer to http://blog.csdn.net/xieqidong/archive/2008/03/22/2205055.aspx
Here, we use the well-known AMD64 as an example to list some test reports.

Figure 1

Figure 1 shows the performance test report of Sun Java 2 Standard Edition Development Kit 5.0 (J2SE 1.5.0) in Linux on the AMD64 platform, the results show that only the three test clients -- _ 201_compress, _ 222_mpegaudio, and _ 228_jack have better performance than the 32-bit jvm in the 64-bit version.

Figure 2

Figure 2 shows the performance test report of IBM Developer Kit for Linux and Java 2 Technology Edition Version 1.4.2 GA on the AMD64 platform, test results show that only three test clients -- _ 209_db, _ 1__javac, and _ 228_jack have better performance in 64-bit environments.

 

How to select JVM 32bit And JVM 64bit

There are suggestions for choosing JVM32bit and JVM 64bit on the Internet:
1. Does your application require more than 2 GB of Java Heap for better performance? Yes = 64-Bit No = 32-Bit how can I determine how much Java Heap your application needs? You can determine by calculating the average Heap usage.

2. Does your application require high-precision scientific computing for statistics, security, encryption, and so on? Yes = 64-Bit No = 32-Bit 3. Does your application only need Java Heap smaller than 2 GB? (Similar to) Yes = 32-Bit on 64Bit OS No = 64-Bit 4. Your application does not require 64-Bit features, but is it deployed on a 64-bit operating system? Yes = 32-Bit No = 64-Bit 5. The most important thing is that, in other cases, a 32-Bit JDK is used on a 32-Bit OS.

 

Summary

This article introduces the 32-bit and 64-bit systems, and introduces the common JVM 32bit and JVM 64bit, and makes comparative analysis. Although the 64-bit system can access more memory, operations on larger file and disk management, but in many cases the performance may not be better than the 32bit system, especially the JVM.
Therefore, I think: in project implementation, the database server can be deployed on a 64-bit operating system, but the application server cannot be generalized. To achieve the best performance of the application, test the Application Deployment environment to evaluate the potential performance improvement caused by the conversion to 64-bit, and then decide whether to deploy the application on JVM 32bit or JVM 64bit. However, unless the application requires a large amount of memory and exceeds 2 GB, and the physical memory of the corresponding server exceeds 4 GB, the JVM 32 bit should be given priority.

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.