Can Java be used to write an operating system

D

devj.nullj

Hi

I am new to Java programming language. Previously I have been
using assembly and C language for lower level programming.

I would like to enquire from the experts here whether Java can
be used to program lower level applications like device drivers or
a new operating system for that matter?

In general, I would also like to ask whether object oriented
programming can be used for such purposes i.e. lower level
programming? If so, can you please cite any references and
examples.

Thanks in advance for any help.

--devj
 
D

Dave Miller

I would like to enquire from the experts here whether Java can
be used to program lower level applications like device drivers or
a new operating system for that matter?

Probably the wrong language for a free standing driver and pretty much
impossible for a free standing OS. Java utilizes an abstract computing
machine (called a "Java Virtual Machine" or JVM) which sits on top of
the native OS. In other words, you'd need an OS to run your OS.


http://java.sun.com/docs/books/jvms/first_edition/html/Introduction.doc.html
 
A

Arved Sandstrom

Hi

I am new to Java programming language. Previously I have been
using assembly and C language for lower level programming.

I would like to enquire from the experts here whether Java can
be used to program lower level applications like device drivers or
a new operating system for that matter?

In general, I would also like to ask whether object oriented
programming can be used for such purposes i.e. lower level
programming? If so, can you please cite any references and
examples.

Thanks in advance for any help.

--devj

As an example, http://developer.apple.com/hardwaredrivers/overview.html

AHS
 
M

Mark Thornton

Hi

I am new to Java programming language. Previously I have been
using assembly and C language for lower level programming.

I would like to enquire from the experts here whether Java can
be used to program lower level applications like device drivers or
a new operating system for that matter?

In general, I would also like to ask whether object oriented
programming can be used for such purposes i.e. lower level
programming? If so, can you please cite any references and
examples.

Thanks in advance for any help.

--devj

http://jnode.org/

Mark Thornton
 
D

Dave Miller

The above wasn't meant as a challenge - I was asking. The page you
reference seems to answer the question - that the mini kernel loads
first and the JVM runs on top of the mini kernel. It's moving up to a
higher level all but a very few of the low level tasks and in so doing
provides a virtual machine / operating system minus the kernel.
 
T

Tom Anderson

Probably the wrong language for a free standing driver and pretty much
impossible for a free standing OS. Java utilizes an abstract computing
machine (called a "Java Virtual Machine" or JVM) which sits on top of
the native OS. In other words, you'd need an OS to run your OS.

Yebbut you can write the JVM in java, and have it compile itself, isn't
it:

http://jikesrvm.org/

Once you have that kind of capability - and Jikes includes ways of
expressing unsafe but essential operations like direct memory access -
there's no reason you couldn't write an OS all the way down to the bare
metal. You might need a smattering of assembly to initialise the
processor, set up interrupt handlers, things like that, but you could
completely replace C.

I have no idea how far along this JNode project is, but long, long ago, in
an industry far, far away, a company called Symbolics actually shipped an
operating system written entirely in LISP:

http://lispm.dyndns.org/genera-concepts/genera.html

tom
 
A

Arne Vajhøj

Dave said:
Probably the wrong language for a free standing driver and pretty much
impossible for a free standing OS. Java utilizes an abstract computing
machine (called a "Java Virtual Machine" or JVM) which sits on top of
the native OS. In other words, you'd need an OS to run your OS.

It is impossible to write 100% of an OS in Java for that reason.

But it is possible to write a huge portion of an OS in Java.

My guess would be that less than 5% of an OS today is in
"close contact with the metal".

Arne
 
A

Arne Vajhøj

I am new to Java programming language. Previously I have been
using assembly and C language for lower level programming.

I would like to enquire from the experts here whether Java can
be used to program lower level applications like device drivers or
a new operating system for that matter?

In general, I would also like to ask whether object oriented
programming can be used for such purposes i.e. lower level
programming? If so, can you please cite any references and
examples.

OOP can most certainly be used for low level programming.

The VM nature of Java requires some native stuff between
the Java stuff and the metal.

But not much.

Arne
 
A

Arne Vajhøj

Arne said:
OOP can most certainly be used for low level programming.

The VM nature of Java requires some native stuff between
the Java stuff and the metal.

But not much.

Microsoft did some research in the area in the Singularity
project (it was ofcourse C# and not Java, but most of it should
apply to Java as well).

See ftp://ftp.research.microsoft.com/pub/tr/TR-2005-135.pdf
for details.

Arne
 
R

Roedy Green

The VM nature of Java requires some native stuff between
the Java stuff and the metal.

the VM can be extended with a few low level instructions, that even
with a Java chip might be implemented as microcode. These
instructions might things like poke an io port with a value, control
the memory mapping hardware...
 
J

John B. Matthews

Roedy Green said:
the VM can be extended with a few low level instructions, that even
with a Java chip might be implemented as microcode. These
instructions might things like poke an io port with a value, control
the memory mapping hardware...

Similarly, the UCSD p_System used a p-code interpreter that Western
Digital implemented in the microcoded WD9000 Pascal Microengine, ca.
1980.

<http://www.cpushack.net/CPU/cpuAppendB.html#Pascal>

John
 
A

Arne Vajhøj

Roedy said:
the VM can be extended with a few low level instructions, that even
with a Java chip might be implemented as microcode. These
instructions might things like poke an io port with a value, control
the memory mapping hardware...

It is a bit more complex than that for a modern OS.

Memory protection, special registers, avoiding
pagefaults etc..

Arne
 
D

Daniel Pitts

Hi

I am new to Java programming language. Previously I have been
using assembly and C language for lower level programming.

I would like to enquire from the experts here whether Java can
be used to program lower level applications like device drivers or
a new operating system for that matter?

In general, I would also like to ask whether object oriented
programming can be used for such purposes i.e. lower level
programming? If so, can you please cite any references and
examples.

Thanks in advance for any help.

--devj
Object Oriented Programming can be used almost anywhere, it really
depends on the abstraction used at the hardware layer. Java
specifically is somewhat ill-suited to do a complete end-to-end OS, but
with a little bit of bootstrapping(a C++ JVM implementation and a
micro-kernel implemented in any language, probably assembly), you could
create the rest of the platform around Java. Although, this is true for
even C, you need some sort of "assembly" bootstrap, or a compiler
specifically designed to create the bootstrap code from c source.

As far as drivers go, they usually involve reading from or writing to
device memory and port buses. I personally would probably start a Java
os project by abstracting *that* functionality into a class with native
method calls.
 
R

Roedy Green

Uses a nano-kernel written in assembly, no? If yes, does JNode run on
top of it?

A virtual machine can disguise the fact it needs some low level
assembly by adding a few rather specialised instructions to its set.
That those instructions are actually implemented in ordinary assembler
disguises what is going on. It also makes possible a portable OS. To
port you just need to implement the instruction set, not anything in
the OS proper.
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top