[haiku] Re: nv_driver in kernel mode, but media kit not?

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Sun, 25 Jul 2010 14:56:12 +0200

On 2010-07-25 at 14:19:09 [+0200], Miroslav Stimac <Miroslav.Stimac@xxxxxx> 
wrote:
> I found an interesting diagram:
> http://ezri.nextraweb.com/files/haiku/svg/kernel-diagram-new.png
> 
> According to this diagram, the nv_driver (is this the NVidia graphic 
> driver?) runs in kernel mode.
> 
> Is this really so?

Yes. "Run" is not quite the right word, though. Graphics cards drivers (and 
a lot of others) don't actively run. They normally just provide a set of 
functions that are called by the kernel and (indirectly) by the userland.

> Of course, this may have advantages in performance because no context 
> switch between user mode and kernel mode is necessary.

Most drivers play directly with hardware, which requires a higher privilege 
level. There would be ways around that (like only having a stub in the 
kernel and the rest in userland), but that makes things more complicated and 
doesn't help performance.

> However, I am a bit surprised.
> Why does the nv_driver run in kernel mode, but the media kit not?
> Wouldn't it be better from the point of view of performance if both would 
> run in kernel mode?

The media kit is an API for userland applications, so most of it would need 
to remain in userland. Media server and media add-on server could probably 
be moved into the kernel. Whether that would result in a measurable 
performance benefit I cannot say. It wouldn't, however, contribute to the 
overall system stability. When the media (add-on) server crashes that is 
annoying at worst, a crashing kernel is a show stopper.

> BeOS is also called the Multimedia OS.

That's just a marketing buzzword.

> Therefore I am wondering why the 
> media kit does not run in the kernel mode. Are the risks regarding viruses 
> and stability too big?

I don't know of any BeOS virus. Stability is a concern. One doesn't move 
code into the kernel unless there are clear needs or benefits to rectify 
that. I'm not aware of any performance problems that would likely be solved 
by such a step.

CU, Ingo

Other related posts: