This commit is contained in:
2024-12-30 05:59:42 +08:00
parent bf78b95c9d
commit 72320ede22
42 changed files with 1758 additions and 1556 deletions

View File

@@ -25,31 +25,34 @@ class SynchConsoleInput;
class SynchConsoleOutput;
class SynchDisk;
// Todo ----
// ---------
class Kernel {
public:
Kernel(int argc, char **argv);
// Interpret command line arguments
// Interpret command line arguments
~Kernel(); // deallocate the kernel
void Initialize(); // initialize the kernel -- separated
// from constructor because
// refers to "kernel" as a global
// from constructor because
// refers to "kernel" as a global
void ExecAll();
int Exec(char* name);
// Todo ----
int Exec(char* name, int priority);
// ---------
void ThreadSelfTest(); // self test of threads and synchronization
void ConsoleTest(); // interactive console self test
void NetworkTest(); // interactive 2-machine network test
Thread* getThread(int threadID){return t[threadID];}
Thread* getThread(int threadID){return t[threadID];}
void PrintInt(int n);
int CreateFile(char* filename); // fileSystem call
// These are public for notational convenience; really,
// they're global variables used everywhere.
// These are public for notational convenience; really,
// they're global variables used everywhere.
Thread *currentThread; // the thread holding the CPU
Scheduler *scheduler; // the ready list
@@ -60,17 +63,21 @@ class Kernel {
SynchConsoleInput *synchConsoleIn;
SynchConsoleOutput *synchConsoleOut;
SynchDisk *synchDisk;
FileSystem *fileSystem;
FileSystem *fileSystem;
PostOfficeInput *postOfficeIn;
PostOfficeOutput *postOfficeOut;
FrameTable *frameTable;
int hostName; // machine identifier
private:
Thread* t[10];
// Todo ----
char* execfile[10];
int execPriority[10];
// ---------
int execfileNum;
int threadNum;
bool randomSlice; // enable pseudo-random time slicing
@@ -85,5 +92,3 @@ class Kernel {
#endif // KERNEL_H