UNIX was developed originally on a DEC PDP-7.
I'm not a PDP-7 assembly language expert but there's many instructions that take action if the accumulator is 0. So if a specific UID value has to be special, it's probably easiest and fastest for that value to be 0.
https://dn710100.ca.archive.org/0/items/bitsavers_decpdp7PDP...
For newer CPUs, though (which I am familar with):
Many other CPU architectures have a "Z flag." This is a bit in a status register that's set if the last value encountered is a zero. So you can do something like this:
LOAD_ACCUMULATOR uid_value
BRANCH_IF_EQUAL somewhere
The BRANCH_IF_EQUAL instruction (actually BEQ in a few instruction sets) typically branches if that Z flag in the status register is zero. Some instructions on some CPUs reference the Z flag for what it is directly, like DJNZ on Z80 and I think x86 (Decrement and Jump if Not Zero).If you want to test if a value is something other than zero, then you have to do this:
LOAD_ACCUMULATOR uid_value
COMPARE_ACCUMULATOR something
BRANCH_IF_EQUAL somewhere
The COMPARE_ACCUMULATOR instruction (actually CMP in 6502 and similar in other instruction sets) subtracts "something" from the current value of the accumulator, but doesn't save the result, BUT sets the flags, including that important Z flag.So it takes more instructions on many CPU architectures if the special value is not zero. This isn't limited to root being UID zero, it's also why "end of string" is zero and zero is a sentinel value in general.
There's some further reading on Stack Exchange. [1]
1. https://superuser.com/questions/626843/does-the-root-account...