This discussion is archived
8 Replies Latest reply: Jul 30, 2009 7:58 AM by 800341 RSS

RTJ on vmware/virtualBox

800341 Newbie
Currently Being Moderated
Hi

is there any (hopefully positive) experience with running RTJ on a vmware/virtualBox on a windows-Xp/Mac-Osx system?

i would like to learn/playaround with RTJ : i think dual core system is enough to play around with priority-scheduling stuffs.

Also heard from my colleague that it will not work on a vmware... i beleive him... but is there any hack to make it run on solaris 10 on vmware/virtualBox

already i read the posts here (but some of them are relatively old and not that useful)

[http://forums.sun.com/thread.jspa?forumID=548&threadID=5360117|http://forums.sun.com/thread.jspa?forumID=548&threadID=5360117]

[http://forums.sun.com/thread.jspa?forumID=548&threadID=5190868|http://forums.sun.com/thread.jspa?forumID=548&threadID=5190868]

[http://forums.sun.com/thread.jspa?forumID=548&threadID=5277930|http://forums.sun.com/thread.jspa?forumID=548&threadID=5277930] (You can not run in a virtualized environment and expect real-time behaviour. --- David Holmes)

Thanks
Ramsundar
  • 1. Re: RTJ on vmware/virtualBox
    807557 Newbie
    Currently Being Moderated
    I can not recall any specific issue preventing JRTS from running on Solaris 10 in a virtual environment - if your colleague is aware of something please share it here. But what you can achieve in that environment will depend on many factors and only you will be able to determine if it is "good enough" for your evaluation/experimentation purposes.

    Cheers,
    David Holmes
  • 2. Re: RTJ on vmware/virtualBox
    807557 Newbie
    Currently Being Moderated
    Hello David, Hello Ram,

    First of all, I must say that I have only tested the Java RTS 2.1 on a virtual machine environment, i.e. on VirtualBox. Virtual Box was installed on Windows XP SP2; VirtualBox additions for Solaris were installed as well.

    The problem I have is with the cyclic driver.

    The machine is a FujitsuSiemens LIFEBOOK.
    I have created a Virtual Machine in virtualBox, paying attention that the IO-APIC is activated (used by the cyclic driver).
    I have installed Java RTS (including the cyclic driver). I make sure that the user I am using has the right to use the high resolution timers.

    When trying to run the example application (a loop with waitForNextPeriod() in 20ms periods), I always get the following error:
    run:
    Could not open /dev/cyclic (No such file or directory).
    Please check that the cyclic device driver
    is correctly installed on your system.
    Java Real-Time System HotSpot(TM) Client VM warning: Disabling high-resolution timers as the cyclic driver is not used
    Exception in thread "main" java.lang.ClassCastException: java.lang.Thread
            at javax.realtime.RealtimeThread.currentRealtimeThread(RealtimeThread.java:51)
            at javax.realtime.RealtimeThread.waitForNextPeriod(RealtimeThread.java:275)
            at com.lhs.realtime.test.SomeThread.run(SomeThread.java:42)
            at r2t.Main.main(Main.java:29)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 15 seconds)
    I have also tried without the cyclic driver being installed, expecting that I am able to instantiate a RTT if I am not using the periodic waits (waitForNextPeriod). I still get the ClassCastException when instatntiating a RTT.

    I assume that Ram does not need full determinism, so if there's a way to get this working in a "non-hard-realtime" mode, it would be OK for him. And myself ;)

    Best regards,

    Sergiu
  • 3. Re: RTJ on vmware/virtualBox
    807557 Newbie
    Currently Being Moderated
    Only a RealtimeThread can call waitForNextperiod - which is why you get the ClassCastException. What type is SomeThread?

    The Cyclic driver is a prerequisite for JRTS on Solaris. You can not instantiate (or perhaps start) a RealtimeThread if it is not installed and working.

    What version of Solaris is installed? Did the cyclic package install ok? What does "modinfo | grep cyclic" report? Does dmesg show any errors from the cyclic driver?

    David Holmes
  • 4. Re: RTJ on vmware/virtualBox
    807557 Newbie
    Currently Being Moderated
    Hi David,

    I am sorry for not being clear on that. Of course that "SomeThread" is a subclass of the RealtimeThread.That is not the reason for that ClassCastException.
    For completeness, here's the entire source code:
    package com.xyz.realtime.test;
    
    import javax.realtime.AbsoluteTime;
    import javax.realtime.Clock;
    import javax.realtime.PeriodicParameters;
    import javax.realtime.PriorityParameters;
    import javax.realtime.RealtimeThread;
    import javax.realtime.RelativeTime;
    
    /**
     *
     * @author burians
     */
    public class SomeThread extends RealtimeThread {
    
        private int ITERATIONS = 50;
    
        public SomeThread(PriorityParameters priorityParameters, PeriodicParameters periodicParameters) {
            super(priorityParameters,periodicParameters);
        }
    
        public void run() {
            Clock rtClock = Clock.getRealtimeClock();
            AbsoluteTime start = rtClock.getTime();
            AbsoluteTime end = rtClock.getTime();
            RelativeTime[] intervals = new RelativeTime[ITERATIONS];
    
                    
            for (int i = 0; i < ITERATIONS; i++) {
                start = rtClock.getTime();
                
                // add some things
                
                // done
                
                waitForNextPeriod();
                
                end = rtClock.getTime();
                intervals[i] = end.subtract(start);
                
            }
            
            for (int i = 0; i < intervals.length; i++) {
                System.out.println(intervals);

    }
    }


    }
     
    
    The cyclic driver installation went OK, but I guess it does not really work on the Virtual Machine on top of Windows.
    Here's the info you have been asking for:
    
    # pkginfo | grep cyclic
    system      SUNWrtjc                         Java Real-Time System cyclic driver
    
    # modinfo | grep cyclic
    #
    
    # dmesg | grep cyclic
    Jul 27 16:21:19 unknown pseudo: [ID 129642 kern.info] pseudo-device: cyclic0
    Jul 27 16:21:19 unknown genunix: [ID 936769 kern.info] cyclic0 is /pseudo/cyclic@0
    
    # uname -a
    SunOS unknown 5.10 Generic_127128-11 i86pc i386 i86pc
    
    Thanks a lot again !
    
    Sergiu                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
  • 5. Re: RTJ on vmware/virtualBox
    807557 Newbie
    Currently Being Moderated
    bsergiu wrote:
    I am sorry for not being clear on that. Of course that "SomeThread" is a subclass of the RealtimeThread.That is not the reason for that ClassCastException.
    The reason appears to be that you called SomeThread.run() directly from your main thread instead of starting your SomeThread instance:

    Exception in thread "main" java.lang.ClassCastException: java.lang.Thread
    at javax.realtime.RealtimeThread.currentRealtimeThread(RealtimeThread.java:51)
    at javax.realtime.RealtimeThread.waitForNextPeriod(RealtimeThread.java:275)
    at com.lhs.realtime.test.SomeThread.run(SomeThread.java:42)
    at r2t.Main.main(Main.java:29)

    This issue is not related to the cyclic driver.
    # pkginfo | grep cyclic
    system SUNWrtjc Java Real-Time System cyclic driver
    Ok - it seemed to install

    Does /dev/cyclic exist? It should be a link:

    /dev/cyclic -> ../devices/pseudo/cyclic@0:cyclic

    If the link doesn't exist does the /devices entry?
    # modinfo | grep cyclic
    #
    Not good, it doesn't seem to be loaded.
    # dmesg | grep cyclic
    Jul 27 16:21:19 unknown pseudo: [ID 129642 kern.info] pseudo-device: cyclic0
    Jul 27 16:21:19 unknown genunix: [ID 936769 kern.info] cyclic0 is /pseudo/cyclic@0
    That seems ok. And importantly there are no error messages - so I don't understand what part of the process has not worked.
    # uname -a
    SunOS unknown 5.10 Generic_127128-11 i86pc i386 i86pc
    That seems to be a recently patched, up to date version.

    You're not running zones by any chance are you?

    David Holmes

    Edited by: davidholmes on Jul 28, 2009 1:14 PM
  • 6. Re: RTJ on vmware/virtualBox
    807557 Newbie
    Currently Being Moderated
    Hi David,

    That call to SomeThread.run() instead of start() was a silly mistake from my side ... sorry for that :(

    And I have good news. Basically, when I have installed the cyclic driver, the APIC was not enabled. I have enabled it after the installation, and that may be the cause why it did not work.
    Now I have installed the cyclic driver making sure that the APIC has been enabled before.
    I still get the same results when I type the commands above, but IT WORKS!
    The time intervals are not accurate (see below), but from my perspective, this is OK and acceptable (for development purposes):

    (18 ms, 95535 ns)
    (19 ms, 876214 ns)
    (19 ms, 948786 ns)
    (20 ms, 930697 ns)
    (19 ms, 101747 ns)
    (20 ms, 26756 ns)
    (19 ms, 873917 ns)
    (20 ms, 118315 ns)
    (20 ms, 6934 ns)
    (19 ms, 827741 ns)
    (21 ms, 82528 ns)
    (18 ms, 954577 ns)
    (20 ms, 72383 ns)
    (19 ms, 970593 ns)
    (19 ms, 996664 ns)
    (20 ms, 466764 ns)
    (19 ms, 436621 ns)
    (19 ms, 945523 ns)
    (19 ms, 970382 ns)
    (20 ms, 181735 ns)
    (19 ms, 825479 ns)
    (20 ms, 61335 ns)
    (19 ms, 861085 ns)
    (19 ms, 981713 ns)
    (20 ms, 119731 ns)
    (20 ms, 213753 ns)
    (19 ms, 637736 ns)
    (19 ms, 990728 ns)
    (20 ms, 106899 ns)
    (19 ms, 982385 ns)
    (19 ms, 853512 ns)
    (20 ms, 70999 ns)
    (21 ms, 937473 ns)
    (18 ms, 116541 ns)
    (19 ms, 886148 ns)
    (20 ms, 35526 ns)
    (20 ms, 180006 ns)
    (19 ms, 825353 ns)
    (19 ms, 800106 ns)
    (19 ms, 998550 ns)
    (20 ms, 6013 ns)
    (20 ms, 93107 ns)

    David, thanx again for your support !

    Best regards,

    Sergiu
  • 7. Re: RTJ on vmware/virtualBox
    807557 Newbie
    Currently Being Moderated
    Glad to see this was resolved.

    David
  • 8. Re: RTJ on vmware/virtualBox
    800341 Newbie
    Currently Being Moderated
    Thanks a lot for both of u

    now it runs on my virtual machine as well ;)

    Thanks a lot
    Ramsundar