in reply to Anyone interested in coding a _real_ Perl OS?

I'd never heard of JNode. Having read the Wikipedia entry and scoured the official website, I understood what it was -- a bootable OS, with command line, filesystem(s), tcpip stack and optional 2D windowing, written entirely in Java except for a nano-kernel written in assembler -- but was left wondering why it was written. Beyond, because they can.

Eventually I discovered one possible reason. For virtualised web-server environments ("the cloud"), there is a certain utility in having VM that contains just enough facilities to support web applications. Especially if it is written (almost) entirely in the language of choice for those applications. (Assuming you like Java). VM instances can be lighter, and come with the required language support already loaded at start up.

Reading between the lines of your initial post elsewhere, your motivation seems to be that you like that idea, but you don't like Java. Hence, you'd like to do the same thing in Perl.

However, given that it took the JNode author 15 years and 3 major iterations to get to a working and suitably performant solution, if you are hoping to use this for real work any time soon, you will have your work cut out. And remember, in parallel to the original author and his team, Sun used hundreds of programmers and millions, if not billions of dollars developing the JVM, runtime libraries, JIT technology etc. that underpins the JNode environment. Perl has no such deep pocketed white knight. Even interpreted Java runs many times faster than interpreted Perl, and JNode uses on-the-fly compilation exclusively. There is no such technology available for Perl.

If you are really serious about having a bootable Perl VM -- and I can see how this might be desirable in a cloudy, webby, mobile appy developer environment -- then I'd suggest that your best bet would be to utilise as much of the existing technology and lessons learned from the JNode project as possible.

It would surely be a whole lot easier to write a Perl interpreter that compiled to Java bytecode, than to start from scratch. A "JPerl" project has already existed for a couple of years and seemed to make some good early progress. (Though finding more/current information on it defeated my quick efforts.)

It seems to me that starting with PPI and converting that to Java wouldn't be beyond the realms of realistic possibility. And, at least for Pure Perl code, having a perl.jar that can be loaded into a JNode VM that takes perl source and generates Java bytecode would be a fast path to achieving your goal. And once you have the ability to write Pure Perl on top of the JVM, converting/re-writing many of the core/important XS modules on CPAN to be thin wrappers over the huge codebase of Java libraries ought to be really quite easy.

Of course, to write it would require you to bite the bullet of writing Java code initially to get things up and running, and that is what you want to avoid in the first place. But in the long term, having a Perl interpreter that sat on top of the now very highly developed and blazingly fast JVM technology would be a darn good thing for Perl anyway.

From my perspective, having Perl syntax sitting on top of JVM technology seems like a fresh start made in heaven.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: Anyone interested in coding a _real_ Perl OS?

Replies are listed 'Best First'.
Re^2: Anyone interested in coding a _real_ Perl OS?
by spx2 (Deacon) on Jul 10, 2011 at 11:28 UTC

    Either use JVM or Parrot. It sounds like an achievable goal to me. It all depends on how much manpower you have, how much time you have on your hands. Imagine that if you engage in such a project it could and most likely will eat all of your time, so some funding must come from somewhere, and if you got all of that covered you're good to go :)

    However, there must be milestones.

    Like

    • first writing a parser for Perl, using PPI for example
    • generating the "machine code" that fits into JVM/Parrot, then writing a huge amount of test
    • writing basic utilities for manipulating files
    • writing XS stuff that would interface with hardware or low-level stuff

    I am sure Perl is not fit for writing an OS, except you would invest heavily in a highly-optimized parser for it and a compiler which would enable you to produce binaries.

    But I would look at implementations in other languages first, BrowserUk has mentioned JNode. I will mention House which is written in Haskell.

    Also check out Cleese which is a "an operating system written almost entirely in Python".

    Some OS implemented in LISP here called LOSAK, or another one called Movitz

    I'm sure you can find a lot more examples, I'd read some of the progress these guys had first to know what obstacles one would encounter in building such an OS.

    But seriously this is a huge project, and needs a lot of manpower, it may have some kind of motivation such as porting all the web-based modules from CPAN and then using this brand new Perl-OS as a platform to run webapps from, that would be interesting, that's an achievable, but far-away goal.

      Either use JVM or Parrot.

      I think Parrot would be a very poor choice relative to the JVM.

      The latter has had millions of dollars spent on it and it is very, very advanced. And they just turned out a release candidate for Java 7. It is proven technology that runs pretty much everywhere. And dozens of non-Java languages have been implemented on it. Many of those are in the public domain and so are ready examples of how to go about it.

      My point about JNode is that they have done all the hard work. If you write a Perl interpreter that targets the JVM, the rest of the job is already done by JNode.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re^2: Anyone interested in coding a _real_ Perl OS?
by dosadi (Initiate) on Aug 06, 2011 at 06:21 UTC
    The nice thing about using an exokernel is that one doesn't necessarily have to make a hard and fast choice between languages or environments. I like the PerlOS idea because I think that Perl is a good language and environment to run systems code with, much better than Java/JNode because of its excellent language foundation and huge existing Perl codebase on CPAN.

    Jon

      I think that Perl is ... much better than Java/JNode ... huge existing Perl codebase on CPAN.

      If you cannot see that using JNode to underpin a 'Perl shell view' of the Virtual OS you are going to emulate, in no way restricts you from the Perl syntax or the Pure perl modules on CPAN, then you probably aren't the right person to go about implementing your idea.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.