5 Replies Latest reply on Apr 12, 2009 4:00 AM by 807557

    Designing a new scheduling policy


      I am relatively new to the RTSJ environment and I would appreciate a couple of pointers. I would like to design a new scheduling policy (and I particularly interested in EDF, laxity-based schedulers and time-utility function schedulers). Since I am relatively new to the platform, I am having a spot of trouble trying to get started.

      I believe that the natural place to begin is to extend javax.realtime.Scheduler. So that is what I did. The problem is that I do not know how I would go about implementing the scheduling policy using the inherited methods.

      In an effort to better understand how scheduling policies are implemented in RTSJ, I downloaded a copy of the jRate RTSJ implementation to examine its PriorityScheduler class (I use an education version of Sun's RTSJ for my actual research). The PriorityScheduler class from jRate did not clarify the process for me, it appears to consist of a set of functions to get the max,min and norm priorities, to perform feasibility analysis on the schedule and to verify that the appropriate scheduling parameters have been set in the threads being handled. However, I do not see a place where the actual implementation of the scheduling policy exists.

      Would it be possible for someone to either tell me how to design a new scheduling policy for RTSJ or to point me to some examples or docs that would help me get started?

      Thanks and sorry for the bother.
        • 1. Re: Designing a new scheduling policy
          Please forgive the many typos in the post above.
          • 2. Re: Designing a new scheduling policy
            The RTSJ doesn't currently support user-defined Schedulers. As you have found, the methods exposed by Scheduler/PriorityScheduler don't provide access to any interesting functionality as far as the actual scheduling is concerned. In most implementation the actual scheduling is done by the operating system and all the RTSJ implementation has to do is set the priority.

            Creating your own scheduler that provides a variation of priority-preemptive scheduling might not be impossible - and I think that the folks at York University in the UK managed to create an EDF scheduler, but I'm not sure if they had to modify the VM to do it. In theory you can approximate the EDF scheduler (or a least-laxity scheduler, I think) by hooking into the thread start() method to dynamically update all the priorities when a new thread is started; but tapping into the AsyncEventHandler release scheme is more awkward.

            Bottom line is that currently only the RTSJ implementation is expected to be able to define new schedulers.

            David Holmes

            Edited by: davidholmes on Apr 11, 2009 9:34 AM
            • 3. Re: Designing a new scheduling policy
              Thanks for the prompt reply. I will see what I can do re approximating other scheduling policies using the priority scheduler as a base.
              • 4. Re: Designing a new scheduling policy
                Sorry for the addition, but is there a plan to add other scheduling policies, besides priority scheduling, to Sun's RTSJ sometime soon?
                • 5. Re: Designing a new scheduling policy
                  Sorry, there are no currently announced plans for any additional schedulers in Sun's Java RTS product.

                  David Holmes