I am aware of the difference between a process running in user mode and one running in kernel mode (based on access restrictions, access to hardware etc.). But just out of curiosity, what is the difference between a process running in kernel mode and one running as root?
问题:
回答1:
kernel mode and root are two separate ideas that aren't really related to each other. The concept of running a process as root is a unix/linux term that means you're logged in as the administrator of the system.
Any process you run, whether as root or a normal user, generally runs in both user mode and kernel mode. The system is continually switching between user mode (where the application code runs) and kernel mode (where the kernel code runs).
Some programs, like many device drivers, always run in kernel mode, meaning they have full access to the hardware. A normal application running with root privileges still exists in user mode and only switches to kernel mode when a kernel system call is made and then switches right back to user mode.