[haiku] Re: Kernel mode and user mode

  • From: "Jonas Sundström" <jonas@xxxxxxxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Mon, 26 Jul 2010 22:05:38 +0000

Miroslav Stimac "Miroslav Stimac" <Miroslav.Stimac@xxxxxx> wrote:
 ...
> http://ezri.nextraweb.com/files/haiku/svg/kernel-diagram-new.png
 ...
> Only the components in the green box run in kernel mode?

Yes.

> If this is so, what is the box "Kernel" in the big orange
> area with the labels Kits and API?
> This is not the kernel of Haiku because it is in user mode,
> or?

The Haiku C/C++ application programming interface (the API) is
divided in kits. One of these kits is called the "Kernel Kit".

The kits are implemented in shared code libraries, available
to C/C++ applications and stored in /boot/system/lib.
They correspond roughly to the system servers,
stored in /boot/system/servers.

The assymetry in the kits/API section of the diagram at the URL
above, is meant to describe that the kernel kit and posix
functions generally interface the kernel (directly) whereas 
some of the other kits are seen as interfacing system servers.
(In reality its not quite that clear-cut.)

The kits are described in the BeBook
http://www.haiku-os.org/legacy-docs/bebook/index.html
(two parts: overview + reference)

> Or are there some parts of the kernel that run in the user mode?

Haiku has a conventional modular kernel, close to e.g. Linux or 
FreeBSD in design. Device drivers are loaded and run in the kernel.
(Haiku does not aspire to be microkernel based.)

Graphics drivers are the exception. They're split in a kernel part
and an app_server add-on part. The latter is called an "accelerant".

There are also experimental(?) userland filesystem facilities.

> In general, could you please tell me how I can see which process
> or thread runs in what mode (user mode or kernel mode) in Haiku?
> Is there a special command that shows me all of them?

Open Terminal and type "ps -a". Or use ProcessController.
All threads of the kernel_team run in kernel mode.

(You won't see device drivers here, as most(?) device drivers
are purely interrupt-driven and thus don't have any threads.
Their code gets executed nevertheless. Some spawn helper threads
though.)

/Jonas.


Other related posts: