System level software in C# ?

  • Thread starter Thread starter MrAsm
  • Start date Start date
M

MrAsm

Hi,

Is it possible to write system level software in C#?

(Of course, I'm not thinking about HAL.)
But would be C# OK to write an OS kernel?
....Or a web browser?

Thanks in advance
MrAsm
 
hi,
Web browser.. hmm check out the web browser component in .net 2.0.
 
Not really as C# is a high level compiler. If you really really wanted to
you'd have to create an OS kernel first in some other language to support
the C# code. I guess you could create a cross-compiler which would allow you
to create the C# code which is then converted into the lower level code
which an OS runs.

Keep in mind that on your PC C# is executed via the .NET engines which run
off the Windows engines which run of the computers BIOS. That's a lot of
functionality to replace.
 
C# was not made for system level developing. You can do advanced
things with it (like call low-level Win32 API functions, make windows
services, attach to global events, and etc.), but due to its "virtual
nature", stay out from it when considering system level software
development.

Maybe, and only maybe, Vista brings this feature because it's better
interconnected with .NET (http://www.grimes.demon.co.uk/dotnet/
vistaAndDotnet.htm)

MrAsm je napisao/la:
 
Web browser.. hmm check out the web browser component in .net 2.0.

Is the web browser component in .NET written entirely in C#, or is it
a wrapper around a COM component written in C++?

MrAsm
 
OS kernel? I suppose that depends on what kind of
hardware you want that kernel to run on, and what you expect it to do.
I'd say generally the answer would be "no", but I can imagine some very
simple "OS kernel"-like projects where C# would probably work fine.

Why do you ask?

Because I'm studying C# and I like it very much, and I'm interested in
the "scope" of the language; while I think it's fine to write apps in
C#, I was interested to understand if it is OK also to write more
low-level software using it.

I read about an experimental C# OS called Singularity.

MrAsm
 
MrAsm said:
Is it possible to write system level software in C#?

(Of course, I'm not thinking about HAL.)
But would be C# OK to write an OS kernel?
...Or a web browser?

I am not sure I will call a web browser for system level software.

You can definitely write a browser in C# even though I am not
aware of anyone doing so.

An operating system will require some native code but huge
parts could be done in managed code.

Checkout http://en.wikipedia.org/wiki/Singularity_(operating_system)
for what can be done.

Arne
 
It's a wrapper.

Tons of C# components are just wrappers around good-ole COM.

As for the system-level - well, you can work with files, registry, network,
web, comm. ports, write a service, create a process, create threads, do some
fancy graphics, etc.

You most likely won't be able to write a brand-new OS in C#, since any .Net
app will require CLR, which in turn will require Windows. You can probably
write some OS that will run inside Windows, for an exercise.
 
It's a wrapper.

Tons of C# components are just wrappers around good-ole COM.

Thank you for these information.

I think that it does make sense for Microsoft engineers to reuse
alread developed and tested COM C++ components, wrapping them in C#.

However, I wonder if it would be possible to write these components
from scratch in C#, or if there would be performance problems that
force to use C++.

MrAsm
 
[...]
However, I wonder if it would be possible to write these components
from scratch in C#, or if there would be performance problems that
force to use C++.

In general, there should be no performance problems. There's some
overhead in using .NET Framework, but for something like a web browser,
it's likely that the user would never notice the difference. The
advantages of using the .NET Framework (rapid development, code
correctness and security, etc.) would outweigh whatever performance loss
one gets.

Pete
 
Is it possible to write system level software in C#?

(Of course, I'm not thinking about HAL.)
But would be C# OK to write an OS kernel?
...Or a web browser?

Web browser for sure. OS kernel? I suppose that depends on what kind of
hardware you want that kernel to run on, and what you expect it to do.
I'd say generally the answer would be "no", but I can imagine some very
simple "OS kernel"-like projects where C# would probably work fine.

Why do you ask?

Pete
 
I think that it does make sense for Microsoft engineers to reuse
alread developed and tested COM C++ components, wrapping them in C#.

However, I wonder if it would be possible to write these components
from scratch in C#, or if there would be performance problems that
force to use C++.

C# code should perform as good as C++ code.

And the code quality would likely be much better.

But you do not rewrite hundreds of thousands of lines
of code unless you really have to.

Arne
 
But you do not rewrite hundreds of thousands of lines
of code unless you really have to.

Arne

Sigh...

That's exactly what our company currently does - rewrite hundreds of
thousands of 20 year old, absolutely unreadable C++ code into C#. It's a
nightmare. And the worst part is that there's no real reason for that - the
old code works... :(
 
Sigh...

That's exactly what our company currently does - rewrite hundreds of
thousands of 20 year old, absolutely unreadable C++ code into C#. It's a
nightmare. And the worst part is that there's no real reason for that - the
old code works... :(

But maybe the C++ is hard to read/mantain, so rewriting it in quality
C# is an investment for the future.

MrAsm
 
Ashot said:
Sigh...

That's exactly what our company currently does - rewrite hundreds of
thousands of 20 year old, absolutely unreadable C++ code into C#. It's a
nightmare. And the worst part is that there's no real reason for that - the
old code works... :(

You should be happy to work for company that actually prioritize
code quality over cost (read: cost in this fiscal year).

But maybe you prefer C++ ? :-)

Arne
 
MrAsm said:
But maybe the C++ is hard to read/mantain, so rewriting it in quality
C# is an investment for the future.

MrAsm

The code is based on some pre-historic C++ library for Windows - not MFC,
not OWL, but ZApp. Ever heard of it? :)

I am actually happy that that part of the codebase is being thrown out. If
only if didn't take sooooo long... Here's the problem: the code itself is
the product's specification. Can't understand what the heck it's doing -
well, tough luck... :)
 
Arne Vajhøj said:
You should be happy to work for company that actually prioritize
code quality over cost (read: cost in this fiscal year).

But maybe you prefer C++ ? :-)

Arne

No preference there, just a good code over a bad one... :)
 
Ashot said:
The code is based on some pre-historic C++ library for Windows - not MFC,
not OWL, but ZApp. Ever heard of it? :)

Never heard of that.
I am actually happy that that part of the codebase is being thrown out. If
only if didn't take sooooo long... Here's the problem: the code itself is
the product's specification. Can't understand what the heck it's doing -
well, tough luck... :)

Heard of that ! :-)

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top