Difference between 64 bit vs 32 bit Machines

Difference between 64 bit vs 32 bit Machines

32 Bit v/s 64-Bit Terminology

You often hear these terms when you talk about computers or other machines. To understand this better, let's unfold a few basic words before:

  • Bit: A bit is a binary digit. It is the basic unit of information in computers. It can hold either 0 or 1.
  • Bytes: Computers use blocks of 8 bits called bytes to represent an address in memory. This is the smallest addressable unit of memory.
  • Word Size: Every computer has a defined word size that refers to the maximum number of bits (0s & 1s) the CPU can hold and manipulate in a single instruction. It is an essential parameter for processor design. Most modern computers have a 32- or 64-bit word size.
  • Virtual Address Space is a set of all possible byte addresses. A machine with 4 GB RAM can have byte addresses ranging from 0 to 4 * 1024 * 1024 * 1024 - 1.

Memory (RAM) uses single words or fractions of a comment to represent the address of a pointer data. So, the largest address that can be represented determines the maximum size of the virtual address space. Thus, a machine with a word size of w-bit can have memory addresses from 0 to 2^w - 1. A 32-bit CPU can have 2^32 - 1, i.e., 4 gigabytes of addresses, while a 64-bit CPU can have 1.84 x 10^19 bytes. This also means a 32-bit computer cannot use physical RAM of more than 4 GB.

32-bit machines were dominant from around 1980 to 2010 and have transitioned to 64-bit machines since then. Since 64-bit machines can utilize more RAM, resource-consuming tasks can be done more efficiently and faster.

Can programs run across different word-size machines?

Compatibility of a software program is determined by the machine on which the program was compiled. Programs compiled on 32-bit machines are called 32-bit programs, and those compiled on 64-bit machines are called 64-bit programs. 64-bit machines can run 32-bit programs with almost full compatibility, but a few edge case bugs have arisen while migrating old programs to new 64-bit machines.

The number of bytes allocated for some data types can also vary with word size in C language. I have listed data types with different byte allocations for 32 & 64-bit machines, while Other C data types allocate the same number of bytes for both machines.

C declarationBytes (32-bit)Bytes (64-bit)
long48
char*48

Sources

Be first to comment

Leave a reply