8

Just as RAM is divided into frames, the logical address space is divided into pages and the secondary storage into blocks of the same size. Pages are very small in size, 4 kB or so, and are swapped out when needed and stored as pagefiles.

All easy to understand until now. What confuses me is that:

  • Most modern hard drives have sectors the size of 4 kB or 8 kB, so does it mean each sector becomes a page?
  • And what is a "block" on a hard drive? Isn't it a collection of sectors? Is a block the same as a "cluster" which is also a collection of sectors?
  • If the OS wants to keep the page size independent of the sector size then it can designate a portion of the harddrive as virtual memory and operate on it differently from how it operates on the rest of the hard drive. Here the blocks could be the same size as page size and in the rest of the hard drive it could be different. Is that correct?
5
  • I really can't help you. But +1 for an excellent question.
    – Josiah
    Oct 11, 2012 at 15:58
  • Silberschatz (I know you possess that book ;-)) chapter 12
    – wnrph
    Oct 11, 2012 at 15:59
  • Hang on. Going over it.
    – A User
    Oct 11, 2012 at 16:03
  • Id like to know this as well. Oct 11, 2012 at 16:19
  • The lengthy answer i posted is not being displayed. Don't know why. In short, 1. No sector != page. 2. They're different. 3. Perhaps the block size is different. I'll post the detailed answer again if possible :)
    – A User
    Oct 12, 2012 at 4:14

2 Answers 2

3

"Block" and "cluster" are filesystem-layer terminology, and "sector" is disk-layer terminology. Unlike "page", block size is determined entirely by software.

A "block", "sector", or "allocation unit" is a group of sectors that are fetched at once. Fetching more sectors at once improves latency: reading a large file a sector at a time is like trying to read a library book with a separate trip to the library for each page.

Virtual memory in Windows is just implemented as a file, and I believe it's not handled in a particularly special way.

2

Ok, first of all pages are not as small as I thought they were. They are in MBs.

  • No, sector size not equal to page size
  • Block is a collection of sectors made by the OS to reduce the number of addresses required to manage the entire hard drive. Cluster is also a collection of sectors but contiguous. However, when the OS wants to write a file, it simply asks the HDD to write it to a free block. How that data is stored in the block is not the concern of the OS. The file maybe stored in various sectors or in a cluster.
  • Yes, perhaps they are managed differently. The block size may be different for virtual memory than for the rest of the drive. Here, block size maybe equal to the page size
  • 2
    • In some terminologies, at least, such as "Logical block address", "block" is just another name for "sector". You also seem to be under the impression that the HD has some concept of which blocks are free. It does not. The OS manages the blocks (sectors) on the disk. When the OS wants to write to a file the OS tells the drive exactly which block to write to. Dec 1, 2015 at 7:30
    • And, no, pages are 4K, not "in MBs" on most modern CPUs. Although x86 and x64 do support "large pages" (normally 2 MB these days) these are not the norm. Dec 1, 2015 at 8:27

    You must log in to answer this question.

    Not the answer you're looking for? Browse other questions tagged .