ARINC653 Scheduler: Difference between revisions

From Xen
Jump to navigationJump to search
Line 28: Line 28:
{
{
/* identify domain by UUID */
/* identify domain by UUID */
parse_uuid(DOMN_UUID_STRING, (uuid_t)sched.sched_entries[i].dom_handle);
parse_uuid(DOMN_UUID_STRING, sched.sched_entries[i].dom_handle);


/* must be 0 */
/* must be 0 */

Revision as of 20:34, 26 November 2013

ARINC653 CPU Scheduler

Introduction

The ARINC653 scheduler is a periodically repeating fixed timeslice scheduler. Multicore support is not yet implemented.

Usage

  1. add "sched=arinc653 maxcpus=1" on Xen's boot command line.
  2. update domain configs to use only 1 PCPU for all domains.
  3. update domain configs to use only 1 VCPU per domain.
  4. create domains as usual.
  5. call the arinc653_schedule_set API with an ARINC653 scheduler structure

Example

    #include <xenctrl.h>
    #include <uuid/uuid.h>
    ...

    struct xen_sysctl_arinc653_schedule sched;
    xc_interface *xci = xc_interface_open(NULL, NULL, 0);
    int i;

    /* initialize major frame and number of minor frames */
    sched.major_frame = 0;
    sched.num_sched_entries = NUM_MINOR_FRAMES;

    for (i = 0, i < sched.num_sched_entries; ++i)
    {
        /* identify domain by UUID */
        parse_uuid(DOMN_UUID_STRING, sched.sched_entries[i].dom_handle);

        /* must be 0 */
        sched.sched_entries[i].vcpu_id = 0;

        /* runtime in ms */
        sched.sched_entries[i].runtime = DOMN_RUNTIME;

        /* updated major frame time */
        sched.major_frame += sched.sched_entries[i].runtime;
    }

    xc_sched_arinc653_schedule_set(xci, (struct xen_sysctl_arinc653_schedule *)as);

Algorithm

The ARINC653 schedule configuration provides the major frame duration, as well as the sequence of minor frames within this major frame. Each minor frame is specified by a domain/timeslice pair.

At the beginning of the major frame, the scheduler runs the VCPU corresponding with the domain of the first minor frame within the schedule. When it's timeslice has completed the scheduler runs the VCPU corresponding with the domain of the next minor frame within the schedule until there are no more minor frames remaining or until the major frame has expired. When the major frame expires the process is restarted.

If all minor frames have expired and there is still time remaining in the major frame, the idle domain is scheduled until the completion of the major frame.

If a domain listed in the schedule is not found, the idle domain is scheduled in its place. While there are no gaps allowed in the schedule configuration, this allows for a similar affect to be achieved by the use of a non-existent dummy domain.

Glossary of Terms

  • Major Frame: Peridiocally repeating scheduling frame of fixed duration.
  • Minor Frame: Divisions within the major frame.
  • VCPU: Virtual CPU (Only one per domain is allowed with the ARINC653 scheduler)
  • Timeslice: The timeslice a VCPU receives before being preempted to run another. (i.e. The duration of the minor frame.)