thread 구조체에 새로 추가
struct list donators;: 자신에게 우선순위를 기부해준 스레드의 명단 -> 우선순위를 복구할 때 필요함.struct lock *waiting_lock;: 해당 스레드가 기다리고 있는 락을 저장함.struct list_elem donation_elem;: donators를 관리하기 위해 새로 추가한 필드. 기존에 존재하던 elem을 사용하면 안될까 라는 의문 때문에 꽤 오래 고민했었음.
lock 구조체에 새로 추가
- `struct list_elem elem;
새로 추가한 함수
remove_with_lock();refresh_priority();
donate_priority 수정
// synch.c
void donate_pri(struct lock *l)
{
struct thread *curr = thread_current();
struct thread *cur = thread_current();
struct thread *holder = cur->waiting_lock->holder;
holder->priority = cur->priority;
}
thread 구조체 안에 elem과 donators에 넣을 elem을 구분해야 하는 이유
각
elem의 독립성을 확보하기 위함.
내가 올린 gdb 사용법. 내가 올려놓고 정작 사용은 한 번도 하지 않았음. 더 익숙해지면 꽤 쓸만할듯