What does "synchronization with main memory" mean?

What does the phrase " synchronization with main memory" mean ?

+3
source share
3 answers

When you have multiple threads, each thread can store a local copy of the variable value. However, the “official copy” of the value is stored in the main memory. So, what this phrase means, means that any local copy of the variable value will be consistent with the main memory (either to check for updates or to publish updates made in the local copy).

+9
source

Synchronization helps create read and write barriers. that is, it sets a boundary through which you can be sure that regardless of the order of operations (read / write), “what happened before” will occur between them. This makes it obvious that the processor clears all changes in local (cache register) copies of objects under synchronization in the main memory, meanwhile not providing access to this particular memory instance during synchronization.

0
source

Source: https://habr.com/ru/post/1742283/


All Articles