Sorry my answer was perhaps a bit aggressive. I tend to get a bit...
unsettled as I hear very often  "C++ is crap and a nonsense in the
kernel" from people who never seriously studied the language.

I wrote several drivers in Windows NT using C++/STL/Boost and they had
excellent performances and reliability.

 The first driver was a test driver to read whatever memory you want
on your system, ie, you give a process and a virtual address, and the
driver will copy the memory (if the address if valid) bypassing all OS
protection.

The other driver was a mini-file system to demonstrate the benefits of
the STL in terms of concision, performance, security and reliability.
There is no possible buffer overflow in the code. Granted, buffer
overflows are not the only security issue that exists.

I also modified an existing cryptographic filter driver to use
std::vector and it worked flawlessly (no performance change). I have
not pushed the changes further as I lacked time to validate the
non-regression.

My personal experience with smart pointers in kernel mode is also good
as it saves the stack and prevents unneeded allocation. However it
breaks when you need to give the pointer to a callback (you need to
manually add a reference or do something of the like).

The main advantage of C++ in kernel mode is the increased verification
by the compiler. In using intensively templates, type traits, static
assertions and lambda functions you can have a certain degree of
static code verification. You also have a very high reusability.

I have not done C++ drivers in BSD for the moment. I wrote two FreeBSD
drivers in my whole life so I have less experience with the whole
"chain".

If I had to start a new OS, I think I would write the micro-kernel in
C++ (and assembly where needed). Give a powerful template API to talk
to this micro-kernel. Then there would be a higher level part written
in a lisp-like language for all the formal verifications. This part
would not necessarily run in kernel-mode (benchmarks would tell). This
is just a complete improvisation as I never actually gave it some
serious thoughts, again, time is missing. ;)

-- 

Die Gestalt


On Fri, Mar 7, 2008 at 2:22 PM, Otto Moerbeek <[EMAIL PROTECTED]> wrote:
> On Fri, Mar 07, 2008 at 01:16:16PM +0100, Die Gestalt wrote:
>
>
> > I don't think it is relevant or even polite to question one's
>  > abilities when discussing technical matters.
>  >
>  > If you have a point to make, please proceed.
>
>  You state an opinion without backing it up by referring to either
>  existing projects or by personal experience.
>
>  I do not know any succesful project using "template style C++" and
>  functional languges for OS development, so I'm asking if you have any
>  experience using these for OS develpment.
>
>         -Otto
>
>
> >
>  > >  Have you ever been involved in OS design and implementation?  And I do
>  > >  not mean academic exercises, but a real world project producing actual
>  > >  working stuff.
>  > >
>  > >         -Otto

Reply via email to