Myths and Misconceptions about Threads

被引:0
|
作者
Boehm, Hans-J [1 ]
机构
[1] Google, Mountain View, CA 94043 USA
关键词
Threads; shared variables; sequential consistency; condition variables; data races; weak memory ordering;
D O I
10.1145/2755573.2764966
中图分类号
TP3 [计算技术、计算机技术];
学科分类号
0812 ;
摘要
The semantics of variables shared across threads, usually called "memory models", have evolved significantly over the last decade, but open problems and some controversy remains. I'll briefly review where we are, and argue that a number of assumptions that still appear common in large parts of the research and programming communities are wrong, or at least questionable, especially for programming languages like C and C++. In particular, I will argue that:. Full, unrestricted sequential consistency is not a particularly desirable or useful programming model, in that it depends on access granularity, a property often, and for excellent reasons, hidden by both programming language and library specifications. Hardware level violations of sequential consistency are often not an indication of bugs. For example, correctly synchronized programs based on spin-locks can be expected to violate sequential consistency at the hardware level, while appearing sequentially consistent at the source level. There are no benign data races in C and C++, certainly not in theory, but also not in practice. Any data race gives license to the compiler to mis-compile your program. A future compiler is likely to use that license, even if your current one does not. Condition variable wait and notify, as provided by mainstream programming languages, do not impact program partial correctness beyond the fact that waiting temporarily releases a mutex. They do not, in any other way, ensure "happens-before" ordering. For partial correctness purposes, notify is a no-op. Relaxed memory ordering, as currently defined by Java, C, or C++, is not well-defined at the programming language, as opposed to machine architecture, level. We're working on that, but stronger ordering is much easier to define than really weak ordering.
引用
收藏
页码:55 / 55
页数:1
相关论文
共 50 条
  • [1] Myths and misconceptions about HIPAA
    Kaufman, A
    [J]. ATHLETIC THERAPY TODAY, 2003, 8 (06): : 48 - 49
  • [2] Myths and misconceptions about intelligence: A study of 35 myths
    Furnham, Adrian
    Horne, George
    [J]. PERSONALITY AND INDIVIDUAL DIFFERENCES, 2021, 181
  • [3] Myths and misconceptions about childhood constipation
    Rajindrajith, Shaman
    Devanarayana, Niranga Manjuri
    Thapar, Nikhil
    Benninga, Marc Alexander
    [J]. EUROPEAN JOURNAL OF PEDIATRICS, 2023, 182 (04) : 1447 - 1458
  • [4] Myths and misconceptions about intelligence Introduction
    Larivee, Serge
    [J]. ENFANCE, 2024, (01) : 5 - 10
  • [5] Myths and misconceptions about glaucoma blindness
    Hondeghem, K.
    [J]. ACTA OPHTHALMOLOGICA, 2013, 91
  • [6] Myths and misconceptions about childhood constipation
    Shaman Rajindrajith
    Niranga Manjuri Devanarayana
    Nikhil Thapar
    Marc Alexander Benninga
    [J]. European Journal of Pediatrics, 2023, 182 : 1447 - 1458
  • [7] Myths and misconceptions about chronic constipation
    Müller-Lissner, SA
    Kamm, MA
    Scarpignato, C
    Wald, A
    [J]. AMERICAN JOURNAL OF GASTROENTEROLOGY, 2005, 100 (01): : 232 - 242
  • [8] Three Misconceptions and Myths About MSG
    Hensel, Kelly
    [J]. FOOD TECHNOLOGY, 2018, 72 (11) : 53 - 57
  • [9] A world of difference: Myths and misconceptions about the TEI
    Cummings, James
    [J]. DIGITAL SCHOLARSHIP IN THE HUMANITIES, 2019, 34 : 58 - 79
  • [10] Myths and misconceptions about intrauterine contraception on YouTube
    Luttrell, K.
    Zite, N.
    Wallace, L.
    [J]. CONTRACEPTION, 2008, 78 (02) : 183 - 183