David vor 10 Jahren
Ursprung
Commit
ff64f98073
1 geänderte Dateien mit 3 neuen und 5 gelöschten Zeilen
  1. 3 5
      sched_mfq.cpp

+ 3 - 5
sched_mfq.cpp

@@ -29,12 +29,10 @@ void SchedMFQ::unblock(int pid) {
 	v_cola[p_q][pid].state = READY;
 	v_cola[p_q][pid].quantum_count = 0;
 
-	/*
 	if(p_q > 0) { //Hay una cola "mejor" para ir; lo llevo
 		v_cola[p_q-1][pid]=v_cola[p_q][pid];
 		v_cola[p_q].erase(pid);
 	}
-	*/
 }
 
 uint SchedMFQ::pid_queue(int pid){
@@ -91,6 +89,8 @@ int SchedMFQ::tick(int core, const enum Motivo m) {
 		return next_pid();
 
 	uint p_q = pid_queue(cur_pid);
+	if (p_q == 65535) //FIXME
+		return IDLE_TASK;
 	process* cur_process=&(v_cola[p_q][cur_pid]);
 
 	switch (m) {
@@ -101,12 +101,10 @@ int SchedMFQ::tick(int core, const enum Motivo m) {
 			cur_process->state = READY;
 			cur_process->quantum_count = 0;
 			cout << "Marcando a cur_pid("<< cur_pid<<") como READY (>quantum)" << endl;
-			/*
 			if(p_q < n_colas - 1) { //Hay una cola "peor" para ir; lo llevo
 				v_cola[p_q+1][cur_pid]=*cur_process;
 				v_cola[p_q].erase(cur_pid);
 			}
-			*/
 		}
 		break;
 	case BLOCK:
@@ -116,7 +114,7 @@ int SchedMFQ::tick(int core, const enum Motivo m) {
 	case EXIT:
 		switch_process = 1;
 		//cout << v_cola[p_q].size() << endl;
-		//cout << "borro pid: " << cur_pid << endl;
+		cout << "borro pid: " << cur_pid << endl;
 		v_cola[p_q].erase(cur_pid);
 		//cout << v_cola[p_q].size() << endl;
 		break;