|
@@ -50,22 +50,23 @@ int SchedMFQ::tick(int core, const enum Motivo m) {
|
|
|
uint cur_pid = current_pid(core);
|
|
uint cur_pid = current_pid(core);
|
|
|
|
|
|
|
|
uint p_q = pid_queue(cur_pid);
|
|
uint p_q = pid_queue(cur_pid);
|
|
|
|
|
+ process cur_process=v_cola[p_q][cur_pid];
|
|
|
switch (m) {
|
|
switch (m) {
|
|
|
case TICK:
|
|
case TICK:
|
|
|
- v_cola[p_q][cur_pid].quantum_count++;
|
|
|
|
|
- if (v_cola[p_q][cur_pid].quantum_count >= q_cola[p_q]) {
|
|
|
|
|
|
|
+ cur_process.quantum_count++;
|
|
|
|
|
+ if (cur_process.quantum_count >= q_cola[p_q]) {
|
|
|
switch_process = 1;
|
|
switch_process = 1;
|
|
|
- v_cola[p_q][cur_pid].state = READY;
|
|
|
|
|
- v_cola[p_q][cur_pid].quantum_count = 0;
|
|
|
|
|
|
|
+ cur_process.state = READY;
|
|
|
|
|
+ cur_process.quantum_count = 0;
|
|
|
if(p_q < n_colas) { //Hay una cola "peor" para ir; lo llevo
|
|
if(p_q < n_colas) { //Hay una cola "peor" para ir; lo llevo
|
|
|
- v_cola[p_q+1][cur_pid]=v_cola[p_q][cur_pid];
|
|
|
|
|
|
|
+ v_cola[p_q+1][cur_pid]=cur_process;
|
|
|
v_cola[p_q].erase(cur_pid);
|
|
v_cola[p_q].erase(cur_pid);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case BLOCK:
|
|
case BLOCK:
|
|
|
switch_process = 1;
|
|
switch_process = 1;
|
|
|
- v_cola[p_q][cur_pid].state = BLOCKED;
|
|
|
|
|
|
|
+ cur_process.state = BLOCKED;
|
|
|
break;
|
|
break;
|
|
|
case EXIT:
|
|
case EXIT:
|
|
|
switch_process = 1;
|
|
switch_process = 1;
|