|
| |
![]() |
|
Introduction to InterruptsNachos has data structures and routines to simulate hardware interrupts. The classes that implements the Interrupt are Interrupt and PendingInterrupt. There are also some important structures that represents the interrupt status in the system. These are: MachineStatus, IntType, IntStatus. The classes and structures are described below. InterruptThis class defines the data structures for the simulation of hardware interrupts. The object property 'level' shows if interrupts are enabled or disabled. Only two levels are supported in Nachos; interrupt on and nterrupt off. The class has several methods that controls the interrupt status. The method 'SetLevel' should e mentioned, since it is heavily used in Nachos to enable/disable interrupts. The code below shows how to disable interrupts, where interrupt is a global interrupt variable and IntOff is the level meaning that interrupts re disabled.
interrupt->SetLevel(IntOff)
PendingInterruptThe PendingInterrupt class defines an interrupt that is scheduled to occur in the future. This is the class to use when a new interrupt is to be simulated. TimerThe Timer class simulates a real-time clock in Nachos by generating interrupts at regular intervals. The interval length is defined through the constant TimerTicks in stats.h. In practice, the interval length is calculated by choosing a random number between 1 and 2 * TimerTicks units. When this time have passed, the CPU is interrupted. |
Nachos Introduction Tutorials |
| © 1999-2008 - All rights reserved. CS tutorials™ and the logo are registered trademarks of CS tutorials. | |