Alberich wrote:
Well, so user malloc stays on user space: so when i load a process i tell the linker to link with this malloc no?
And kernel won't need a something like kmalloc?
Well, whether you need kmalloc depends on whether you need to do dynamic allocation in your kernel. There are designs which don't need a kmalloc, but it's a lot easier if you have one.
In any case, you should separate two concepts:
- page management (VMM)
- block management (malloc)
A linker-loader doesn't really need a malloc at all. It just needs pages of memory to put the different segments. The malloc that an user process will use is just a normal library procedure (which might want to make system calls for more memory to manage but that's it).
This isn't actually any different from a monolithic kernel.
Wich parts of mm should be in user space? if i haven't read this i will try to put it all on kernel space. Which is the advantage of map kernel in all addresses space? is something about performance, so kernel won't need to load/change pagedir for example?
Well, the classic idea of a microkernel is to put as much as possible into user space. You want manipulation of the actual hardware page tables in kernel space, I guess, but other than that's it's up to you how much you want to try to get into userspace.
Typically paging would be the first to go into userspace, but where you put the line is really up to you.
As for mapping kernel in every address space: yeah, switching page directories is rather expensive especially on IA-32, thanks to TLB flushes.
a ring level change is so slow isn't it? Is there some way to avoid it, in adition with the rl change we have ipc wich pass a message ( so copy memory )..more performance hit in the system?
You can't really avoid the normal system call overhead, but just switching ring level (usually doing software interrupt) isn't terribly costly. Remember that you are doing this every time you get an interrupt anyway.
If you are concerned about speed, then the trick is to perform as much useful work per system call as possible, while trying to trash as few caches as possible.