|
@@ -42,6 +42,9 @@ uint SchedMFQ::pid_queue(uint pid){
|
|
|
if ( v_cola[i].count(pid) == 1) //Solo hay 0/1 key en un map
|
|
if ( v_cola[i].count(pid) == 1) //Solo hay 0/1 key en un map
|
|
|
return i;
|
|
return i;
|
|
|
|
|
|
|
|
|
|
+ cout << "WHAT THE FUCK " << pid << endl;
|
|
|
|
|
+ for( uint i = 0; i < n_colas; i++ )
|
|
|
|
|
+ cout << "size cola " << i << " = " << v_cola[i].size() << endl;
|
|
|
return 65535; // ??
|
|
return 65535; // ??
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -70,10 +73,16 @@ uint SchedMFQ::next_pid(){
|
|
|
return IDLE_TASK;
|
|
return IDLE_TASK;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+void SchedMFQ::mostrar_estados(){
|
|
|
|
|
+ for( uint q = 0; q < n_colas; q++ ){
|
|
|
|
|
+ cout << "Cola " << q << ", size: " << v_cola[q].size() << endl;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
int SchedMFQ::tick(int core, const enum Motivo m) {
|
|
int SchedMFQ::tick(int core, const enum Motivo m) {
|
|
|
uint switch_process = 0;
|
|
uint switch_process = 0;
|
|
|
int cur_pid = current_pid(core);
|
|
int cur_pid = current_pid(core);
|
|
|
|
|
|
|
|
|
|
+ cout << "PID at core " << core << " = " << cur_pid << endl;
|
|
|
if (cur_pid == IDLE_TASK)
|
|
if (cur_pid == IDLE_TASK)
|
|
|
return next_pid();
|
|
return next_pid();
|
|
|
|
|
|
|
@@ -99,9 +108,13 @@ int SchedMFQ::tick(int core, const enum Motivo m) {
|
|
|
break;
|
|
break;
|
|
|
case EXIT:
|
|
case EXIT:
|
|
|
switch_process = 1;
|
|
switch_process = 1;
|
|
|
|
|
+ //cout << v_cola[p_q].size() << endl;
|
|
|
|
|
+ //cout << "borro pid: " << cur_pid << endl;
|
|
|
v_cola[p_q].erase(cur_pid);
|
|
v_cola[p_q].erase(cur_pid);
|
|
|
|
|
+ //cout << v_cola[p_q].size() << endl;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
+ mostrar_estados();
|
|
|
|
|
|
|
|
if (switch_process)
|
|
if (switch_process)
|
|
|
return next_pid();
|
|
return next_pid();
|