I would like to know how a kernel programmer thinks about memory vs user mode programmer. I would also like to know a few differences between kernel programming and user mode programming.
User mode programming refers to programming under the protection, supervision, and abstraction mechanisms of the operating system kernel. e.g: in user mode you can't write disk sectors, as they are "hidden" under the file system APIs. You can't write to physical memory addresses, as the kernel is in control of translating between virtual and physical memory, altough you can reserve memory for your own needs. Also, altough you can go low level (assembly) you can't execute instructions that are privileged, for example, trying to mess with processor caches, TBLs, and MMU.
Kernel programming allows you to program the system for low-level duties without any restriction. Hardware drivers for example cannot be programmed under user mode since they need to access hardware directly to do I/O, map memory regions,etc.
Of course you can't think kernel-mode as "less restricted" and go to develop applications in KM. Many system facilities for application programming are not available under KM, as the libraries required to interact with the user run in usermode. Also, those usermode libraries won't link to a kernel module.
This distinction may be more or less defined depending on the operating system. KM/UM is a nonsense in DOS, where programs were allowed to access system resources freely (at least in 8086/88 real mode -- this is not the case with DOS Extenders).
See Jeffs article on Understanding User and Kernel Mode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With