It is confusing some people told me he used Java to develop systems
software? I thought Java is only suitable for high-level applications
development. I guess it depends on the definitions of 'systems
software', but my understanding is that at least it should be able to
manipulate memory addresses like C. I am not sure, please comment and
advice.
Thomas Weidenfeller - 15 Nov 2006 08:32 GMT
> It is confusing some people told me he used Java to develop systems
> software? I thought Java is only suitable for high-level applications
> development.
Java is not the best language for system programming. Java has an
interface (JNI) to C. So what one can do is to do the real system work
in C, and call the C functions from Java. You loose platform
independence and have to deal with two languages and the JNI mechanism.
/Thomas

Signature
The comp.lang.java.gui FAQ:
http://gd.tuwien.ac.at/faqs/faqs-hierarchy/comp/comp.lang.java.gui/
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
EJP - 15 Nov 2006 10:42 GMT
> It is confusing some people told me he used Java to develop systems
> software? ... I guess it depends on the definitions of 'systems
> software'
More than somewhat. Great language for writing compilers and assemblers
and linkers, and these were systems software when I went to school ...
If you mean device drivers and O/S components, no, because you can't
address physical memory or registers.
Thomas Hawtin - 15 Nov 2006 15:31 GMT
> More than somewhat. Great language for writing compilers and assemblers
> and linkers, and these were systems software when I went to school ...
> If you mean device drivers and O/S components, no, because you can't
> address physical memory or registers.
It may not be great but you can still write a little JNI to create a
direct java.nio.ByteBuffer (or equivalent in RTSJ). For USB there are
APIs available into low level protocols. I think the main problem is
interfacing to operating systems not written with Java in mind.
Tom Hawtin
Patricia Shanahan - 15 Nov 2006 11:01 GMT
> It is confusing some people told me he used Java to develop systems
> software? I thought Java is only suitable for high-level applications
> development. I guess it depends on the definitions of 'systems
> software', but my understanding is that at least it should be able to
> manipulate memory addresses like C. I am not sure, please comment and
> advice.
I agree that a systems language needs to be able to do arithmetic and
turn the result into a pointer. That is needed for both memory
management and hardware register addressing.
It may also need to be able to turn a pointer into an integer type.
However, I don't think it needs to be done "like C". It could be
isolated in a special API, so that e.g. coding reviews could look for
over-use.
Patricia
Chris Uppal - 15 Nov 2006 13:09 GMT
> I agree that a systems language needs to be able to do arithmetic and
> turn the result into a pointer. [...]
>
> However, I don't think it needs to be done "like C". It could be
> isolated in a special API, so that e.g. coding reviews could look for
> over-use.
That's the approach that the IBM "Jikes Research JVM" takes.
(That's a high-performance JVM written entirely in Java (plus a little
assembler for bootstrapping) -- and a high-performance JVM needs a lot of
low-level "systems-y" tricks.)
-- chris
Arne Vajhøj - 16 Nov 2006 02:59 GMT
> It is confusing some people told me he used Java to develop systems
> software? I thought Java is only suitable for high-level applications
> development. I guess it depends on the definitions of 'systems
> software', but my understanding is that at least it should be able to
> manipulate memory addresses like C. I am not sure, please comment and
> advice.
Java is very well suited for databases and application servers.
IBM has shown that most of a JVM itself can be written in Java.
MS has shown that most of an OS can be written in C# and
that should indicate that Java could be used as well.
A few things can not be written in Java, but the lines
of code would be relative small compared to the
total size.
Arne
Simon Brooke - 16 Nov 2006 19:49 GMT
> It is confusing some people told me he used Java to develop systems
> software? I thought Java is only suitable for high-level applications
> development. I guess it depends on the definitions of 'systems
> software', but my understanding is that at least it should be able to
> manipulate memory addresses like C. I am not sure, please comment and
> advice.
It depends on the architecture, doesn't it? There are hardware
implementations of the Java processor; they run Java down on the metal and
you can't get lower level than that. The Intel x86 architecture is not
designed to run Java on the metal, and Java is not designed to compile
down to x86 native code. However, there are compilers (including GCC)
which will compile Java to x86.
You'd almost certainly need a Java aware BIOS which appeared as an instance
of a custom class; and you'd probably have to write that BIOS in assembler
or possibly C. But the BIOS could be very small indeed.

Signature
simon@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/
The trouble with Simon is that he only opens his mouth to change feet.
;; of me, by a 'friend'