tac0S
Template Affectional Command Operating System
Classes | Enumerations
interrupt.h File Reference

Data structures to emulate low-level interrupt hardware. More...

#include "copyright.h"
#include "list.h"

Go to the source code of this file.

Classes

class  PendingInterrupt
 The following class defines an interrupt that is scheduled to occur in the future. The internal data structures are left public to make it simpler to manipulate. More...
 
class  Interrupt
 

Enumerations

enum  IntStatus { IntOff, IntOn }
 Interrupts can be disabled (IntOff) or enabled (IntOn)
 
enum  MachineStatus { IdleMode, SystemMode, UserMode }
 Nachos can be running kernel code (SystemMode), user code (UserMode), or there can be no runnable thread, because the ready list is empty (IdleMode).
 
enum  IntType {
  TimerInt, DiskInt, ConsoleWriteInt, ConsoleReadInt,
  NetworkSendInt, NetworkRecvInt
}
 IntType records which hardware device generated an interrupt. In Nachos, we support a hardware timer device, a disk, a console display and keyboard, and a network.
 

Detailed Description

Data structures to emulate low-level interrupt hardware.

Author
Olivier Hureau, Hugo Feydel , Julien ALaimo The hardware provides a routine (SetLevel) to enable or disable interrupts.

In order to emulate the hardware, we need to keep track of all interrupts the hardware devices would cause, and when they are supposed to occur.

This module also keeps track of simulated time. Time advances only when the following occur: interrupts are re-enabled a user instruction is executed there is nothing in the ready queue

As a result, unlike real hardware, interrupts (and thus time-slice context switches) cannot occur anywhere in the code where interrupts are enabled, but rather only at those places in the code where simulated time advances (so that it becomes time to invoke an interrupt in the hardware simulation).

NOTE: this means that incorrectly synchronized code may work fine on this hardware simulation (even with randomized time slices), but it wouldn't work on real hardware. (Just because we can't always detect when your program would fail in real life, does not mean it's ok to write incorrectly synchronized code!)

DO NOT CHANGE – part of the machine emulation

Copyright (c) 1992-1993 The Regents of the University of California. All rights reserved. See copyright.h for copyright notice and limitation of liability and disclaimer of warranty provisions.