pigdos said:
Um daytripper, how do you figure a hard drive unilaterally writes to main
memory? Do you honestly think devices just independently begin writing to
main memory (aside from memory NIC's) without any CPU intervention at all?
Have you ever read up on what exactly is involved in setting up a DMA xfer?
Gosh...
The CPU writes into some controller register the address range it might use.
Thats all. The device is then allowed to start transfer at will (for example
disk might start transfering the data after 15ms -- by that time typical OS
will switch task about 15 times as well -- probably whole CPU cache will be
swapped few times as well and CPU has already executed about 30 million
instructions.
The data disk writes into memory must get in sync with CPU caches, and how
do you thing the CPU is informed about data being written?
No, no cache flushing instruction and stuff is done when disk finishes
tranfer, as performance would be terrible.
Hint: google for memory snoops.
There are only two viable options: either address bus is bidirectinal
(Pentiums & Cores and stuff) or there is additional snoop access bus (K7).
There is also the concept of uncacheable memory addresses maybe you should
read up on that as well.
Take your own advice.
The areas where disk transfers occurs are cacheable in any hald-baked OS!
Such areas are typically for some controller memory and/or io ports mapped
into CPU's physical address range. Uncacheable memory area is needed when
memory accesses must be stricly controlled (for example accessing to some
address triggers some action in the device).
rgds