The most efficient way to exchange data between cores

Which is most efficient for exchanging data between multiple cores. You can of course use shared memory, but that also comes with a cost. Let's say one core continuously writes to a variable and another core reads it continuously. With the MESI caching negotiation protocol, the write kernel will cause the read kernel to strip its cache from time to time. Thus, in this scenario, the most efficient way to exchange data.

+3


source to share


3 answers


On a normal shared memory machine, the scenario you describe is probably the most efficient way that is possible:

  • Core A writes to a memory cell. Invalid instance of Core B.
  • Core B grabs data from memory or from the Core A cache.

In any case, data must be sent from Core A to Core B. Cache consistency in modern processors sometimes supports direct cache-to-cache transfers without going all the way into memory.




What you want to avoid (when possible) is overlocking the share. This will increase caching coherence traffic (and latency) in both directions.

+3


source


One general and general approach is to have inline data structures whenever possible.

For example, in a producer-consumer scenario, each of the consumer processors can have and operate on a part of a queue. They can only access the manufacturer's processor when they run out of work items.



Of course, this is not always possible, but if work items can be designed in this way, it reduces the dependency between cores and allows the application to scale to the number of cores.

This method is widely used on Solaris OS. For more information, see Multiuser Application Programming: For Windows, Linux, and Oracle Solaris .

0


source


It depends on how much you can tolerate it (please let us know).

If you need updates to distribute as quickly as possible, this is already the most effective solution. If you can carry milliseconds or seconds of stale data, you can use a separate memory location for each core and synchronize with a timer.

0


source







All Articles