3 ms·
Yes, but... no. It's a "leaky abstraction" to think of a disk as a flat array of bits. For one, very few block devices are byte addressable! The hint is in th
by jiggawatts 3y ago
Yes, but... no.
It's a "leaky abstraction" to think of a disk as a flat array of bits.
For one, very few block devices are byte addressable! The hint is in the name.
For example, if you change byte number 124567, then you're most likely actually reading a block of 512 bytes from offset 124416 to 124928, modifying it, and then writing it back.
This matters a lot for concurrent access, locking, and database transaction log integrity.
Many disks these days are layers upon layers of abstractions: they might be physically striped, deduplicated, compressed, shared, encrypted, or remote on a network somewhere.
Performance is complicated as well. For example, SSDs have different performance-optimal block sizes for reads and writes. The shingled magnetic recording (SMR) hard drives are even more complex.
Not to mention that disks can have block-level failures. It's possible for a disk to have a "hole" where it's a series of bytes... an error... and then a series of bytes. There are three values: "0", "1", and "bad sector"!
Issues like this have caused a lot of software errors.