Explorar o código

ya no crashea

David %!s(int64=10) %!d(string=hai) anos
pai
achega
d119b5dcfa
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      sched_mfq.cpp

+ 7 - 0
sched_mfq.cpp

@@ -1,4 +1,5 @@
 #include <map>
+#include <iostream>
 #include <vector>
 #include <queue>
 #include "sched_mfq.h"
@@ -68,9 +69,15 @@ uint SchedMFQ::next_pid(){
 int SchedMFQ::tick(int core, const enum Motivo m) {
 	uint switch_process = 0;
 	uint cur_pid = current_pid(core);
+	if (cur_pid == IDLE_TASK)
+		return next_pid();
 
 	uint p_q = pid_queue(cur_pid);
+	//cout << "curpid " << cur_pid << endl; //-1
+	//cout << "p_q " << p_q << endl; //65535, segfault
+
 	process cur_process=v_cola[p_q][cur_pid];
+	//cout << "asd4" << endl;
 	switch (m) {
 	case TICK:
 		cur_process.quantum_count++;