Class Scheduler
java.lang.Object
   |
   +----Scheduler
  -  abstract class Scheduler
  -  extends Object
A Scheduler schedules jobs seeking service from a Device.
 The class Scheduler itself is "abstract", meaning that there are no
 instance of Scheduler, only of its subclasses.
 This simulation has two Schedulers:  DiskScheduler for scheduling the
 disk and RRScheduler for scheduling the CPU.
 The base class takes care of maintaining statistics on queue lengths.
 The subclasses do all the actual work.
    -  See Also:
    
-  DiskScheduler, RRScheduler
   
  -   lastChanged lastChanged
-  The last time the queue length changed
  
-   lenSum lenSum
-  The time integral of queue length
  
-   maxLen maxLen
-  The maximum queue length
  
-   MAXQUEUE MAXQUEUE
-  The max queue length we tally in the histogram
  
-   qlen qlen
-  The current queue length
  
-   queueHist queueHist
-  The amount of time the queue had a given length
   
  -   Scheduler() Scheduler()
-  
   
  -   add(Job) add(Job)
-  Add a new job wanting service.
  
-   printQueue() printQueue()
-  For debugging: print the queue of waiting jobs
  
-   printStats() printStats()
-  Print statistics about the history of this queue.
  
-   queueChanged(int) queueChanged(int)
-  This method should be called by a subclass whenever the queue length
 changes.
  
-   remove() remove()
-  Retrieve (and remove) the next job to be served.
  
-   reschedule(Job) reschedule(Job)
-  This method is called when there is a clock interrupt, and just
 after a job changes state.
   
 MAXQUEUE
MAXQUEUE
 private static final int MAXQUEUE
  -  The max queue length we tally in the histogram
 
 qlen
qlen
 private int qlen
  -  The current queue length
 
 lastChanged
lastChanged
 private int lastChanged
  -  The last time the queue length changed
 
 maxLen
maxLen
 private int maxLen
  -  The maximum queue length
 
 lenSum
lenSum
 private int lenSum
  -  The time integral of queue length
 
 queueHist
queueHist
 private int queueHist[]
  -  The amount of time the queue had a given length
 
   
 Scheduler
Scheduler
 Scheduler()
   
 add
add
 public abstract boolean add(Job j)
  -  Add a new job wanting service.
   
- 
    -  Parameters:
    
-  j - the job to serve
    
-  Returns:
    
-  true if this scheduler would like to preempt the current
 job.
  
 
 remove
remove
 public abstract Job remove()
  -  Retrieve (and remove) the next job to be served.
   
- 
    -  Returns:
    
-  the next job (null if there is no such job).
  
 
 reschedule
reschedule
 public abstract 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.
  
 
 printQueue
printQueue
 public abstract void printQueue()
  -  For debugging: print the queue of waiting jobs
 
 queueChanged
queueChanged
 protected void queueChanged(int amount)
  -  This method should be called by a subclass whenever the queue length
 changes.
 
 printStats
printStats
 public void printStats()
  -  Print statistics about the history of this queue.