|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--Job
A Job represents one customer of services. It records the job's current state as well as statistics about its lifetime. It generally spends its lifetime moving form Server to Server.
One Job is created from each line of the input trace file.
The resources required by a Job are characterized by an amount `cpuNeeded' of CPU time (all times are in milliseconds) and a number `ioNeeded' of I/O operations, each representing one disk transfer of Sim.BLOCKSIZE bytes of data. The CPU time is assumed to be distributed as evenly as possible into ioNeeded "bursts" of cpu time, each followed by an I/O operation (unless the job does no I/O at all).
Note the terminology: A "burst" is the amount of computing a Job wants to do before choosing to do I/O. Depending on the CPU scheduing algorithm in force, these bursts may be divided into "quanta" (plural of "quantum").
| Field Summary | |
(package private) int |
arrivalTime
Arrival time in ms from start of simulation |
static int |
BLOCKED
Job needs to do an I/O operation next |
int |
burst
size of current burst |
private int |
burstRemaining
amount in current burst (until next I/O op) remaining |
int |
burstStart
time when current burst started (job "arrived" at the cpu queue) |
private int |
cpuNeeded
Total CPU time (ms) required by this job |
private int |
cpuRemaining
total amount of CPU time (in ms) left to consume |
static int |
DONE
Job has completed |
private int |
ioNeeded
Total number of I/O operations required by this job |
private int |
ioRemaining
number of I/O operations left to do |
private static int |
lastSerial
Counter used for assigning serial numbers to Jobs (for debugging output). |
private int |
lastStart
time when this Jobs last started using the CPU |
private java.lang.String |
name
Name of this job (for debugging) |
(package private) Job |
next
Link for linking into queues |
private java.util.Random |
rand
random number generator used by newBurst |
static int |
READY
Job is ready to run |
private int |
serial
Serial number of this job (for debugging) |
private java.util.Vector |
trace
Trace of significant events in this job's lifetime (only if Sim.traceFlag) |
| Constructor Summary | |
Job(java.io.BufferedReader traceFile)
Create a Job from a line of the trace file. |
|
| Method Summary | |
void |
doIO()
Called when this Job does an I/O operation |
JobStats |
finish()
This job is finished. |
private void |
newBurst()
Recaculate the amount of CPU to be used by this job before the next I/O operation: the amount of cpu time remaining divided by the number of I/O operations remaining, rounded up. |
int |
nextBurst()
Return the amount of CPU time remaining for this job until it next does I/O, or completes. |
void |
start()
Called when this Job is started running on the CPU |
int |
state()
What is the current state of this Job? |
void |
stop()
Called when this Job is removed from the CPU |
java.lang.String |
toString()
For debugging, information about this device. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private java.lang.String name
private int serial
private java.util.Vector trace
Job next
int arrivalTime
private int cpuNeeded
private int ioNeeded
private int ioRemaining
private int cpuRemaining
public int burst
private int burstRemaining
public int burstStart
private int lastStart
private java.util.Random rand
private static int lastSerial
public static final int DONE
public static final int BLOCKED
public static final int READY
| Constructor Detail |
public Job(java.io.BufferedReader traceFile)
throws java.io.EOFException
traceFile - the file to read from.| Method Detail |
public java.lang.String toString()
public int state()
public void start()
public void stop()
public int nextBurst()
public void doIO()
public JobStats finish()
private void newBurst()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||