|
|
@@ -44,6 +44,26 @@ uint SchedMFQ::pid_queue(uint pid){
|
|
|
return 65535; // ??
|
|
|
}
|
|
|
|
|
|
+int SchedMFQ::ready_at(uint qn){
|
|
|
+ if (v_cola[qn].size() == 0)
|
|
|
+ return -1;
|
|
|
+ for (it_type it = v_cola[qn].begin(); it != v_cola[qn].end(); it++) {
|
|
|
+ if (it->second.state == READY)
|
|
|
+ return it->first;
|
|
|
+ }
|
|
|
+ return -1;
|
|
|
+}
|
|
|
+uint SchedMFQ::next_pid(){
|
|
|
+ for( uint q = 0; q < n_colas; q++ ){
|
|
|
+ int p = ready_at(q);
|
|
|
+ if (p!=-1){
|
|
|
+ return p; //Algun proceso listo
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return IDLE_TASK;
|
|
|
+ //return 65535;
|
|
|
+}
|
|
|
|
|
|
int SchedMFQ::tick(int core, const enum Motivo m) {
|
|
|
uint switch_process = 0;
|
|
|
@@ -73,8 +93,8 @@ int SchedMFQ::tick(int core, const enum Motivo m) {
|
|
|
v_cola[p_q].erase(cur_pid);
|
|
|
break;
|
|
|
}
|
|
|
+ if (switch_process)
|
|
|
+ return next_pid();
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- return 0;
|
|
|
+ return cur_pid;
|
|
|
}
|