Page 1 of 1
Microkernel, Memory Manager: Kernel Mode VS User Mode
Posted: Tue Jan 01, 2013 12:33 am
by zeitue
For speed purposes is it better to have the I/O memory and the virtual memory in user mode or kernel mode?
what are the advantages and disadvantages of both?
Thank you
Re: Microkernel, Memory Manager: Kernel Mode VS User Mode
Posted: Tue Jan 01, 2013 8:09 am
by Brendan
H,
zeitue wrote:For speed purposes is it better to have the I/O memory and the virtual memory in user mode or kernel mode?
what are the advantages and disadvantages of both?
In general; the advantages of having something in user mode is that the rest of the OS is better shielded from bugs in that thing and it's easier to replace that thing while the OS is running; and the disadvantages are that it costs some performance because you have to do task switches to use it and it can be a little more work to design/implement.
For something like a virtual memory manager; if there's bugs in the virtual memory manager then anything can get messed up anyway; replacing it while the OS is running is excessively messy and error prone; the extra overhead can have a significant effect on overall system performance; and it's a lot harder to figure out things like how page faults get sent using IPC and how to allow a process to examine/modify a completely different process's page tables, etc.
Basically, the advantages of putting something in user space don't really apply for a virtual memory manager, and the disadvantages are worse than they are for other things.
Of course you can break pieces off of the virtual memory manager and run some of those pieces in user space. For example, for memory mapped files the virtual memory manager can send requests for reading/writing data to a virtual file system layer in user space, and you can have something like a "swap space manager" in user space (where the virtual memory manager asks the swap space manager to store and retrieve pages of data).
For IO memory, I'm not too sure exactly what you mean (the IO memory itself is in hardware and therefore isn't in software). I would have a "device manager" in user space, which is responsible for using PCI configuration space to determine which devices use which memory mapped IO areas (and is also responsible for starting and monitoring device drivers); where the device manager tells the virtual memory manager which processes/drivers are allowed to access which memory mapped IO areas.
Cheers,
Brendan
Re: Microkernel, Memory Manager: Kernel Mode VS User Mode
Posted: Wed Jan 02, 2013 1:07 am
by zeitue
@Brendan Hi, thanks for the reply and information.
You probably give the best answers on here from what I've seen
sorry I wrote I/O Memory while thinking of Physical Memory.
For my new OS I think I'll keep the memory management in the kernel mode instead of user mode.
Would process management be somewhat like this as well?
Currently in my new OS design I have a Process manager/server that will handles process ID, group ID, signals, fork, and exit
In addition I'm going to have a Execution manager/server that will load and link executables and handle a byte code format.
Re: Microkernel, Memory Manager: Kernel Mode VS User Mode
Posted: Wed Jan 02, 2013 1:11 am
by bluemoon
Some people put the context switch in kernel space for performance, while the scheduler (task picker) that handle load balancing and policy may be a user-space server.
Re: Microkernel, Memory Manager: Kernel Mode VS User Mode
Posted: Thu Jan 03, 2013 8:51 am
by zeitue
@bluemoon thank you that makes perfect sense.
I'm thinking that a of things can be split up besides just the process and memory management.