.NET applications runs on .NET framework on Windows OS only?

M

Matt

I want to confirm if .NET applications runs on .NET framework on Windows OS
only, not other OS such as Unix or Mac?? If this is the case, then what's
the point of .NET framework. In Java Virtual Machine, it is "write once, and
run everywhere," so that any Java applications can run on any OS with JVM
installed.

Please advise. Thanks!
 
B

Ben S. Stahlhood II

Matt,

At this time Pure (Standardized) .NET Framework based applications can run
on Windows and Linux. The Mono project http://go-mono.com/ is doing the
port for Linux and Mac OS X. It is still in the works. This is a new
technology and will take sometime for adoption.

Take care,
Ben S. Stahlhood II
 
M

Matthew W. Jackson

I believe that during early versions, Java was not intended to be platform
independant. Even now it requires somebody to port large sections of the
class library (written in C) each time a new platform is introduced.

Besides, the .NET virtual machine makes it easier to provide code-based
secuirty. While this might be possible with machine code, it certainly
wouldn't be as efficient.

Also, Windows has been available on platforms other than x86 in the past (NT
ran on Alpha). Soon, Windows will be available on three different
architectures (x86, x86-64 and IA64), and .NET will run on all three.

And I certainly don't like to think that we will still be using x86
processors in 15 years. While the x86-64 is maintaining
backwards-compatibility, this would not be as important in the future if
more software ran on virtual machines. Then engineers could finally move on
to designing more efficient processors without worrying about binary
compatibility that goes all the way back to 8-bit Intel 8080 (and 4-bit
4040, I think) processors. And how many programs still use most of the
instructions in the x86 instruction set anyway? Anybody still using Binary
Coded Decimal assembly instructions?

Theoretically, the .NET runtime can optimize code for a specific processor
at runtime. I'm not sure how much the current implementations do this, but
it is POSSIBLE that .NET programs on AMD machines could take advantage of
3DNow, and on machines with SIMD instructions those could be used, and etc.,
etc. Even if the instruction sets were the same, it's possible that
different models perform certain operations and different speeds, and the
JIT compiler can keep that in mind when choosing which machine instructions
to use.

The runtime also adapts based on the number of processors. I believe the
current implementation will remove certain thread-synchronization locks when
a program is being run on a single-processor machine.



Plus, there are other implementations of .NET.

Microsoft has Rotor, which runs a small subset of .NET programs on Windows
XP, FreeBSD, and (I believe) Mac OSX. This is a shared-source project for
Research purposes.

Another promising project is Mono, which runs mainly on Linux, but they are
also working on an interpreted version (as opposed to Just-in-time-compiled)
which could be easily ported to several other architectures. And there is
also DotGNU, which is being designed with portability in mind. Since both
of these projects primarily use C# for the base-class libary, only small
portions of the framework have to be ported. But there is still a lot of
work to do...

(Not to mention the .NET Compact Framework)

--Matthew W. Jackson
 
J

Jon Skeet [C# MVP]

Matthew W. Jackson said:
I believe that during early versions, Java was not intended to be platform
independant.

Yes it was. It's always been available for Solaris and Windows, for
instance. Indeed, right from the first version of the language
specification:

<quote>
Java is a general-purpose concurrent class-based object-oriented
programming language, specifically designed to have as few
implementation dependencies as possible. Java allows application
developers to write a program once and then be able to run it
everywhere on the Internet.
Even now it requires somebody to port large sections of the
class library (written in C) each time a new platform is introduced.

Almost all of the class library is written in Java, and there's one
common code-base for Sun's VM across platforms. Sure, some parts of it
will be platform-dependent (such as the native parts of the preferences
API implementation)
Besides, the .NET virtual machine makes it easier to provide code-based
secuirty. While this might be possible with machine code, it certainly
wouldn't be as efficient.

I'm not sure where this comment comes in... was it for the "what's the
point of .NET otherwise"? If so, I agree that there are for more
reasons to use .NET than just portability.
Also, Windows has been available on platforms other than x86 in the past (NT
ran on Alpha).

True, although as far as I'm aware .NET isn't available for the Alpha
version of NT.
Theoretically, the .NET runtime can optimize code for a specific processor
at runtime. I'm not sure how much the current implementations do this, but
it is POSSIBLE that .NET programs on AMD machines could take advantage of
3DNow, and on machines with SIMD instructions those could be used, and etc.,
etc. Even if the instruction sets were the same, it's possible that
different models perform certain operations and different speeds, and the
JIT compiler can keep that in mind when choosing which machine instructions
to use.
Indeed.

Plus, there are other implementations of .NET.

And that's the really important thing, when talking about .NET's
potential platform independence.
Another promising project is Mono, which runs mainly on Linux, but they are
also working on an interpreted version (as opposed to Just-in-time-compiled)
which could be easily ported to several other architectures.

And indeed the interpreter runs on:
Linux/x86, Linux/PPC, S390, StrongARM, SPARC, HPPA, SPARC v9

The JIT is being worked on for other processors, and it sounds like the
PPC version is coming along.
 
M

Matthew W. Jackson

Java is a general-purpose concurrent class-based object-oriented
programming language, specifically designed to have as few
implementation dependencies as possible. Java allows application
developers to write a program once and then be able to run it
everywhere on the Internet.
</quote>

Oops, I'm getting my language histories mixed up.

Java was designed to be portable, but for embedded systems. When it didn't
have the success there that the developers wanted, they targeted the
Internet.

It was similar to the .NET Compact Framework, which is fairly portable on a
few different embedded systems.
Almost all of the class library is written in Java, and there's one
common code-base for Sun's VM across platforms. Sure, some parts of it
will be platform-dependent (such as the native parts of the preferences
API implementation)

I had a professor say once that since Java has no fast/easy way to call the
underlying OS directly (such as .NET's P/Invoke), that all platform
independance was accomplished through writing parts of the library in C and
using a special interface (Java Native Interface). It made sense, so I
belived him.

On the other hand, Mono or DotGNU can use different implementations of the
same class written with different P/Invoke bindings.

I'm not sure which is better---leveraging the existance of C compilers for a
wide variety of platforms, or keeping all of your code (mostly) in one
language.

I know that in Mono they keep the amount of external native code to a
minimum.

From: http://www.nag.com/local/techtips/cfromjava2.asp

"After the native shareable library is built, Java code that uses it is
still machine-independent even though the native library is not. Thus, you
must build the library on all platforms the Java program runs on, although
you don't need to edit or rebuild the Java code."

Do you have any figures on what portion of the Java Library is implemented
in Java and what is in C?
I'm not sure where this comment comes in... was it for the "what's the
point of .NET otherwise"? If so, I agree that there are for more
reasons to use .NET than just portability.

Yes, I was responding to the original question about the need for a virtual
machine.
True, although as far as I'm aware .NET isn't available for the Alpha
version of NT.

Right, and I don't think there are plans to, either. I was just mentioning
that Windows NT itself is not platform-dependent. It is in fact VERY
portable.

It's the programs that run on it that aren't.
 

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

Top