Skip to content

Instantly share code, notes, and snippets.

@yeonwooz
Last active December 14, 2022 17:28
Show Gist options
  • Save yeonwooz/01dd8771573243413ce535800d8f4c90 to your computer and use it in GitHub Desktop.
Save yeonwooz/01dd8771573243413ce535800d8f4c90 to your computer and use it in GitHub Desktop.
swap
struct frame *vm_evict_frame () {
struct frame *victim = vm_get_victim ();
swap_out (victim->page); // 페이지 스왑 아웃
return victim;
}
struct frame *vm_get_frame () {
...
return vm_evict_frame();
}
bool vm_do_claim_page () {
vm_get_frame(); // 새로운 프레임 혹은 스왑 아웃된 프레임을 할당받음
...
return swap_in (page, frame->kva); // 새 프레임으로 스왑 인
}
bool page_fault_handle() {
...
vm_do_claim_page(); // 페이지 폴트 발생시 물리 프레임 할당 요청
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment