Question

Let's put write buffering aside first.

Since the fundamental unit OS operates on block device is a block, for writes that are not block aligned, does OS need to read such block first from disk to write ?

I know such scheme is called read-modify-write. Is such scheme usually used for unaligned writes? It seems a little bit counter-intuitive to me since we are doubling our IOs in this case.

Even with write buffering, if we have lots of unaligned writes that are not continuous with each other, does the OS need to read in each block of these unaligned writes first and then write them to disk?

Thank you.

Was it helpful?

Solution

For SATA at least, yes: to handle a partial-sector write the operating system must read the sector, change it, and write back the whole sector. The SATA command set has no commands to address individual byte ranges within a sector - only full sectors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top