I would like to say this answer is somewhat misleading because it only discusses
the kernel, but then the question also wasn't very precise.
There are really two questions:
1) Is the kernel 32-bit or 64-bit?
2) Is the userland (applications) 32-bit or 64-bit?
On both x86 and ARM, you can have:
A) A 64-bit kernel with a 64-bit userland
B) A 64-bit kernel with a 32-bit userland
C) A 32-bit kernel with a 32-bit userland
D) A 64-bit kernel with both 64-bit and 32-bit userland
Because both x86 and ARM 64-bit processors also natively understand 32-bit
instructions, this is quite possible.
You can use "file /bin/bash" as a rough estimation for what kind of userland you
have. For instance:
/bin/bash: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=0b6b11360e339f231f17484da2c87d0d78554e31, for GNU/Linux 3.2.0, stripped
So now you might ask: why would I have a 64-bit kernel with a 32-bit userland?
There are several reasons for this.
One is that you need to run 32-bit binaries. This came up quite a bit in the
early days of x86_64. Modern Debian, for instance, has "multiarch" support and
is quite capable of having 32-bit libraries installed alongside 64-bit ones.
Such a system can run binaries from both.
This 32/64 situation is routine on the Raspberry Pi. Starting with the model 3,
they are all 64-bit capable but kept a 32-bit userland until just recently.
That maintained compatibility across boards. On Debian, you'd run a 64-bit
kernel for those 32-bit binaries. In fact, I recently discussed this on my blog
at
https://changelog.complete.org/archives/10622-live-migrating-from-raspberry-pi-os-bullseye-to-debian-bookworm
The 64-bit kernel is capable of accessing the full 64-bit address space, but the
32-bit processes remain limited on how much memory they individually can access.
Still, collectively across the entire system, the processes can use more than
4GB of RAM without weird tricks.
Incidentally, with qemu binfmt support, it is, in fact, possible on Debian to
transparently run binaries for entirely unrelated architectures on a single
system through emulation.
- John