differences between kernel and user processes!

Jincuteguy

Senior member
Apr 25, 2003
380
0
0
Does a user process or supervisor (kernel ) process have higher performance? also how are they differeces in performance? thx.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
You'd have to look up fundamentals in OS design to figure that one out.

But, hey.

I'd look up the differences between a monolithic kernel design (linux) vs a micro kernel (mach, like used in OS X).

From what I understand running everything in userspace is what micro kernel is about. The kernel only incepts the signals from each driver (or what ever) and redirects them to each other.

A monolithic kernel want's to control everything the OS needs to interact with all the hardware and stuff.

A monolithic kernel is suppose to be faster vs a micro kernel. But a micro kernel is suppose to be more versitile and stable. They've always figured you could design around Micro kernel's limitations and make it as fast as Monolithic kernels. Trouble was (As I figured it) that people kept making monolithic kernels faster, too.

But according to the Unix design ideas that versitility/portability > speed. So a Microkernel should be a more ideal kernel design.

Micro kernels for a long time have been considured the future by computer scientists and acadamia. However Linux chooses a quite conservitive design in many ways and thus was considured quite a bit backward and obsolete for a long time, but it is still a commercial success compared to other kernel designs. Go figure. Sometimes worse is better. :p

I learned this from a infamious discorse between Linus and Tanenbaum

That's about all I know...

The most interesting part was that even though Tanenbaum spent his life studing operating system design, and was probably quite correct on many technical issues (hell if I know), he was still mostly completely wrong on everything else.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Performance differences would be negligable in most cases. Kernel threads could save some time by avoiding some memory copies, mainly because when a user process calls into the kernel to do something the data has to be copied from the user address space into the kernel address space, if the process is already in the kernel address space that wouldn't have to happen.

Also it depends on the behaviour, a poorly behaved kernel process can make the entire box useless where as a bad process will only be able to slow the box down a bit and if it gets too out of whack it'll just get itself killed. Generally you have to be a lot more carefull when writing kernel code because of all the damage that can be done so if there is any performance benefit to be had it's not worth the time you have to spend combing code.
 

NogginBoink

Diamond Member
Feb 17, 2002
5,322
0
0
Most all processes on an NT machine flip flop into and out of kernel mode as they run.

There are only two processes that run entirely in kernel mode: the System process, and (I believe) the system idle process.

Performance is dependent upon many, many things, of course. But one of the big items is how often you must switch from kernel mode to user mode or vice versa. It's an expensive operation (I hear ~1000 instructions or so).

But, if you want to read from disk, ultimately you have to access hardware, so that has to be done in kernel mode. So your app calls readfile() which kernel32.dll traps with an int 2E wich causes a call to KiSystemService which is in kernel mode and dispatches the call to NtReadFile()

I'm not sure that it's possbile to create a new process that runs entirely in kernel mode. (Although I do believe you can create a new thread in the System process if you're doing so from kernel mode... which basically means you have to write a device driver.)