Java-like VM for OSes

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
Post Reply
User avatar
amd64pager
Member
Member
Posts: 73
Joined: Fri Nov 25, 2011 8:27 am
Location: In the 266 squadron of the RFC,near Maranique in the Southern Front in the WW1

Java-like VM for OSes

Post by amd64pager »

I just thought if you could write your OS in bytecode,you could have a OS library(remember the java library anyone?) and a VM like the one java gives,you could add features like just in time compilation and other fancy features. :wink:
Would this be a good idea?And if it is,does anyone know some more ideas for it?
It's surprising what the semiconductor industry's definition of macro is and what the CS description is.
ACcurrent
Member
Member
Posts: 125
Joined: Thu Aug 11, 2011 12:04 am
Location: Watching You

Re: Java-like VM for OSes

Post by ACcurrent »

Long Live AOT compilers. My OS does this. (this may actually one place where EFI helps over BIOS)
Get back to work!
Github
Tosi
Member
Member
Posts: 255
Joined: Tue Jun 15, 2010 9:27 am
Location: Flyover State, United States
Contact:

Re: Java-like VM for OSes

Post by Tosi »

There are quite a few kernels that have been written in mostly Java; there is always a machine-dependent part that will need to be written in C or assembly however. And unless you are on a processor which can run the bytecode natively, there is an amount of overhead introduced by the interpretation or JIT.
For an example, see JavaOS, which also has links to several other Java OSes.

In short, there are some minor difficulties, but writing an OS in a language which is compiled to bytecode instead of machine code is definitely possible.
User avatar
amd64pager
Member
Member
Posts: 73
Joined: Fri Nov 25, 2011 8:27 am
Location: In the 266 squadron of the RFC,near Maranique in the Southern Front in the WW1

Re: Java-like VM for OSes

Post by amd64pager »

This is how it works:

It is made of different parts:
OSVM kernel
OSVM script parser
OSVM compiled executable parser
OSVM executable utilities

This is how the startup sequence goes:
-The bootloader loads the OSVM kernel
-The OSVM kernel loads the rest of the OSVM.
-Then the startup script is called
-The startup script can do things like print version,display a image etc.
-Then using the OSVM executable utilities,the script can link different parts of the kernel
-Then the scripts destroys itself and says the OSVM executable parser to run the kernel

Can you please suggest new ideas?
It's surprising what the semiconductor industry's definition of macro is and what the CS description is.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Java-like VM for OSes

Post by bluemoon »

So, you are describing a scripting engine or virtual machine?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Java-like VM for OSes

Post by Solar »

@bluemoon:

The difference tends to blur a bit there.

@ amd64pager:

You are aware that this will not make your OS any simpler to develop? Your VM would have to handle memory management, hardware management and abstraction, I/O handling, i.e. all the stuff that a common OS kernel has to do.

What this approach does give you are the advantages of a virtualized environment - but that is an advantage that becomes tangible only after you're done with the VM.

I am not discouraging you from doing it. I just want you to avoid a common conceptual mistake - thinking that, by going this road, you could write your "OS" in an "easier" environment. As I said, you will still have to face the nitty-gritty of ring 0 kernel work; the benefits are mostly for later stages of development.
Every good solution is obvious once you've found it.
rdos
Member
Member
Posts: 3271
Joined: Wed Oct 01, 2008 1:55 pm

Re: Java-like VM for OSes

Post by rdos »

To me it would be interesting to know if there is a (real) Java VM that can be compiled with Open Watcom and that provide a well-documented OS layer (like ACPICA has)? I'm not interested in designs that assume GCC, or that assume Linux-type functionality to be present (Dalvik).

I wouldn't want to write any OS-functionality in Java, just the ability to run Java-bytecode applications.

So, is there?
User avatar
amd64pager
Member
Member
Posts: 73
Joined: Fri Nov 25, 2011 8:27 am
Location: In the 266 squadron of the RFC,near Maranique in the Southern Front in the WW1

Re: Java-like VM for OSes

Post by amd64pager »

bluemoon wrote:So, you are describing a scripting engine or virtual machine?
The scripting engine runs the scripts,the VM runs bytecode executables.
Solar wrote: @ amd64pager:

You are aware that this will not make your OS any simpler to develop? Your VM would have to handle memory management, hardware management and abstraction, I/O handling, i.e. all the stuff that a common OS kernel has to do.

What this approach does give you are the advantages of a virtualized environment - but that is an advantage that becomes tangible only after you're done with the VM.
The VM is like a CISC machine.It has it's own LDT,GDT etc.

And interrupt handling(you need to use IRQs,right?) is a special exception:the LIDT contains the handlers for inside-VM interrupts,and the GIDT contains handlers for interrupts that happen in the CPU(like int 19).The GIDT works like this:The OSVM kernel gets an interrupt.After it checks the interrupt(whether it is not an OSVM exception) and then calls the function at the address of the GIDT.
Solar wrote: Your VM would have to handle memory management, hardware management and abstraction, I/O handling, i.e. all the stuff that a common OS kernel has to do.
And as I said before in this post,it is just a VM.The OSVM-based Kernel Framework Class Library(OSVMBKFCL)implements some of the functions that you put there,but not managers and other stuff.I also have the concept of rings and IOPL in my VM.A thread with a CPL lower than the IOPL can do I\O access directly to the hardware.
It's surprising what the semiconductor industry's definition of macro is and what the CS description is.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Java-like VM for OSes

Post by Solar »

/me confused... what are you virtualizing then?
Every good solution is obvious once you've found it.
User avatar
narke
Member
Member
Posts: 119
Joined: Wed Dec 26, 2007 3:37 am
Location: France

Re: Java-like VM for OSes

Post by narke »

Hello, the next step for my OS is to have a VM, I chose NekoVM, it's simple and elegant.
I'm writing transcompilers for python and Standard ML (both are far to be complete by now but you can help): http://github.com/narke.
OS for PowerPC Macs: https://github.com/narke/Einherjar
Operating system: colorForth computing environment for x86.: https://github.com/narke/Roentgenium
Post Reply