operating-systemvirtual-memory

What's the difference between page and block in operating system?


I have learned that in an operating system (Linux), the memory management unit (MMU) can translate a virtual address (VA) to a physical address (PA) via the page table data structure. It seems that page is the smallest data unit that is managed by the VM. But how about the block? Is it also the smallest data unit transfered between the disk and the system memory?


Solution

  • Generally speaking, the hard-disk is one of those devices called "block-devices" as opposed to "character-devices" because the unit of transferring data is in the block. Even if you want only a single character from a file, the OS and the drive will get you a block and then give you access only to what you asked for while the rest remains in a specific cache/buffer.

    Note: The block size, however, can differ from one system to another.

    To clear a point:
    Yes, any data transferred between the hard disk and the RAM is usually sent in blocks rather than actual bytes. Data which is stored in RAM is managed, typically, by pages yes; of course the assembly instructions only know byte addresses.