|
|
@@ -8,13 +8,13 @@ using namespace std;
|
|
|
SchedSJF::SchedSJF(vector<int> argn) {
|
|
|
// Recibe la cantidad de cores
|
|
|
cout << "Constructor SchedSJF \n";
|
|
|
- cout << "Test \n" ;
|
|
|
nucleos = argn[1];
|
|
|
+ firstTick=true;
|
|
|
|
|
|
for (uint i = 2; i < argn.size(); i++) {
|
|
|
// Cargamos los procesos con un id y una duration
|
|
|
uint duration = argn[i];
|
|
|
- cout << "Loadinggg " << i-2 << " " << duration << "\n";
|
|
|
+ //cout << "Loadinggg " << i-2 << " " << duration << "\n";
|
|
|
p_map[i - 2].duration = duration;
|
|
|
}
|
|
|
}
|
|
|
@@ -38,6 +38,11 @@ void SchedSJF::unblock(int pid) {
|
|
|
int SchedSJF::tick(int cpu, const enum Motivo m) {
|
|
|
/* motivo TICK / BLOCK / EXIT / IDLE_TASK */
|
|
|
uint cur_pid = current_pid(cpu);
|
|
|
+ if (firstTick){ //FIXME
|
|
|
+ cur_pid=0;
|
|
|
+ firstTick=false;
|
|
|
+ }
|
|
|
+
|
|
|
cout << "Inicio tick: cpu " << cpu << " motivo " << m << " curr_pid " << cur_pid << "\n";
|
|
|
if (m == TICK) {
|
|
|
return cur_pid; // El proceso esta corriendo
|