nachos.machine
Class Interrupt

java.lang.Object
  extended by nachos.machine.Interrupt

public class Interrupt
extends java.lang.Object

This class provides methods by which the OS can control the interrupt-handling features of the CPU. A method (setLevel) is provided to enable and disable interrupts. Other methods are provided to halt the simulation and to idle the CPU if there is nothing in the ready queue to run. Internally, this class keeps track of all the interrupts the hardware devices would cause, together with when they are supposed to occur. It is responsible for generating calls to the device interrupt handlers at the proper times. Much of this functionality is hidden, and you need not be concerned with it.


Field Summary
static int IntOff
          Interrupts can be disabled (IntOff) or enabled (IntOn)
static int IntOn
          Interrupts can be disabled (IntOff) or enabled (IntOn)
 
Constructor Summary
Interrupt()
           
 
Method Summary
static int getLevel()
          Determine the current interrupt level.
static void halt()
          Shut down Nachos cleanly, printing out performance statistics.
static void idle()
          Routine called when there is nothing in the ready queue.
static int setLevel(int now)
          Change interrupts to be enabled or disabled, and if interrupts are being enabled, advance simulated time by calling OneTick().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IntOff

public static final int IntOff
Interrupts can be disabled (IntOff) or enabled (IntOn)

See Also:
Constant Field Values

IntOn

public static final int IntOn
Interrupts can be disabled (IntOff) or enabled (IntOn)

See Also:
Constant Field Values
Constructor Detail

Interrupt

public Interrupt()
Method Detail

getLevel

public static int getLevel()
Determine the current interrupt level.

Returns:
the current interrupt level.

setLevel

public static int setLevel(int now)
Change interrupts to be enabled or disabled, and if interrupts are being enabled, advance simulated time by calling OneTick().

Parameters:
now - The new interrupt status.
Returns:
The old interrupt status.

idle

public static void idle()
Routine called when there is nothing in the ready queue. Since something has to be running in order to put a thread on the ready queue, the only thing to do is to advance simulated time until the next scheduled hardware interrupt. If there are no pending interrupts, stop. There's nothing more for us to do.


halt

public static void halt()
Shut down Nachos cleanly, printing out performance statistics.