If two processors write a different value to the same location at the exact same time, what happens then? Would you want two caches with different content? Would the result be a mixture of both values written? Neither is desired, so instead writes take turns.
The next thing is that "locations" are bus-sized cache lines and thus typically worth 16 bytes and up. This is an efficiency trick, but it does mean that writing different bytes in the same cache line still block each other as if it were the same byte.
The last step is that when you want to write somewhere, you must prevent anything else from writing there. So if you write to two locations, you have to make sure both locations are safe from writing by other processes. This introduces the possibility of deadlocks if two processes want to write to A and B, and one claims A while the other claims B and neither can claim the other half. Reads require less blocking so it's only a technical requirement to have single writes per operation.
_________________ "Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie [ My OS ] [ VDisk/SFS ]
|