Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is .NET's relation to the Windows Kernel/OS & other OS's

Tags:

c++

c#

.net

winapi

I am confused as to what exactly .NET actually is. I am a Computer Science student who has done a lot of Win32 (WinAPI) programming in C++ & have a pretty good understanding of how Win32 functions interact with COM & the Windows Kernel itself.

But where does .NET fit into all this?

  • Specifically, if Win32 is an API written in C, what is .NET? Is it an API written in C also? Does it only run on Windows OS like Win32?

  • Does .NET run on top of the Win32 API? For example a .NET function showWindow() (I made that up obviously) call Win32 functions behind the scenes to show the window or does it go directly to the Kernel to do this? Or is .NET like the Java Virtual Machine?

  • Does .NET interact with the Windows Kernel directly (like Win32) & interact with COM objects? Does .NET run in a sandbox & not allow some access to certain OS areas?

  • I can code in different languages using the Win32 API such as c/c++, VB, Perl. What languages can I code in .NET?

  • This is what really stumps me. I hear about web applications written in .NET? What, how, wha? What language is it written in? Does .NET run on top of IE? Do .NET web applications work on Firefox or on Safari(MacOS)? Is a .NET web app like a java applet, do you get .NET drive bys too.

like image 708
user593747 Avatar asked Sep 15 '11 09:09

user593747


People also ask

What is the kernel of Windows OS?

The Microsoft Windows kernel provides basic low-level operations such as scheduling threads or routing hardware interrupts. It is the heart of the operating system and all tasks it performs must be fast and simple.

What is the difference between Linux kernel and Windows kernel?

The main difference between Windows Kernel and Linux Kernel is that Windows kernel, which is in Windows Operating System, is a commercial software while Linux Kernel, which is in the Linux Operating System, is an open source software. The kernel is the core of the operating system.

Is Windows written in C#?

In the case of windows, there is a bit of a mix of three programming languages that they used to develop their OS. The mixture of languages involved C, C++ and C# where the first two were used to develop the most of the legendary code, while C# has been used in fairly recent upgrades, like .

Does Windows use monolithic kernel?

NT-based Windows is classified as a hybrid kernel (or a macrokernel) rather than a monolithic kernel because the emulation subsystems run in user-mode server processes, rather than in kernel mode as on a monolithic kernel, and further because of the large number of design goals which resemble design goals of Mach (in ...


2 Answers

Some brief answers to keep you going:

Specifically, if Win32 is an API written in C, what is .NET? Is it an API written in C also?

.NET consists of multiple parts. One part is called the CLR. That part is written in C++, C++/CLI, and some assembly. This is responsable for Running the .NET appplications. The Just-In-Time (JIT) Compiler is an important part of this.

Then there are the included libraries. These are mostly written in C#, but some of them presumably have parts written in C++/CLI. You can actually get the source code for many of the included libraries.

Does it only run on Windows OS like win32?

Also no, there is a port that runs on Linux (called Mono), there is the version that runs on WIndows Phone 7, and then there is Silverlight which also runs on Macs....

Does .NET run ontop of the win32 API?

To a large degree, yes, although in some places it is starting to replace the regular WinAPI (it was certainly Microsoft's plan at one stage to try and .Net-ify most or all of the WinAPI). I wouldn't be writing drivers with it though, you will still use regular C/C++ interfacing to the Kernel API.

The libraries do make calls to many different portions of the win32 API. This is required to smoothly interoperate with other Windows Applications.

Does .NET interact with ... COM objects?

Yes it does, using COM interop.

Does .NET run in a sandbox & not allow some access to certain OS areas?

Some variants of the runtime can be sandboxed (Silverlight, WPF XBAP). .Net applications which possess the UnmanagedCode permission can also call code written in unmanaged C++ with full unfettered access to the system (you still have to abide by little pesky things like file ACLs though).

I can code in different languages using the win32 API such as c/c++, VB, Perl. What languages can I code in .NET?

.Net is a runtime library with JIT compilation. There are many languages you can use that are built on top of the framework. The JIT compilation is also not mandatory - you can still compile your applications to target a specific CPU architecture.

I hear about web applications written in .NET? What, how, wha? What language is it written in? Does .NET run ontop of IE? Does .NET webapps work on Firefox or on Safari(MacOS)?

Those applications can be written in any .Net language, although practically most of them will be using C# and VB.Net. You must have heard of ASP? Well, ASP.NET (and its sister ASP.NET MVC) is the next generation - this runs on the server and renders out HTML + javascript like many other server side languages. You also have the option of running Silverlight on the client, it can run both in and out of the browser. Silverlight most definitely works in Firefox, Safari and Chrome.

like image 96
5 revs, 3 users 87% Avatar answered Oct 10 '22 23:10

5 revs, 3 users 87%


  • .NET is a MS brand for a CLI VM; there are CLI VMs for other platforms; mainly "mono"; however, even .NET is wider than just win32, since versions of .NET exist for XNA (xbox 360), mobile devices (CF), even smaller devices (MF), browsers (SL) and phones (WP7, etc). .NET is also sometimes used as the name of the library, and much of that is written in C#. In Windows 8 there is also WinRT which confuses things further.
  • (see the above, too) a mix of both; it has interop (P/Invoke) for when it needs OS features, but can be self-supporting too.
  • it is generally a VM, so yes it is a sandbox; note that some compilers exist (mono AOT) for compiling directly to native code, for example ARM for iOS devices (see: MonoTouch)
  • CLI compilers compiles to IL; there are many CLI compilers (and runtimes, for dynamic languages). IL is generally JIT'd to native code as-needed, but can be done ahead-of-time (NGEN), or not at all (MF is an IL interpreter)
  • the "web application" there is probably referring to the server part; this very site has a C#/.NET server implementation. There is also Silverlight and XBAP for in-browser client experience. Silverlight works on a number of browsers, as does moonlight (the mono version, for non-windows platforms).
like image 33
Marc Gravell Avatar answered Oct 10 '22 23:10

Marc Gravell