コード例 #1
0
 private int ComparePriority(Process p1, Process p2)
 {
     if (p1.PCB.Priority > p2.PCB.Priority)
         return -1;
     else if (p1.PCB.Priority == p2.PCB.Priority)
         return 0;
     else return 1;
 }
コード例 #2
0
 private int CompareJob(Process p1, Process p2)
 {
     if (p1.PCB.InstructionLength > p2.PCB.InstructionLength)
         return 1;
     else if (p1.PCB.InstructionLength == p2.PCB.InstructionLength)
         return 0;
     else return -1;
 }
コード例 #3
0
 public static void EnqueueProcess(Process p, uint page)
 {
     lock (Lock)
     {
         NeededPages.Enqueue(page);
         BlockedQueue.Enqueue(p);
         Enqueued++;
     }
 }
コード例 #4
0
ファイル: Loader.cs プロジェクト: hammypants/OS-Project
 void SpawnProcess(uint pID, uint priority, uint numWords, uint outB, uint inB, uint tempB, uint startAddress)
 {
     Process p = new Process(new PCB());
     p.PCB.ProcessID = pID;
     p.PCB.Priority = priorityNum;
     p.PCB.InstructionLength = numWords;
     p.PCB.OutputBufferSize = UInt32.Parse("C", NumberStyles.HexNumber);
     p.PCB.TempBufferSize = UInt32.Parse("C", NumberStyles.HexNumber);
     p.PCB.InputBufferSize = UInt32.Parse("14", NumberStyles.HexNumber);
     //p.PCB.OutputBuffer = UInt32.Parse("C", NumberStyles.HexNumber);
     //p.PCB.TempBuffer = UInt32.Parse("C", NumberStyles.HexNumber);
     //p.PCB.InputBuffer = UInt32.Parse("14", NumberStyles.HexNumber);
     p.PCB.DiskAddress = startAddress;
     Console.WriteLine("Disk Address: " + p.PCB.DiskAddress.ToString());
     Console.WriteLine("Input Buffer: " +p.PCB.InputBufferSize.ToString());
     Console.WriteLine("Instruction Length: " + p.PCB.InstructionLength.ToString());
     Console.WriteLine("Output Buffer: " + p.PCB.OutputBufferSize.ToString());
     Console.WriteLine("Temp Buffer: " + p.PCB.TempBufferSize.ToString());
     Console.WriteLine("Priority: " + p.PCB.Priority.ToString());
     NPQ.AccessQueue.Enqueue(p);
     Console.WriteLine("Process spawned!");
     Console.WriteLine();
 }
コード例 #5
0
ファイル: Loader.cs プロジェクト: hammypants/OS-Project
 void SpawnProcess(uint pID, uint priority, uint instrL, uint outB, uint inB, uint tempB, uint startAddress, uint offset, List<uint> pages)
 {
     Process p = new Process(new PCB());
     p.PCB.ProcessID = pID;
     p.PCB.Priority = priorityNum;
     p.PCB.InstructionLength = instrL;
     p.PCB.OutputBufferSize = UInt32.Parse("C", NumberStyles.HexNumber);
     p.PCB.TempBufferSize = UInt32.Parse("C", NumberStyles.HexNumber);
     p.PCB.InputBufferSize = UInt32.Parse("14", NumberStyles.HexNumber);
     p.PCB.DiskAddress = startAddress;
     if (offset == 4 || offset == 0)
     {
         offset = 0;
     }
     else offset = 4 - offset;
     p.PCB.SeparationOffset = offset;
     foreach (uint page in pages)
     {
         p.PCB.PageTable.table[page].IsOwned = true;
         Console.WriteLine("Process " + p.PCB.ProcessID + " owns page " + page + ".");
     }
     Console.WriteLine("Disk Address: " + p.PCB.DiskAddress.ToString());
     Console.WriteLine("Input Buffer: " + p.PCB.InputBufferSize.ToString());
     Console.WriteLine("Instruction Length: " + p.PCB.InstructionLength.ToString());
     Console.WriteLine("Output Buffer: " + p.PCB.OutputBufferSize.ToString());
     Console.WriteLine("Temp Buffer: " + p.PCB.TempBufferSize.ToString());
     Console.WriteLine("Priority: " + p.PCB.Priority.ToString());
     Console.WriteLine("Sep. Offset: " + p.PCB.SeparationOffset.ToString());
     NPQ.AccessQueue.Enqueue(p);
     Console.WriteLine("Process spawned!");
     Console.WriteLine();
 }
コード例 #6
0
ファイル: SystemCaller.cs プロジェクト: hammypants/OS-Project
 public static void DisplayMemoryOfProcess(Process p, RAM r)
 {
     for (uint iterator = p.PCB.MemoryAddress; iterator < p.PCB.JobLength; iterator++)
     {
         uint _uint = r.ReadDataFromMemory((uint)iterator);
         string _data = String.Format("{0:X}", _uint);
         Console.WriteLine(_data);
     }
 }