I'd like to ask you what is CPU architecture, in an oversimplified way. I'm learning node.js and recently I saw a code
console.log(os.arch()). The result was x64. What does that x means? Thank you!
I'd like to ask you what is CPU architecture, in an oversimplified way.
This question isn't relevant to this Stack Exchange community, but I will try answer it before anyone flags or closes this question.
A CPU architecture is basically a name for the design of a CPU; If many CPUs support the same features then it can be said that those CPUs share an 'architecture'. It is especially useful to programmers to know that they can write code once that will run on all CPUs that implement that architecture.
os.arch() function will usually return one of these two architectures on a PC:
The 'x' in 'x86' is a sort of wildcard to represent any CPU from a family of CPUs which all shared a similar design & instruction set. One such CPU was the Intel 80486, which is where the '86' comes from. Thus, 'x86' was adopted to refer to CPUs that implement this common architecture.
Later on when AMD introduced 64-bit CPUs, they initially called this architecture amd64, but then Intel came up with their own design and soon the 'x64' term was invented to refer to 64-bit CPUs in general.
The purpose of the
os.arch() function is to identify the CPU architecture that your node application is running on.