Class RRScheduler

java.lang.Object
   |
   +----Scheduler
           |
           +----RRScheduler

class RRScheduler
extends Scheduler
A round-robin Scheduler for a CPU. It maintains a linked list of jobs. This scheduler is remarkably similar to the DiskScheduler.


Variable Index

 o head
The head of a queue of jobs awaiting service.
 o tail

Constructor Index

 o RRScheduler()

Method Index

 o add(Job)
Add a new job wanting service.
 o printQueue()
For debugging: print the queue of waiting jobs
 o queueString()
For debugging.
 o remove()
Retrieve (and remove) the next job to be served.
 o reschedule(Job)
This method is called when there is a clock interrupt, and just after a job changes state.

Variables

 o head
 private Job head
The head of a queue of jobs awaiting service. If the queue is empty, head = null and the value of tail is undefined.

 o tail
 private Job tail

Constructors

 o RRScheduler
 RRScheduler()

Methods

 o add
 public boolean add(Job j)
Add a new job wanting service.

Parameters:
j - the job to serve
Returns:
false (this scheduler never preempts)
Overrides:
add in class Scheduler
 o remove
 public Job remove()
Retrieve (and remove) the next job to be served. Return null if there is no such job.

Overrides:
remove in class Scheduler
 o reschedule
 public boolean reschedule(Job j)
This method is called when there is a clock interrupt, and just after a job changes state.

Parameters:
j - the job currently being serviced by the corresponding device.
Returns:
true if the scheduler wants to preempt the current job.
Overrides:
reschedule in class Scheduler
 o printQueue
 public void printQueue()
For debugging: print the queue of waiting jobs

Overrides:
printQueue in class Scheduler
 o queueString
 private String queueString()
For debugging.

Returns:
a concise version of the queue of waiting jobs