Class DiskScheduler
java.lang.Object
|
+----Scheduler
|
+----DiskScheduler
- class DiskScheduler
- extends Scheduler
A FCFS scheduler for the disk.
It maintains a simple queue of jobs.
-
head
- The head of a queue of jobs awaiting service.
-
tail
-
-
DiskScheduler()
-
-
add(Job)
- Add a new job wanting service.
-
printQueue()
- For debugging: print the queue of waiting jobs
-
remove()
- Retrieve (and remove) the next job to be served.
-
reschedule(Job)
- This method is called when there is a clock interrupt, and just
after a job changes state.
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.
tail
private Job tail
DiskScheduler
DiskScheduler()
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
remove
public Job remove()
- Retrieve (and remove) the next job to be served.
- Returns:
- the next job (null if there is no such job).
- Overrides:
- remove in class Scheduler
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
printQueue
public void printQueue()
- For debugging: print the queue of waiting jobs
- Overrides:
- printQueue in class Scheduler