Sun's JVM is written in C and Assembly, but there are JVMs written in
ML, Haskell, Java, etc. The point isn't what it is written in, the
point is what algorithms and data structures where used. It turns out
certain data structures are easier to formulate in C. In other cases
the semantics of another language make it even easier to control and
define certain other data structures. Some data structures and their
associated methods are not even allowed in certain languages like
Java.

So it really depends on what is important. Now days things like
concurrency, which Java lets you formulate with ease compared to C,
are more important than finding data structures to optimize sequential
processes typical of C. So thats why in many cases Java programs are
"faster" than C programs.

That's the high level theory, in practice people like to write systems
in C because:

1) lots of developers know it
2) lots of low level libraries to handle sequential processing
3) Optimized compilers. Since so many man hours have been poured into them.






On Jan 28, 2008 4:25 PM, Aloysius Thevarajah Lloyd
<[EMAIL PROTECTED]> wrote:
> Just wondering Sun JVM written in C/C++. How come Java Faster than C or C++?
>
> Lloyd
>
>
> On 1/28/08, Ian Darwin <[EMAIL PROTECTED]> wrote:
> >
> > Aloysius Thevarajah Lloyd wrote:
> > > http://java.sys-con.com/read/45250.htm is a interesting Article. Thank
> > you
> > > Ian. The article is Compare Java vs C++ not C.
> > >
> > > I think JVM written in C. May Be I am wrong.
> >
> > A JVM can be written in any language: C, C++, Perl, Ruby, ASM, ... There
> > are even some written in Java (see for example
> > http://javapathfinder.sourceforge.net/). There is an abstract
> > specification for the JVM (free download from Sun) if anybody else wants
> > to take a crack at it. You'd need to be on crack to try it from scratch,
> > though, unless you just won this week's 6/49 draw.
> >
> > That said, Sun's reference implementation of the JVM is written in C and
> > C++. You can download the source and see for yourself - it's available
> > now under the GPL.
> >
> > Ian
> >
>
>
>
> --
>
> Lloyd
>
> Tel:416-500-8014
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to