- Due Date: March 23, 2022
-
Determine state-diagram for page life cycle (swap-backed and file-backed) (Thursday, Mar. 10-11)
-
State diagram check (OH or lab) (Thursday, Mar. 10, 2:30 p.m or Friday)
-
Functionality (life cycle) testing (Sunday, Mar. 13) (in parallel)
-
Determine class abstraction and data structure (Sunday, Mar. 13)
-
Implementation of basic features (Wednesday, Mar. 16)
-
Regressive testing (Sunday, Mar. 20) (in parallel)
-
Implementation of eviction, optimization, ... (Sunday, Mar. 20)
-
More testing (Wednesday, Mar. 23) (in parallel)
-
Wrapping up (Wednesday, Mar. 23)
stateDiagram-v2
[*] --> mapped_disk: vm_map
mapped_disk --> mapped_clean_physmem: read
mapped_disk --> mapped_dirty_physmem: write
mapped_clean_physmem --> mapped_dirty_physmem: write
mapped_dirty_physmem --> mapped_dirty_physmem: read || write || (clock && !swept)
mapped_clean_physmem --> mapped_clean_physmem: read || (clock && !swept)
mapped_clean_physmem --> mapped_clean_not_ref: clock && swept && !evict
mapped_clean_not_ref --> mapped_clean_physmem: read
mapped_clean_not_ref --> mapped_dirty_physmem: write
mapped_dirty_physmem --> mapped_disk: clock && evict (copy)
mapped_clean_physmem --> mapped_disk: clock && evict
mapped_dirty_physmem --> mapped_dirty_not_ref: clock && swept && !evict
mapped_dirty_not_ref --> mapped_dirty_physmem: read || write
mapped_clean_not_ref --> mapped_disk: clock && evict
mapped_clean_not_ref --> mapped_clean_not_ref: clock && !evict
mapped_dirty_not_ref --> mapped_disk: clock && evict (copy)
mapped_dirty_not_ref --> mapped_dirty_not_ref: clock && !evict
note right of mapped_clean_physmem
valid: true
resident: true
dirty: false
referenced: true
r_enable: true
w_enable: false
end note
note right of mapped_dirty_physmem
valid: true
resident: true
dirty: true
referenced: true
r_enable: true
w_enable: true
end note
note right of mapped_disk
valid: true
resident: false
dirty: false
referenced: false
r_enable: false
w_enable: false
end note
note right of mapped_clean_not_ref
valid: true
resident: true
dirty: false
referenced: false
r_enable: false
w_enable: false
end note
note right of mapped_dirty_not_ref
valid: true
resident: true
dirty: true
referenced: false
r_enable: false
w_enable: false
end note
-
DiskBlock
: Data structure with file name and block number, implements hash. -
Page
: Abstraction of a physical page, only fixed amount of presistent instances in pager. Contains metadata.- Need to be careful to update referer pointer whenever disk pointer is updated.
- Call
broadcast
after shared state changes
-
AddressSpace
: Abstraction of a virtual address space. Implements virtual pointer, and syntax sugar ofEntry
.- valid and resident bits are not needed, therefore removed, only pointers of
DiskBlock
remain
- valid and resident bits are not needed, therefore removed, only pointers of
-
Allocator
: Simple class for managing resources such as swap block and physical page. -
Clock
: Implementation of clock algorithm, usesunordered_map
andlist
forO(1)
time complexity andO(n)
memory -
Pager
: Singleton class. A pager contains many tables for different associations and manages these association and invariants.
-
There is only one physical instance of
DiskBlock
-
Referer pointer and disk pointer must be synchronize
-
A non-resident page must have zero ppn and null disk and referer pointer
-
Having non-null disk and referer pointer with zero ppn indicates a swap-backed page in zero-page
-
Zero page is never evicted
-
Add header files under
include
and add source files undersrc
. -
Run
make syntax
before adding and commiting code and fix any error. -
Use
git add -u
andgit add <file>
, don't dogit add .
. -
Don't commit configuration files, temp files and build files. You can use
.gitignore
to prevent this. -
Do a
git pull
orgit pull --rebase
before pushing.