Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

sfence disturb other cores' timing

Calling to sfence in multi-core system will 'steal' the other cores' timing.
From the documents it seems that there is a sloop response when we call sfence.

I just don't want one core disturbing other cores.
Is there any method that can reduce such affection?

0 Kudos
1 Reply
Valued Contributor II
How do you keep one core from disturbing others? By leaving it idle. The last two lines of this post in some ways represent the dilemma of parallel programming: how do I maximize the work on one core while not interfering with the work on other cores? The means for so-called "embarrassingly parallel" applications is to assure that each HW thread modifies separate sections of memory so that they each have exclusive use. Even then they may be slowing each other down through the consumption of memory hierarchy bandwidth but they can at least avoid memory thrashing that results from trying to write in each others' memory regions.

Sfence is intended to guarantee sequential consistency in a world where thememoryrules are weakened to enable more performance. I don't know what is meant above by " 'steal' the other cores' timing." Sfence doesn't affect any HW thread but the one upon which it was issued. All it can do is slow things down on that thread, to ensure that any store operations previously issued on that thread are globally visible before any other store operations are initiated. If several threads are using sfence to assure fair access to a mutex and its associated data, each of those threads' write actions may be delayed, and the interactions between them will slow.
0 Kudos