home tutorials faq contact
CS tutorials Share you information

Introduction to Interrupts

Nachos 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.

Interrupt

This 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)

PendingInterrupt

The 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.

Timer

The 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.

Continue to Lab 1 Tutorial

Nachos
Tutorials
Roadmap
Source Code

Introduction
Threads
Interrupts
Synchronization
System Calls
Exception Handling
Multiprogramming
File System
Networking

Tutorials
Lab 1 Tutorial
Lab 2 Tutorial
Lab 3 Tutorial
Lab 4 Tutorial
Lab 5 Tutorial


© 1999-2008 - All rights reserved. CS tutorials™ and the logo are registered trademarks of CS tutorials.