Post
Topic
Board Development & Technical Discussion
Re: Ultra-Lightweight Database with Public Keys (for puzzle btc)
by
Geshma
on 24/02/2025, 09:46:40 UTC
What is Virtual Memory?
Virtual memory is a memory management technique that abstracts physical RAM, providing each process with a large, private address space. It works by:
Paging: Dividing memory into fixed-size pages (e.g., 4 KB on most systems).
Swapping: Moving inactive pages from RAM to a disk-based page file/swap space when RAM is full, and swapping them back when needed.
Translation: Using the Memory Management Unit (MMU) to map virtual addresses (used by programs) to physical addresses (in RAM or swapped to disk).
Key components:
Page File/Swap Space: Disk storage (e.g., pagefile.sys on Windows, /swap on Linux) for swapped pages.
Page Table: Tracks which pages are in RAM or on disk, managed by the OS.

in virtual address space. Physical RAM usage is capped at available RAM (e.g., 16 GB), with excess swapped to disk.

Implementation Details
Keep Original Code: Use the RAM-based SortedDict approach without SQLite or caching modifications (see code below).
Configure Swap Space:
Windows: Ensure the page file is set to "System Managed" or manually increased (e.g., 64 GB for puzzle 64) via System Properties > Advanced > Virtual Memory.
Linux/macOS: Increase swap space (e.g., sudo fallocate -l 64G /swapfile; sudo mkswap /swapfile; sudo swapon /swapfile).
Run as Is: The OS swaps excess SortedDict pages to disk when RAM fills, requiring no code changes beyond ensuring swap space exists.