Re: Java's performance far better that optimized C++

From: Dietmar Kuehl (dietmar_kuehl_at_yahoo.com)
Date: 06/18/04


Date: 18 Jun 2004 00:31:49 GMT

valentin tihomirov wrote:

>
>> This does not address in any way certain practical problems like how to
>> talk to some hardware device. Although all of the above programming
>> languages are Turing-complete, not all of them are capable of [without
>> extensions] to access hardware directly as is necessary for writing an
>> operating system.
>
> Have you read this message Message-ID: <2jd2goF106futU1@uni-berlin.de>
>
http://groups.google.com/groups?q=%22Any+program+can+be+accomplished+using+memory%22&hl=et&lr=&ie=UTF-8&selm=2jd2goF106futU1%40uni-berlin.de&rnum=1
> in this thread?

It misses the point entirely. Instead of accusing C++ programmers of being
narrow minded, I'd suggest that you check your assumptions. Also note, that
all I said was that Turing completeness does not make a statement about
able to do all the practical things involved in creating a real program
like an operating system. It merely makes a statement about what kind of
problems can be solved with a computing device operating on some idealized
machine: a Turing machine has no operating system. The programs on this
machine are there and run. There is no statement whatsoever how they come
there. Turning machines also have not concept of input or output although,
in some sense, you can assume input and output to be the contents of a tape.
This is sufficient for an idealized, theoretical view for which you can
proof certain computability things. It does not, however, address practical
issues of real programs.

> Which HW access do you need? If you think a little, you'll come to
> surprising conclusion, any high-level language specifies the single and
> only way to assess HW: MEMORY READS and WRITES. Which of the langs above
> do not belong this category?

This is a purely theoretical point of view: yes, in theory you are right.
In theory, practice and theory are the same - in practice they are not. It
is up to the last point your "little thinking" holds up. At this last step
it fails. ... but then, maybe it is just me:

I have failed to notice the approach how to access memory at a specific
location, eg. 0x80000 (absolute, not memory mapped address) on an x86 based
system, with Java. I'm sure there are Java extensions which may allow things
like this (JNI is one of the approaches - going through C or C++...). The
last Java specification I looked at didn't include things like this apart
from JNI (of course, in this sense Linux is an operating system written in
Java: it just happens that it only uses JNI code and therefore even omits
the JNI part :-)

Sure enough, on a hardware which effectively implements [a reasonable
subset of] the Java platform, some programming language creating Java byte
code, eg. Java, is about the only choice to create an operating system.
However, I'd like to see an implementation of an operating system for my
x86 machine entirely written in Java. There are definitely operating systems
written in C for this platform (eg. Linux and Free BSD) and, AFAIK also at
least one written in C++ (Windows; it uses either C or C++ but I'm not sure
that it really uses C++). I'm unaware of an operating system written in
Java. Of course, following your general logic, Java seems to be the obvious
choice when embarking on the quest to create an operating system. Strangely
then that there is none...

BTW, personally I don't care about the possibility to write an operating
system in a particular language, mainly because my day to day tasks don't
include writing operating systems. I'm also not too concerned about using
the most efficient programming language (after all, I'm using C# and Java
for certain tasks - sorry, I couldn't resist (*)). To me the reason for
using C++ is that I can express things I cannot express in the same
idiomatic and concise way in any other programming language I'm aware of (of
course, the language also has to be practical in the sense of being
relatively widely available and sufficiently efficient). I wouldn't consider
C++ ideal (for example I would prefer a simpler and possibly more concise
notation for certain things, especially templates) but it is my preference
from all languages I'm fluent with (which includes Java among others).

(*) Before you ask: I'm using Java if I need a platform independent GUI. It
    is a pain due to the difference between different JVMs but it is a
    better alternative than using C++ as there is even less than in Java
    such a thing as portable platform library.

-- 
<mailto:dietmar_kuehl@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting


Relevant Pages

  • Re: Mars Rover Controlled By Java
    ... > quotes are being read out of context by a few Java enthusiasts. ... obviously Java is not an operating system. ... > Internet. ... > implement a true operating system using Java as your programming ...
    (comp.lang.java)
  • Re: Mars Rover Controlled By Java
    ... > quotes are being read out of context by a few Java enthusiasts. ... obviously Java is not an operating system. ... > Internet. ... > implement a true operating system using Java as your programming ...
    (comp.programming)
  • Re: Mars Rover Controlled By Java
    ... > quotes are being read out of context by a few Java enthusiasts. ... obviously Java is not an operating system. ... > Internet. ... > implement a true operating system using Java as your programming ...
    (comp.lang.java.programmer)
  • Re: Mars Rover Controlled By Java
    ... > quotes are being read out of context by a few Java enthusiasts. ... obviously Java is not an operating system. ... > Internet. ... > implement a true operating system using Java as your programming ...
    (comp.theory)
  • Re: Mars Rover Controlled By Java
    ... > quotes are being read out of context by a few Java enthusiasts. ... obviously Java is not an operating system. ... > Internet. ... > implement a true operating system using Java as your programming ...
    (comp.object)