page in different context

tags: learning programming database diff-between

content

  • the concept page has a few implementations:
    • in OS (mostly referring to memory)
      • normally a page is 4K
    • in storage hardware
      • normally a page is 4K
    • in database
      • in SQLite: 4K, 512B
      • in PostgreSQL: 8K

how to understand pages in these context?

  • under all these 3 context, a page is always the smallest unit for storage and I/O
  • in OS
    • physical RAM is divided into frames
    • the OS has the concept of pages for virtual memory
    • usually virtual memory’s page is the same size as RAM’s frame
  • in hardware
    • a page is the largest unit of data that the device can guarantee failsafe writes
    • (when the hardware writes the data to itself, it’s by the unit of pages. it’s either 1 page or nothing)
  • in database
    • the database file is divided into pages
    • when the database needs to write to disks, it’s done by the unit of pages
    • caching, journaling, etc are also done by the unit of pages

up

down

reference