Sketch out in pseudo-code how you would add a simple round robin scheduler to the Xen hypervisor

What will be an ideal response?

In order to answer this question, it is first necessary to appreciate the steps required to implement a new scheduler.
To introduce anew scheduler, the following steps must be carried out:

• Provide an implementation of various functions defined in an abstract interface, with these functions including operations to initialise the scheduler, initialise and destroy a domain, initialise and destroy a VCPU, sleep, wake and a call to determine the next VCPU to be scheduled (do_schedule);
• Create a data structure (struct Scheduler) that contains the full name, short name and ID for this scheduler together with pointers to the above functions (for some schedulers certain functions can be NULL);
• Add this to a static array of schedulers with the user able to specify the scheduler to be used at boot time. As an example, the following is a minimal specification of a simple scheduler, where simple_vcpu_init,
simple_vcpu_destroy and simple_schedule are implementations of the respective functions:
```
struct scheduler sched_simpleRR_def = {
.name = "Simple Round Robin Scheduler",
.opt_name = "simpleRR",
.sched_id = 7,
.init_vcpu = simple_vcpu_init,
.destroy_vcpu = simple_vcpu_destroy,
.do_schedule = simple_schedule,
};
```
It is then necessary to implement the three functions above. Let us first assume the existence of a singly linked list of VCPUs. The pseudo code for the three functions is then as follows
simple_vcpu_init (struct vcpu *v)
{

}

simple_vcpu_destroy (struct vcpu *v)
{

}

simple_do_schedule ()
{


};

Computer Science & Information Technology

You might also like to view...

What are some of the advantages of creating an enumeration type?

What will be an ideal response?

Computer Science & Information Technology

In a two-dimensional object, the ____ axis represents the height.

A. A B. B C. X D. Y

Computer Science & Information Technology