본문 바로가기

SW Jungle/Week 08

Pintos Project_1 Threads(Priority Scheduling)

  • Pintos는 FIFO 스케줄링을 이용
  • Pintos 스케쥴러를 Roud Robin  에서 Priority scheduling으로 수정
    • ready list를 thread priority에 의해 정렬
    • wait list를 synchronization primitives(such as semaphore, condition variable and locks with the respect of the priority)에 의해 정렬 
    • preemption 구현
      • preemption scheduling(선점 스케쥴링): 시분할 시스템에서 time slice가 소진 되었거나, interrpt가 시스템 호출 종료 시에 더 높은 우선 순위 프로세스가 발생되었음을 알았을때, 현 실행 프로세스로 부터 강제로 CPU를 회수 하는것
      • 현 대 대부분의 시스템들은 선점 커널 (preemptive kernel)을 가지고 있고, 이는 커널 모드일 때에도 태스크들이 선점 될 수 있도록 설계

Design of thr priority Scheduling

  1. ready list를 검사하고,  next thread to run을 선택해야 할 때, highest priority의 thread를 가져옴
  2. wait list에서 lock을 기다리는 thread들이 있고, lock이 available하면, OS가 가장 우선 순위가 높은 스레드를 선택

Three things to consider

  • ready list 내의 thread to run을 선택할때, 가장 높은 우선 순위의 것을 선택
  • preemption
    • ready list의  new thread를 삽입할 때, running thread와의 우선 순위를 비교
    • 새로 삽입된 스레드가 현재 실행 중인 스레드보다 우선순위가 높은 경우, 새로 삽입된 스레드를 schdule
  • Lock: semaphore, condition variable
    • lock(혹은 semaphores, condition variable)을 기다리는 thread의 집합으로 부터 스레드를 선택할때, 우선순위가 가장 높은 것을 선택

'SW Jungle > Week 08' 카테고리의 다른 글

Pintos Project_1 Threads(Alarm Clock)  (0) 2023.04.27
Pintos Project_1 Threads(노트 정리)  (0) 2023.04.27