What is fake sharing?
FALSE Sharing is a situation that may occur in a computer program when two applications that run simultaneously try to access information in the same logical area of memory that each program or process has stored in its own cache. The data in the cache of each application is copied from a common source, so adjusting one cache causes the other to be re -loaded from the source. A false aspect of sharing occurs when changes made in the cache line do not really affect the data that uses the second program, in this case forcing the cache to re -load system resources and negatively affect the performance of the program. The problem of false sharing is difficult to detect because this is not a direct result of any code contained in the applications, although there are effective ways to prevent incorrect sharing, such as the move that is currently storage on a separate line.
one of the primary reasons why it canFalse sharing is found in how the operating system or hardware processes reading and writing data. If the hard disk information or other source is read or written by a program, they usually load into a temporary cache so they can be approached quickly. The amount of information that is from the cache from the source location is called the cache line and is a logical block of memory, which can usually be between 2 bytes and 256 bytes. Within some operating systems or system architectures, programs are able to run simultaneously, for example in parallel processing. This means that it is possible for two separate programs to try to access information in the same cache line, so each program will have its own copy of the source data, which will potentially cause changes in one cache that is not reflected in the second cache, invalidating the data it holds.
K HA There is a range of mechanisms on a situation where two programs are trying to access the same lineThe cache, but the result is most often that one program is forced to reload its cache using the updated information that the other program edited. This type of incident is known as false sharing, when the data in the cache to which each program approaches is not related, so forcing one program to reload the cache is a waste of performance and other sources. This is most often a problem for a program that never modifies information in its cache, so there is no risk of changes in the application of the second process.
There are two predominant ways to prevent or alleviate the effects of false sharing. The first is to add empty information before or after data in memory, which is basically forced to a separate cache line to which it is not accessible by another program. The second method is to reduce the frequency of reading and writing to the cache line, so it is re -loaded as Little as much as possible. More complicated solutions include cache level management or even fromCurrency as the operating system processes sharing.