Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can multiple cores simultaneously read the same RAM location?

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?

like image 474
Copil tembel Avatar asked Sep 27 '12 21:09

Copil tembel


People also ask

Can multiple cores access RAM at the same time?

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.

Do cores share the same memory?

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.

What happens when two processors attempt to write to the same location simultaneously?

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.

Does each core have its own RAM?

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.


1 Answers

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/

like image 67
Lyth Avatar answered Dec 21 '22 20:12

Lyth