Can multiple cores simultaneously read the same RAM location? I am interested in x86 architecture CPU's in particular. Also can the internal caches of two different cores on the same CPU get filled at the same time from the same RAM locations?
If two cores tried to access the same address in RAM, one would have to wait for the other to access the RAM. The second time that each core would try to access the same address, they may still have that RAM cached, so they could access their respective caches simultaneously.
All CPUs (or cores) can access a common memory space through a shared bus or crossbar switch. Prominent examples of such systems are modern multi-core CPU-based workstations in which all cores share the same main memory.
If two CPUs try to write to the same location at the same time, the memory controller will decide on some order for the writes. While one CPU is writing to memory, the other CPU will stall for as many cycles as necessary until the first write is completed; then it will overwrite its value.
In a multiprocessor system or a multicore processor (Intel Quad Core, Core two Duo etc..) does each cpu core/processor have its own cache memory (data and program cache)? Yes. It varies by the exact chip model, but the most common design is for each CPU core to have its own private L1 data and instruction caches.
In short, they can read independently and caches will be filled independently, though the location may be preloaded in shared L3 cache. Synchronisation is not guaranteed to the precise tick, but memory state is coherent and transparent to the application. There is an excellent article on memory by Ulrich Drepper, which is a must read: http://lwn.net/Articles/250967/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With