Claude/discretize unixv6 8fqk1 - #2
Open
Sia-Sheerland wants to merge 2 commits into
Open
Conversation
Implements the four discretization goals:
1. All logical pages stored discretely (non-contiguous physical pages)
- Replace MapNode/Allocator with BitMap/BitMapAllocator for page allocation
- Each physical page tracked individually via Page[] reference count array
- UserPageManager and KernelPageManager use BitMapAllocator
2. COW (Copy-On-Write) for fork()
- NewProc() marks parent pages read-only, shares with child via page table copy
- PageFault handler detects COW faults: if ref count=1 restore RW; else
decrement ref count, allocate new page, copy contents
3. exec() allocates pages discretely, no memory copy
- Stack pages allocated one at a time, mapped via 0# shared page table entries
- Text/data pages allocated individually, frame numbers stored directly in PTEs
- Eliminates old contiguous block copy approach
4. Text segment sharing with x_caddr[10] array
- Text.h: x_caddr changed from single address to array of 10 frame numbers
- Text.cpp: XccDec() iterates per-page, decrements ref counts, frees individually
Additional changes:
- Process.h: Add PageDirectory* pPageDirectory member + GetPageDirectoryPhyAddr()
- ProcessManager: Add AllocPageDirectory(), InitProcPageDirectory(), ModifyPageTable()
- Assembly.h: FlushPageDirectory() now accepts physical address parameter
- MemoryDescriptor.cpp: MapToPageTable() simplified to just flush CR3 with process PD
- SwtchUStruct macro updated to use per-process page directory physical address
https://claude.ai/code/session_01TZ87VQcUEKKAh8e86YYppq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.