MLFQS가 필요한 이유?


...
extern bool thread_mlfqs; //true로 변경됨

void thread_init(void);
void thread_start(void);
...

무엇을 구현해야 하는가?

  1. 우선순위 계산식

    priority = PRI_MAX - (recent_cpu / 4) - (nice * 2)
    
  2. load_avg, recent_cpu 계산식

    recent_cpu = (2 * load_avg) / (2 * load_avg + 1) * recent_cpu + nice
    
    int ready_threads = list_size(&ready_list);
    if (thread_current() != idle_thread)
        ready_threads += 1;
    
    load_avg = (59/60) * load_avg + (1/60) * ready_threads
    
  3. donation 로직 비활성화

  4. nice 관련 함수 구현

😊 Nice 값

int thread_get_nice(void);
int thread_set_nice(int nice);

set_nice()는 우선순위를 다시 계산하고, 현재 스레드가 최고 우선순위가 아니라면 yield()해야 합니다.