Page 1 of 2
Java as an alternative language in the wiki
Posted: Fri Nov 13, 2015 8:56 am
by embryo2
I see there's even no mention of it (except something like "languages like Perl or Java is unlikely to succeed"). I'm ready to add Java related information to some pages, but I'm in doubts if it is really needed.
What do you think?
Re: Java as an alternative language in the wiki
Posted: Fri Nov 13, 2015 12:23 pm
by Schol-R-LEA
embryo2 wrote:I see there's even no mention of it (except something like "languages like Perl or Java is unlikely to succeed"). I'm ready to add Java related information to some pages, but I'm in doubts if it is really needed.
What do you think?
Feel free; I'm sure you aren't the only one here who would find it of interest (even if they aren't using Java themselves - there are more than a few people who want to use C#, as well, and similar issues come up with that, too), so it would be worthwhile, sure. A 'bare bones' on the subject would probably be a good starting point, though I would expect (without knowing good deal more about it than I do) that it would require more work than most of the other BB pages.
I would keep in mind that you'll have to either select a specific Java implementation (again, not knowing enough about it, I imagine gjc is probably easiest to work with for this purpose, but you would know better than I would), or else have separate sections (or even separate pages) for different compilers and JVMs. You will also need to go into detail about a number of issues that don't arise with most other languages, such as porting the JVM and the JIT compiler, implementing the garbage collector(s), handling the JNI to call native code, and so on. Being in a similar position myself (except with a language that doesn't even exist yet), I can tell you that there are more than a few issues that you will need to explain that simply don't come up with, for example, Ada. You can anticipate it taking a fairly long time to get it beyond being just a stub.
Re: Java as an alternative language in the wiki
Posted: Fri Nov 13, 2015 1:39 pm
by BASICFreak
Though I would not be interested in using Java, I would enjoy reading how it is done
.
It's becoming a more popular language - at least compared to when I was first interested in OSDev - so it will be a good addition to our ever expanding WiKi.
If you want to put the time and effort into it, it will be appreciated by anyone interested in using Java to OSDev or just wanting to expand their knowledge.
(Myself, I have been fixing spelling and grammar errors as I find them - hoping to contribute an article by the end of the year...)
Best regards,
B!
Re: Java as an alternative language in the wiki
Posted: Fri Nov 13, 2015 2:06 pm
by Combuster
The thing with OSDev Java is that it requires a programmer that knows well beyond the bounds of Java to succeed in the real challenges of OS development: these are also the ones that Java actively hides from developers.
If you can formulate something truly Bare Bones, that'd certainly be a nice thing. However if it goes more into the direction of "clone this git repository" or "use this support code", then it's probably ill-advised to present the beast in sheep's clothing to the unprepared newcomer. Then again, we don't have a "Rolling your own Android" article either
Re: Java as an alternative language in the wiki
Posted: Fri Nov 13, 2015 4:47 pm
by SpyderTL
Your approach to writing an OS in Java is pretty specific, so writing documentation about it may give people the wrong impression -- that you can actually write an OS in Java, like you can in C. In reality, you have written a Java-to-x86 byte code assembler, and then written an OS using that.
As long as this is explicitly stated in your wiki page, I think it's fine.
To put it another way, I could add a page to the wiki discussing how to write an OS in XML. But I would need to put a huge disclaimer at the top of the page stating something like:
This article discusses the idea of writing both an XML compiler AND an Operating System using XML documents. Normally, XML cannot be compiled directly into executable code. You will need to write your own compiler, or use a pre-existing one, like the one found at
http://ozone.codeplex.com
But I would still be documenting my specific implementation, not necessarily an industry "standard".
You may just want to start out by documenting your tools and your OS design, specifically, and later move some or all of it to a "generic" Java OS article, if it makes sense.
Up to you though...
Re: Java as an alternative language in the wiki
Posted: Sat Nov 14, 2015 2:34 pm
by embryo2
Schol-R-LEA wrote:A 'bare bones' on the subject would probably be a good starting point, though I would expect (without knowing good deal more about it than I do) that it would require more work than most of the other BB pages.
...
I would keep in mind that you'll have to either select a specific Java implementation (again, not knowing enough about it, I imagine gjc is probably easiest to work with for this purpose, but you would know better than I would), or else have separate sections (or even separate pages) for different compilers and JVMs. You will also need to go into detail about a number of issues that don't arise with most other languages, such as porting the JVM and the JIT compiler, implementing the garbage collector(s), handling the JNI to call native code, and so on. Being in a similar position myself (except with a language that doesn't even exist yet), I can tell you that there are more than a few issues that you will need to explain that simply don't come up with, for example, Ada. You can anticipate it taking a fairly long time to get it beyond being just a stub.
Nice introduction. In case of the implementation in fact it's simpler (Java is standardized much more than C), but I'll try to write about it in the wiki.
BASICFreak wrote:Though I would not be interested in using Java, I would enjoy reading how it is done
.
Ok, I'll try to show it from the perspective of C developers.
Combuster wrote:If you can formulate something truly Bare Bones, that'd certainly be a nice thing. However if it goes more into the direction of "clone this git repository" or "use this support code", then it's probably ill-advised to present the beast in sheep's clothing to the unprepared newcomer.
Do you think I'll start to advertise my OS? It's not the case. But it is much easier to get examples from my work.
Re: Java as an alternative language in the wiki
Posted: Sat Nov 14, 2015 2:43 pm
by embryo2
Combuster wrote:The thing with OSDev Java is that it requires a programmer that knows well beyond the bounds of Java to succeed in the real challenges of OS development: these are also the ones that Java actively hides from developers.
Low level knowledge is what the osdev.org provides, so I'm not afraid of people who get here and knows nothing about the challenges.
And hiding the low level details is important only for beginners. As time passes a developer starts to understand importance of optimization. But actually there should be some limit to such efforts because it can take a lot of time. Java let's you to stop earlier. But if a developer wants to advance his skills then the low level becomes interesting.
Re: Java as an alternative language in the wiki
Posted: Sat Nov 14, 2015 2:51 pm
by embryo2
SpyderTL wrote:Your approach to writing an OS in Java is pretty specific, so writing documentation about it may give people the wrong impression -- that you can actually write an OS in Java, like you can in C. In reality, you have written a Java-to-x86 byte code assembler, and then written an OS using that.
We can discuss the approaches to write an OS not in C or assembly. May be it worth to start a separate thread?
SpyderTL wrote:To put it another way, I could add a page to the wiki discussing how to write an OS in XML. But I would need to put a huge disclaimer at the top of the page stating something like:
This article discusses the idea of writing both an XML compiler AND an Operating System using XML documents. Normally, XML cannot be compiled directly into executable code. You will need to write your own compiler, or use a pre-existing one, like the one found at
http://ozone.codeplex.com
That's why it is interesting to write about a general approach of writing OS in not very common (for it) language. And existing OSes can show examples for interested developers.
SpyderTL wrote:You may just want to start out by documenting your tools and your OS design, specifically, and later move some or all of it to a "generic" Java OS article, if it makes sense.
At least there should be some root in the tree of languages and their features. It can be the generic discussion about different languages for OSdeving, supplemented by wiki fragments as a result.
Re: Java as an alternative language in the wiki
Posted: Sun Nov 15, 2015 4:50 am
by Combuster
embryo2 wrote:Do you think I'll start to advertise my OS? It's not the case.
You already did.
Re: Java as an alternative language in the wiki
Posted: Sun Nov 15, 2015 6:50 am
by embryo2
Combuster wrote:embryo2 wrote:Do you think I'll start to advertise my OS? It's not the case.
You already did.
I see it as easiest way. But may be you can propose something easier?
Re: Java as an alternative language in the wiki
Posted: Sun Nov 15, 2015 9:33 am
by Schol-R-LEA
embryo2 wrote:Combuster wrote:embryo2 wrote:Do you think I'll start to advertise my OS? It's not the case.
You already did.
I see it as easiest way. But may be you can propose something easier?
'Easy' is going to vary from dev to dev. In any case, the point isn't that you might engage in SSP, but that you would be channeling the readers into a specific solution rather than giving them options. Admittedly, the entire site is guilty of that, given the heavy reliance on C and the GNU toolchain, but there has been a conscious effort to limit that and provide some guidance for that who stray from The Golden Path of Unix Righteousness
TM.
Re: Java as an alternative language in the wiki
Posted: Sun Nov 15, 2015 11:21 am
by embryo2
Have just finished
Java Bare Bones. Please, take a look if interested. Also mistake correction (or pointing at) would be appreciated.
Some changes also have been made in the
Languages, and
Introduction sections.
Re: Java as an alternative language in the wiki
Posted: Sun Nov 15, 2015 2:56 pm
by Brendan
Hi,
embryo2 wrote:Have just finished
Java Bare Bones. Please, take a look if interested. Also mistake correction (or pointing at) would be appreciated.
Some changes also have been made in the
Languages, and
Introduction sections.
For a start, you probably should change the page's title to something more like "Writing an Assembler in Java (and using it to generate a boot loader written in your new dialect of assembly)"...
Cheers,
Brendan
Re: Java as an alternative language in the wiki
Posted: Mon Nov 16, 2015 9:29 am
by embryo2
Brendan wrote:For a start, you probably should change the page's title to something more like "Writing an Assembler in Java (and using it to generate a boot loader written in your new dialect of assembly)"...
It's a way of using Java for OSdeving. The way C is used is as such:
- Somebody writes assembly translator
- Somebody writes assembly program, which is used as a C translator
- Somebody writes C program
- C translator is executed
- C program (in it's the very new form) is executed
In case of Java only the steps of writing Java were omitted.
Re: Java as an alternative language in the wiki
Posted: Mon Nov 16, 2015 2:12 pm
by Brendan
Hi,
embryo2 wrote:Brendan wrote:For a start, you probably should change the page's title to something more like "Writing an Assembler in Java (and using it to generate a boot loader written in your new dialect of assembly)"...
It's a way of using Java for OSdeving. The way C is used is as such:
- Somebody writes assembly translator
- Somebody writes assembly program, which is used as a C translator
- Somebody writes C program
- C translator is executed
- C program (in it's the very new form) is executed
You're conflating "writing a C compiler" with "using a C compiler". The normal way people use C is:
- Somebody writes C source code
- C translator is executed
- C program (in it's the very new form) is executed
It's entirely possible to use C differently. For example, you could write an assembler in C that uses "assembly source code" embedded directly in the assembler's own C (e.g. as data and/or macros and/or functions, not as inline assembly); so that when you execute the compiled C program it assembles the assembly source code that was embedded into it. Of course nobody does this in C because it's hideous (much better to get the assembly source code from separate file/s instead of building it directly into the assembler); but if someone did do this then the boot loader would be written in (an awkward/ugly dialect of) assembly and the boot loader wouldn't be written in C at all.
In the same way; you could write an assembler in Java that gets the assembly source code from separate file/s (and then write a boot loader in assembly); or you could write an assembler in Java where the assembly source code is embedded directly into the assembler itself (and then write a boot loader in assembly).
Basically; you're writing an assembler, and then writing a boot loader in assembly. You're not writing a boot loader in Java.
Cheers,
Brendan