00001 // kernel.h 00002 // Global variables for the Nachos kernel. 00003 // 00004 // Copyright (c) 1992-1996 The Regents of the University of California. 00005 // All rights reserved. See copyright.h for copyright notice and limitation 00006 // of liability and disclaimer of warranty provisions. 00007 00008 #ifndef KERNEL_H 00009 #define KERNEL_H 00010 00011 #include "copyright.h" 00012 #include "debug.h" 00013 #include "utility.h" 00014 #include "thread.h" 00015 #include "scheduler.h" 00016 #include "interrupt.h" 00017 #include "stats.h" 00018 #include "alarm.h" 00019 #include "filesys.h" 00020 #include "machine.h" 00021 00022 class PostOfficeInput; 00023 class PostOfficeOutput; 00024 class SynchConsoleInput; 00025 class SynchConsoleOutput; 00026 class SynchDisk; 00027 00028 class Kernel { 00029 public: 00030 Kernel(int argc, char **argv); 00031 // Interpret command line arguments 00032 ~Kernel(); // deallocate the kernel 00033 00034 void Initialize(); // initialize the kernel -- separated 00035 // from constructor because 00036 // refers to "kernel" as a global 00037 00038 void ThreadSelfTest(); // self test of threads and synchronization 00039 00040 void ConsoleTest(); // interactive console self test 00041 00042 void NetworkTest(); // interactive 2-machine network test 00043 00044 // These are public for notational convenience; really, 00045 // they're global variables used everywhere. 00046 00047 Thread *currentThread; // the thread holding the CPU 00048 Scheduler *scheduler; // the ready list 00049 Interrupt *interrupt; // interrupt status 00050 Statistics *stats; // performance metrics 00051 Alarm *alarm; // the software alarm clock 00052 Machine *machine; // the simulated CPU 00053 SynchConsoleInput *synchConsoleIn; 00054 SynchConsoleOutput *synchConsoleOut; 00055 SynchDisk *synchDisk; 00056 FileSystem *fileSystem; 00057 PostOfficeInput *postOfficeIn; 00058 PostOfficeOutput *postOfficeOut; 00059 00060 int hostName; // machine identifier 00061 00062 private: 00063 bool randomSlice; // enable pseudo-random time slicing 00064 bool debugUserProg; // single step user program 00065 double reliability; // likelihood messages are dropped 00066 char *consoleIn; // file to read console input from 00067 char *consoleOut; // file to send console output to 00068 #ifndef FILESYS_STUB 00069 bool formatFlag; // format the disk if this is true 00070 #endif 00071 }; 00072 00073 00074 #endif // KERNEL_H 00075 00076