Add unit tests and architecture doc for page allocation and random I/O#4
Draft
Copilot wants to merge 3 commits into
Draft
Add unit tests and architecture doc for page allocation and random I/O#4Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
…itecture doc - PagePoolTests: 16 tests covering 64KB page allocation, batch rent/return, capacity enforcement, CAS-based thread safety, pre-allocation, zeroed memory - PagedFileContentTests: 21 tests covering random read/write at arbitrary offsets, cross-page I/O, sparse pages, truncation, concurrent access - RamFileSystemTests: 15 tests covering file/directory CRUD, page-backed I/O, capacity tracking, move/rename - docs/page-allocation-and-random-io.md: detailed architecture document explaining the page table design and three-phase write protocol Agent-Logs-Url: https://github.com/hooyao/RamDrive/sessions/3ed842f7-01d0-43bb-81cd-292a29cfbcfa Co-authored-by: hooyao <659145+hooyao@users.noreply.github.com>
Agent-Logs-Url: https://github.com/hooyao/RamDrive/sessions/3ed842f7-01d0-43bb-81cd-292a29cfbcfa Co-authored-by: hooyao <659145+hooyao@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Investigate 64KB page allocation for random read/write support
Add unit tests and architecture doc for page allocation and random I/O
Apr 4, 2026
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.
The repo had zero test coverage and no design documentation explaining how the 64KB page pool and random read/write mechanism work.
Tests (52 total)
PagePoolTests(16) — lazy vs pre-allocation, CAS capacity enforcement, batch rent/return viaTryPopRange/PushRange, zeroed-on-return guarantee, concurrent rent/return correctnessPagedFileContentTests(21) — random read/write at arbitrary offsets, cross-page spanning writes, sparse page reads (unallocated → zeroes), three-phase write protocol under contention, truncation freeing pages + zeroing partial pages, capacity exhaustion returning-1RamFileSystemTests(15) — file/directory CRUD, case-insensitive lookup, page lifecycle through delete, move preserving content, capacity tracking via pool delegationDocumentation
docs/page-allocation-and-random-io.md— explains the offset→pageIndex mapping (offset / pageSize), the three-phase write protocol (read-lock scan → lock-free batch allocate → write-lock memcpy), sparse file semantics, per-fileReaderWriterLockSlimvs global structure lock, andConcurrentStack+ CAS loop for lock-free page poolProject
AllowUnsafeBlocksin test project (one test verifies pages are zeroed via raw pointer)