title: How does the kernel know if the CPU is in user mode or kenel mode?
body: <p>Since the CPU runs in user/kernel mode, I want to know how this is determined by kernel. I mean, if a sys call is invoked, the kernel executes it on behalf of the process, but how does the kernel know that it is executing in kernel mode?</p>