• Croquette@sh.itjust.works
    link
    fedilink
    arrow-up
    14
    ·
    10 days ago

    Unless you are at the edge of the firmware and software, this isn’t something you work with a lot.

    When you transfer files or data to a memory space, you can’t drop the whole file/data to memory directly because the resources are limited on the cpu/mcu. It wouldn’t make sense to have a page as big as your biggest theorical data size.

    Page size determine how much data at a time can be transferred into memory.

    In term of performance, writing the page to memory is usually the bottle neck. So 4k vs 64k means you need to write to memory 16 times more and thus making the performance better on 64k page size.

    • Markaos@discuss.tchncs.de
      link
      fedilink
      arrow-up
      7
      ·
      10 days ago

      That’s more of a storage thing, RAM does a lot smaller transfers - for example a DDR5 memory has two independent 32bit (4 byte) channels with a minimum of 16 transfers in a single “operation”, so it does 64 bytes at once (or more). And CPUs don’t waste memory bandwidth than transferring more than absolutely necessary, as memory is often the bottleneck even without writing full pages.

      The page size is relevant for memory protection (where the CPU will stop the program execution and give control back to the operating system if said program tries to do something it’s not allowed to do with the memory) and virtual memory (which is part of the same thing, but they are two theoretically independent concepts). The operating system needs to make a table describing what memory the program has what kind of access to, and with bigger pages the table can be much smaller (at the cost of wasting space if the program needs only a little bit of memory of a given kind).