Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement lazy page allocation #145

Open
JonasKruckenberg opened this issue Nov 12, 2024 · 0 comments
Open

feat: implement lazy page allocation #145

JonasKruckenberg opened this issue Nov 12, 2024 · 0 comments

Comments

@JonasKruckenberg
Copy link
Owner

Right now we eagerly allocate physical memory to back all allocations which isn't great (but it's simple 🙃). Instead we should implement a lazy allocation scheme where physical memory is reserved but not only comitted when first accessed (by catching page faults).

We essentially want 3 states a page can be in:

  • Free - The page is unused and inaccessible, accessing it will result in a kernel panic.
  • Reserved - The page is reserved for future use and cannot be assigned other programs. With lazy committing enabled, accessing it will result in a page fault that causes the page to be comitted.
  • Committed - A physical frame has been allocated to back this page. The page is fully accessible (subject to the memory protection flags).

Reserved pages should be able to be committed on-demand using methods and we should be able to reserve & commit memory in one operation too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant