Reading that question, I'm not sure what you're asking.
Are you wondering how exec works inside the kernel, because you're writing some kernel code that needs to change how it works, program something similar, etc.? If so, that's clearly for Stack Overflow.
Are you asking as a sysadmin who's vaguely familiar with how the C interface works, and is worried that set user ID might be a race condition, or is just confused that it appears magic? Then that's for us.
I'm not sure which you're asking from your question. I'd guess that's also part of why it's been ignored on Stack Overflow.