![]()
![]()
목차
0. analysis
0.1. thread
0.1.1. struct thread
0.1.2. thread functions
– [thread 시작 관련 function]
– [thread 관리 function]
– [thread 동작 관련 function]
– [scheduling function]
– [timer 관련 function]
0.1.3. list
– [list function]
0.1.4. how to switch thread
0.2. synchronization
0.2.1. meaning of synchronization
0.2.2. disabling interrupts
0.2.2.1. meaning of disabling interrupts
0.2.2.2. caution
0.2.2.3. implement
0.2.3. semaphore
0.2.3.1. meaning of semaphore
0.2.3.2. implementation
0.2.4. lock
0.2.4.1. meaning of lock
0.2.4.2. implementation
0.2.5. condition
0.2.5.1. meaning of condition
0.2.5.2. implementation
0.2.6. interrupt handling
0.2.6.1. external interrupt handling
1. alarm clock
1.1. current implementation
1.1.1. timer.c functions
1.1.2. busy-waiting
1.2. new implementation
2. priority scheduling
2.1. current implementation
2.2. new implementation
2.2.1. priority scheduling modification
2.2.2. synchronization modification
2.2.3. priority donation modification
3.advanced scheduling
3.1. MLFQS
3.2. Priority scheduling
3.2.1. ready queue 관리
3.2.2. priority 관리
3.2.3. priority 계산
3.3. fixed-point arithmetic
3.4. implementation
본문내용
0.1. thread
pintos에서는 thread creation과 thread completion, Round-Robin 방식의 thread switching(simple scheduler)을 이미 구현해 두었다.
0.1.1. struct thread
kernel thread의 struct는 “threads/thread.h”에 선언되어 있다.
thread structure은 4kB page를 차지한다. struct thread는 page of memory의 시작부터 공간을 차지한다. page의 나머지 부분은 thread의 stack을 위해 이용되는데, 이는 end of the page로부터 아래쪽 방향으로 내려가며 진행된다.
따라서 kernel stack을 위한 공간을 위해 struct thread는 너무 크기가 크면 안 된다. base struct thread는 1kB 미만이어야 한다. 그리고 kernel stack도 너무 크면 안 된다. stack에서 overflow가 발생하면 thread state를 침범할 것이므로 kernel function은 struct와 array에 non-static local variable 같이 너무 많은 공간을 할당하지 않고, malloc()이나 palloc_get_page() 같은 동적 할당 function을 써야 한다.
[Member of struct thread]
tid_t tid
thread identifier를 뜻한다. 각 thread를 분간한다. 현재는 int 자료형에 1부터 numbering되게끔 짜여져 있다.
출처 : 해피캠퍼스