Differences between 32-bit and 64-bit machines

Source: Internet
Author: User

We usually hear about the differences between 64-bit and 32-bit machines and 64-bit software. In fact, a complete 64-bit computer applicationProgramIt should be like this:

The computer's CPU is 64-bit, that is, the computer's Hardware supports 64-bit, then the computer's system is 64-bit, and finally the application is also 64-bit. In this way, my application runs in 64-Bit mode. Only in this way can I truly use 64-bit.

The number of digits in a computer is the maximum number of digits that the CPU can process at a time. If it is 32 bits, it indicates that the Register and addressing bus are 32 bits, that is, 32 bits can be extracted at a time (4 bytes, 32bit = 4 byte ). The maximum virtual memory it can use is 2 ^ 32, that is, the size of 4 GB. Therefore, 32-bit CPUs have about 4 GB memory addressing space. Later, because 4 GB of virtual memory space was gradually insufficient, 64-Bit personal computers appeared slowly (64-bit computers were already used in large computers and workstations long ago ), 64-bit means that both registers and the addressing bus are 64-bit. The emergence of a 64-bit architecture effectively increases the memory ceiling to 2 ^ 64 address, 16 EB memory. (1eb = 1024pb, 1pb = 1024 TB, 1 TB = 1024 GB ).

The change from 32-bit to 64-bit architecture is a fundamental change. Most operating systems need to be comprehensively modified to fully utilize the 64-Bit performance. The previous application software also needs to be modified to apply its new performance (from Baidu encyclopedia ).

Generally, a 64-bit operating system supports both 64-bit applications and 32-bit applications. If we reference a third-party component in the project, and this third-party component is divided into 32-bit and 64-bit, If we deploy it in the previous way, some functions are not available on 64-bit machines. Theoretically, there are two ways to solve this problem. One is run in true 64-Bit mode, and the other is run in false 64-Bit mode.

True64Bit mode:

The so-called true 64-Bit mode, that is, during compilation, all projects are compiled in anycpu mode. If a third-party component is used, the entire program will be divided into two versions, if you use the 3rd-side SQLite component and want to run it in real 64-Bit mode, you need to package the project into two versions, one of which is the version installed on 64-bit, the referenced SQLite must also be 64-bit. The other version is deployed on 32-bit, And the referenced SQLite is 32-bit. After compilation, this is only the first step. Step 2 (this step is for projects that use WCF), start IIS on 64-bit machines, create an application pool, and set the properties of this application pool, set "enable 32-bit application" to false (the default value is false), and then set the WCF application pool to the application pool you just created.

In this way, you can view the WCF Service in the browser. However, an error occurs when the program is running.

"Badimageformatexception is thrown when you try to load the Oracle client library. If the 32-bit Oracle client component is installed and runs in 64-Bit mode, this problem occurs"

This error occurs because I have installed a 32-bit Oracle server and the client is also 32-bit. If the 64-bit Oracle server and client are installed, this problem should not occur. In this way, the entire application runs in the real 64-Bit mode.

Later I thought, could I directly connect to a 32-bit replicel server? Download a 64-bit client and connect to a 32-bit server. In this way, the entire program runs in 64-Bit mode, except that the database server is not 64-bit.

This method does not solve two problems, so I did not try it at last.

First, the 64-bit client is not downloaded, and all the links on the Internet are invalid. In addition, due to my slow speed, the Oracle Website Cannot log on, so I gave up.

Second, I have not tested whether a 64-bit Oracle client can connect to a 32-bit ORACLE Server? I have not found any answers to this question on the internet, and I have never tried it.

So the plan to run in real 64-Bit mode had to be abandoned. Try again later.

False64Bit mode:

The so-called false 64-bit, that is, running the program in 32-Bit mode on a 64-bit machine, no matter whether your program references any third-party components, there is no problem, you just need to change the compilation method. For all third-party components that reference SQLite, we only need to reference 32-bit SQLite, but we need to change the compilation method of the project that references this component to x86 for compilation. (Note that all other projects that reference this component must run in x86 mode ).

When deploying a WCF Service, select an application pool for WCF (you can use the default application pool or create an application pool by yourself). However, note that, set the "enable 32-bit application" attribute of the application pool to true (opposite to the preceding)

In this way, the entire application can run.

Anycpu, x86, x64Different compilation platforms (for personal understanding ):

We know that during project compilation, the compilation platform has three options: anycpu, x86, and x64. The default value is anycpu. What are the differences between them? Here is a brief introduction:

We know that. the applications developed under the. NET platform, after compilation, become an intermediate language called "Il" (similar to the bytecode in Jave). During execution, through the Real-Time Compiler (JIT), and then convert the Il to the binary that can be executed by the corresponding CPUCode.

If the program is compiled with anycpu, the JIT will generate the corresponding binary code no matter which computer the program is deployed on, A 32-bit CPU generates 32-bit binary code, and a 64-bit CPU generates 64-bit binary code.

If the program is compiled in x86 mode, the JIT will convert the Il code into the binary code executed by a 32-bit CPU no matter which computer the program is deployed on.

If the program is compiled in x64 mode, the JIT will convert the Il code into the binary code executed by 64-bit CPU no matter which computer the program is deployed on.

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.