Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
So, I got usermode working...
anyway...
Because when you move into usermode you get everything including the kernel code after the call switched, why not fork() the kernel?
Does anyone see a problem with this form of code?
int ul;
if(!(ul=fork())) MoveToUserMode(); //Creates a second kernel process, one in usermode
if(!ul){
//Usermode
execute_init; //Note: The actual code for these are long asm() commands
exit;
}
if(!ul){
//Usermode kernel
for(;;) delay(100); //Sleeps for a second and repeats (basically do nothing for now)
} else {
//Kernel mode kernel
for(;;) schedule();
}
piranha wrote:Because when you move into usermode you get everything including the kernel code after the call switched, why not fork() the kernel?
If there's anything in the kernel that can run at CPL=3, then it should be removed from the kernel and put into a library or something. That leaves a total of zero bytes of kernel code that's actually useful at CPL=3 ..
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Actually, I don't agree with you on that. Some functions normally handled by a kernel could actually be done in user mode, whilst it would be still an advantage to have them close to the kernel. Things like drivers higher up in a driver stack that do not call hardware directly (ie do not use ports or listen to interupts in a direct way, only through some lower (bus) level driver)