Step 1 : Anonymous Page

Step 2 : File-Backed Page

Step 3 : Page Replacement Policy

Swap Slots

디스크 공간 안의 SWAP DISK에 있는 페이지 크기의 공간. SWAP DISK로 SWAP OUT된 페이지 하나당 하나의 SWAP SLOT이 할당되는 듯. 한다고 해서 손해 볼 건 없기 때문에 페이지 정렬 되어야 한다.

SWAP SLOT은 LAZY LOAD를 통해 할당되어야 한다. 즉, 페이지가 EVICT(SWAP OUT)되었을 때가 되어서야 해당 페이지에 대한 SWAP SLOT이 할당된다.

Swap Table

사용 중인 OR 사용할 수 있는 SWAP SLOT을 관리하는 테이블이다.

물리 메모리에서 스왑 공간으로 SWAP OUT되는 페이지를 관리할 수 있도록 FREE한 SWAP SLOT을 따로 관리해줘야 한다. 만약 SWAP TABLE 안에 있던 페이지가 다시 프로세스에 의해 물리 메모리로 돌아가게 된다면 해당 페이지의 SWAP SLOT을 FREE해줘야 한다.

From the vm/build directory, use the command pintos-mkdisk swap.dsk --swap-size=n to create a disk named swap.dsk that contains a n-MB swap partition. Afterward, swap.dsk will automatically be attached as an extra disk when you run pintos. Alternatively, you can tell pintos to use a temporary n-MB swap disk for a single run with --swap-size=n.

Swap slots should be allocated lazily, that is, only when they are actually required by eviction. Reading data pages from the executable and writing them to swap immediately at process startup is not lazy. Swap slots should not be reserved to store particular pages.