Class Scheduler
java.lang.Object
|
+----Scheduler
- public abstract class Scheduler
- extends Object
-
Scheduler()
-
-
add(Job, int)
- Add a new job wanting service.
-
printQueue()
- For debugging: print the queue of waiting jobs
-
printStats()
- Print statistics about the history of this queue.
-
queueChanged(int)
- This method should be called by a subclass whenever the queue length
changes.
-
remove()
- Retrieve (and remove) the next job to be served.
-
reschedule(int)
- This method is called when there is a clock interrupt.
Scheduler
public Scheduler()
add
public abstract boolean add(Job j,
int timeLeft)
- Add a new job wanting service.
The second argument is the amount of time remaining before the
job currently using the device will finish (-1 if the device is idle).
Return TRUE if this scheduler would like to preempt the current
job.
remove
public abstract Job remove()
- Retrieve (and remove) the next job to be served.
Return null if there is no such job.
reschedule
public abstract boolean reschedule(int timeLeft)
- This method is called when there is a clock interrupt.
It returns true if there is a reason to stop the current process
and run another one instead.
The argument is the amount of time left until the current job
finishes service on the device.
printQueue
public abstract void printQueue()
- For debugging: print the queue of waiting jobs
queueChanged
protected void queueChanged(int amount)
- This method should be called by a subclass whenever the queue length
changes.
printStats
public void printStats()
- Print statistics about the history of this queue.