Class CPU

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--CPU
All Implemented Interfaces:
java.lang.Runnable

public class CPU
extends java.lang.Thread
implements java.lang.Runnable


Field Summary
 Clock BigBen
           
 Queue FIFO
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
 float execute()
          Take out the process which is being run and get the next process from the queue
 float getCompletion()
          Accesor method to read the mean completion time
 float getOverhead()
          Accesor method to read the context-switch overhead
 int getQuantum()
          Accesor method to read the quantum
 void pause()
          Pause the execution of the CPU
 void restart()
          Restart the execution of the CPU, set all attributes with the default values
 void run()
          Call execute method and sleep
static void setOverhead(float newOverhead)
          Accesor method to modify the context-switch overhead
static void setQuantum(float q)
          Accesor method to modify the quantum
 void turnoff()
          Stop the execution of the CPU
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIFO

public Queue FIFO

BigBen

public Clock BigBen
Method Detail

getQuantum

public int getQuantum()
Accesor method to read the quantum

setQuantum

public static void setQuantum(float q)
Accesor method to modify the quantum
Parameters:
q - float the quantum new value

getOverhead

public float getOverhead()
Accesor method to read the context-switch overhead

setOverhead

public static void setOverhead(float newOverhead)
Accesor method to modify the context-switch overhead
Parameters:
newOverhead - float the new Overhead

getCompletion

public float getCompletion()
Accesor method to read the mean completion time

execute

public float execute()
Take out the process which is being run and get the next process from the queue

restart

public void restart()
Restart the execution of the CPU, set all attributes with the default values

pause

public void pause()
Pause the execution of the CPU

turnoff

public void turnoff()
Stop the execution of the CPU

run

public void run()
Call execute method and sleep
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread