Example #1
0
 public Loader(Driver k)
 {
     kernel = k;
     this.disk = k.Disk;
     this.RAM = k.RAM;
     this.NPQ = k.NewProcessQueue;
 }
Example #2
0
 public static void CoreDump(Driver k, int batchNumber)
 {
     StreamWriter writer = new StreamWriter(//@"C:\Users\Cory\Documents\Visual Studio 2010\Projects\GitProjects\OS-Project\OS_PROJECT\OS_PROJECT\CoreDumpBatch" + batchNumber + ".txt", false);
         @"\\cse6\student\crichers\OS-Project\OS_PROJECT\OS_PROJECT\CoreDumpBatch" + batchNumber + ".txt", false);
     Console.WriteLine("--------------------------------------");
     Console.WriteLine("CORE DUMP -- WRITING MEMORY TO FILE:");
     Console.WriteLine("CoreDumpBatch" + batchNumber + ".txt");
     Console.WriteLine("--------------------------------------");
     for (uint i = 0; i < k.RAM.GetMemorySize(); i++)
     {
         if (i < 10)
         {
             writer.Write("[000" + i + "]");
         }
         else if (i < 100)
         {
             writer.Write("[00" + i + "]");
         }
         else if (i < 1000)
         {
             writer.Write("[0" + i + "]");
         }
         else
         {
             writer.Write("[" + i + "]");
         }
         writer.Write(SystemCaller.ConvertInputDataToHexstring(k.RAM.ReadDataFromMemory(i)));
         //writer.Write(k.RAM.ReadDataFromMemory(i));
         writer.WriteLine();
     }
     writer.Close();
 }
 public LongTermScheduler(Driver k)
 {
     kernel = k;
     disk = k.Disk;
     RAM = k.RAM;
     NPQ = k.NewProcessQueue;
     WQ = k.WaitingQueue;
     RQ = k.ReadyQueue;
 }
Example #4
0
 private MMU(Driver k)
 {
     kernel = k;
     for (uint iterator = 0; iterator < 256; iterator++)
     {
         FrameTable[iterator].IsFree = true;
         FrameTable[iterator].Page = 0;
         FrameTable[iterator].ProcessID = 0;
     }
 }
Example #5
0
 public CPU(Driver k, int id)
 {
     kernel = k;
     disk = k.Disk;
     RAM = k.RAM;
     RQ = k.ReadyQueue;
     cpuPCB = new PCB();
     cache = new uint[1];
     this.id = id;
     thread = new Thread(new ThreadStart(this.Run));
     _suspendEvent = new ManualResetEventSlim(false);
     thread.Start();
 }
Example #6
0
 public static void CoreDumpByProccess(Driver k, int batchNumber)
 {
     StreamWriter writer = new StreamWriter(//@"C:\Users\Cory\Documents\Visual Studio 2010\Projects\GitProjects\OS-Project\OS_PROJECT\OS_PROJECT\CoreDumpProcsBatch" + batchNumber + ".txt", false);
         @"\\cse6\student\crichers\OS-Project\OS_PROJECT\OS_PROJECT\CoreDumpProcsBatch" + batchNumber + ".txt", false);
     Console.WriteLine("--------------------------------------");
     Console.WriteLine("CORE DUMP -- WRITING MEMORY TO FILE:");
     Console.WriteLine("CoreDumpProcsBatch" + batchNumber + ".txt");
     Console.WriteLine("--------------------------------------");
     foreach (Process p in k.deadProcesses)
     {
         writer.WriteLine("--------------------------------------");
         if (p.PCB.ProcessID > 9)
         {
             writer.WriteLine("----PROCESS #" + p.PCB.ProcessID + "-----------------------");
         }
         else
         writer.WriteLine("----PROCESS #"+p.PCB.ProcessID+"------------------------");
         writer.WriteLine("--------------------------------------");
         for (uint i = p.PCB.MemoryAddress; i < (p.PCB.MemoryAddress + p.PCB.JobLength); i++)
         {
             if (i < 10)
             {
                 writer.Write("[000" + i + "]");
             }
             else if (i < 100)
             {
                 writer.Write("[00" + i + "]");
             }
             else if (i < 1000)
             {
                 writer.Write("[0" + i + "]");
             }
             else
             {
                 writer.Write("[" + i + "]");
             }
             writer.Write(SystemCaller.ConvertInputDataToHexstring(k.RAM.ReadDataFromMemory(i)));
             writer.WriteLine();
         }
     }
     writer.Close();
 }
Example #7
0
 public Dispatcher(Driver k)
 {
     kernal = k;
     RQ = k.ReadyQueue;
 }
Example #8
0
 public static void Instantiate(Driver k)
 {
     singleton = new MMU(k);
 }
Example #9
0
 public static void CoreDumpProcessCompletionWaitingTimes(Driver k, int batchNumber)
 {
     StreamWriter writer = new StreamWriter(@"C:\Users\Cory\Documents\Visual Studio 2010\Projects\GitProjects\OS-Project\OS_PROJECT\OS_PROJECT\CoreDump-CompTimes" + batchNumber + ".txt", true);
     foreach (Process p in k.deadProcesses)
     {
         writer.WriteLine(p.PCB.ProcessID + " , " + p.PCB.completionTime);
     }
     writer.Close();
     writer = new StreamWriter(@"C:\Users\Cory\Documents\Visual Studio 2010\Projects\GitProjects\OS-Project\OS_PROJECT\OS_PROJECT\CoreDump-WaitTimes" + batchNumber + ".txt", true);
     foreach (Process p in k.deadProcesses)
     {
         writer.WriteLine(p.PCB.ProcessID + " , " + p.PCB.waitingTime);
     }
     writer.Close();
 }
Example #10
0
 public static void ProcessMemoryDump(Driver k, PCB pcb)
 {
     lock (fileLock)
     {
         StreamWriter writer = new StreamWriter(@"C:\Users\Cory\Documents\Visual Studio 2010\Projects\GitProjects\OS-Project\OS_PROJECT\OS_PROJECT\Phase Two Dumps\Process" + pcb.ProcessID + "MemoryDump.txt", false);
         //Console.WriteLine("Writing process memory to file...");
         uint beginning_page = pcb.PageTable.ReturnFirstPage(pcb);
         uint number_of_pages = pcb.JobLength / 4;
         uint frame_to_write;
         for (uint page = beginning_page; page < beginning_page + number_of_pages + 1; page++)
         {
             frame_to_write = pcb.PageTable.table[page].Frame;
             for (uint offset = 0; offset < 4; offset++)
             {
                 if (frame_to_write < 10)
                 {
                     writer.Write("[00" + frame_to_write + "]");
                 }
                 else if (frame_to_write < 100)
                 {
                     writer.Write("[0" + frame_to_write + "]");
                 }
                 else
                 {
                     writer.Write("[" + frame_to_write + "]");
                 }
                 writer.Write("[" + offset + "]");
                 if (pcb.PageTable.Lookup(page).InMemory)
                 {
                     writer.Write("[" + SystemCaller.ConvertInputDataToHexstring(MMU.Read((frame_to_write * 4) + offset)) + "]");
                 }
                 else writer.Write("[0]");
                 writer.WriteLine();
             }
         }
         writer.Close();
     }
 }
Example #11
0
 public static void ProcessCmpltWaitTimesDump(Driver k)
 {
     StreamWriter writer = new StreamWriter(@"C:\Users\Cory\Documents\Visual Studio 2010\Projects\GitProjects\OS-Project\OS_PROJECT\OS_PROJECT\Phase Two Dumps\ProcessCompletionTimes.txt", true);
     foreach (Process p in k.deadProcesses)
     {
         writer.WriteLine("[" + p.PCB.ProcessID + "][" + p.PCB.completionTime +"]");
     }
     writer.Close();
     writer = new StreamWriter(@"C:\Users\Cory\Documents\Visual Studio 2010\Projects\GitProjects\OS-Project\OS_PROJECT\OS_PROJECT\Phase Two Dumps\ProcessWaitTimes.txt", true);
     foreach (Process p in k.deadProcesses)
     {
         writer.WriteLine("[" + p.PCB.ProcessID + "][" + p.PCB.waitingTime + "]");
     }
     writer.Close();
     writer = new StreamWriter(@"C:\Users\Cory\Documents\Visual Studio 2010\Projects\GitProjects\OS-Project\OS_PROJECT\OS_PROJECT\Phase Two Dumps\ProcessPageFaults.txt", false);
     foreach (Process p in k.deadProcesses)
     {
         writer.WriteLine("[" + p.PCB.ProcessID + "][" + p.PCB.PageFaultCount + "]");
     }
     writer.Close();
 }
Example #12
0
 public static void DiskDump(Driver k)
 {
     StreamWriter writer = new StreamWriter(@"C:\Users\Cory\Documents\Visual Studio 2010\Projects\GitProjects\OS-Project\OS_PROJECT\OS_PROJECT\Phase Two Dumps\DiskDump.txt", false);
     //Console.WriteLine("Writing disk to file...");
     for (uint page = 0; page < 512; page++)
     {
         for (uint offset = 0; offset < 4; offset++)
         {
             if (page < 10)
             {
                 writer.Write("[00" + page + "]");
             }
             else if (page < 100)
             {
                 writer.Write("[0" + page + "]");
             }
             else
             {
                 writer.Write("[" + page + "]");
             }
             writer.Write("[" + offset + "]");
             writer.Write("[" + SystemCaller.ConvertInputDataToHexstring(k.Disk.ReadDataFromDisk((page * 4) + offset)) + "]");
             writer.WriteLine();
         }
     }
     writer.Close();
 }