|
@@ -1,7 +1,5 @@
|
|
|
#include <map>
|
|
#include <map>
|
|
|
#include <iostream>
|
|
#include <iostream>
|
|
|
-#include <vector>
|
|
|
|
|
-#include <queue>
|
|
|
|
|
#include "sched_mfq.h"
|
|
#include "sched_mfq.h"
|
|
|
#include "basesched.h"
|
|
#include "basesched.h"
|
|
|
|
|
|
|
@@ -96,7 +94,7 @@ int SchedMFQ::tick(int core, const enum Motivo m) {
|
|
|
switch_process = 1;
|
|
switch_process = 1;
|
|
|
cur_process->state = READY;
|
|
cur_process->state = READY;
|
|
|
cur_process->quantum_count = 0;
|
|
cur_process->quantum_count = 0;
|
|
|
- if(p_q < n_colas) { //Hay una cola "peor" para ir; lo llevo
|
|
|
|
|
|
|
+ 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+1][cur_pid]=*cur_process;
|
|
|
v_cola[p_q].erase(cur_pid);
|
|
v_cola[p_q].erase(cur_pid);
|
|
|
}
|
|
}
|
|
@@ -116,8 +114,12 @@ int SchedMFQ::tick(int core, const enum Motivo m) {
|
|
|
}
|
|
}
|
|
|
mostrar_estados();
|
|
mostrar_estados();
|
|
|
|
|
|
|
|
- if (switch_process)
|
|
|
|
|
- return next_pid();
|
|
|
|
|
|
|
+ if (switch_process) {
|
|
|
|
|
+ cur_pid = next_pid();
|
|
|
|
|
+ process* next_process=&(v_cola[p_q][cur_pid]);
|
|
|
|
|
+ next_process->state = RUNNING;
|
|
|
|
|
+ return cur_pid;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return cur_pid;
|
|
return cur_pid;
|
|
|
}
|
|
}
|