[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: write alignment matters?
On Jun 23, 2011, at 8:15 PM, Steven Bellovin wrote:
> On Jun 23, 2011, at 7:43 34PM, Johnny Billquist wrote:
>> On 2011-06-23 23:05, Steven Bellovin wrote:
>>> For fun, I looked at the (online) man pages from 6th Edition Unix,
>>> which is circa 1976. Without exception, the raw disk (hp, hs, rf, rk,
>>> rp), and tape devices (tm only; raw I/O didn't work on ht) required
>>> buffers to be on word boundaries; for the former, the count had to be
>>> a multiple of 512 bytes, and for the tm tape driver the count had to
>>> be even. (See
>>> In other words, Erik is right, at least if we're talking historically.
>>> Of course, at least there it's documented. (I took a quick glance
>>> at the code, too -- it did appear to check for erroneous parameters,
>>> though I think it just truncated the count in some drivers.)
>> That's because of a hardware limitation of many controllers on a PDP-11.
>> They can only start DMA to even addresses. And that in turn is partly
>> because of the whole design of the PDP-11 itself. It really is, in many
>> ways, a word addressable machine, and only partially 8-bit byte oriented.
> Yup. That even shows in the manuals.
>> So I'm not sure how relevant that is for a general case. It would seem to be
>> very architecture specific.
> The point is that when dealing with raw devices, you take what the hardware
> gives you.
More or less, anyway. Sometimes there are restrictions not required by the
hardware but apparently done for consistency. rf could have allowed any even
byte count since that's how the hardware worked (word-addressable disk!) but it
looks like the implementers elected to match the disk pattern anyway.
Main Index |
Thread Index |