Is memory barrier prevents cache coherency issue ?
Yes, Memory barriers are also used as a way to prevent cache-coherency issues. By using memory-barriers in our code, it makes sure that pending memory writes have actually been written to main memory before proceeding.