|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--Scheduler
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.
DiskScheduler,
RRScheduler| Field Summary | |
private int |
lastChanged
The last time the queue length changed |
private int |
lenSum
The time integral of queue length |
private int |
maxLen
The maximum queue length |
private static int |
MAXQUEUE
The max queue length we tally in the histogram |
private int |
qlen
The current queue length |
private int[] |
queueHist
The amount of time the queue had a given length |
| Constructor Summary | |
(package private) |
Scheduler()
|
| Method Summary | |
abstract boolean |
add(Job j)
Add a new job wanting service. |
abstract void |
printQueue()
For debugging: print the queue of waiting jobs |
void |
printStats()
Print statistics about the history of this queue. |
protected void |
queueChanged(int amount)
This method should be called by a subclass whenever the queue length changes. |
abstract Job |
remove()
Retrieve (and remove) the next job to be served. |
abstract boolean |
reschedule(Job j)
This method is called when there is a clock interrupt, and just after a job changes state. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private static final int MAXQUEUE
private int qlen
private int lastChanged
private int maxLen
private int lenSum
private int[] queueHist
| Constructor Detail |
Scheduler()
| Method Detail |
public abstract boolean add(Job j)
j - the job to servepublic abstract Job remove()
public abstract boolean reschedule(Job j)
j - the job currently being serviced by the corresponding device.public abstract void printQueue()
protected void queueChanged(int amount)
public void printStats()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||