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 条
  • [41] CANCER - MYTHS AND MISCONCEPTIONS
    BOX, V
    [J]. JOURNAL OF THE ROYAL SOCIETY OF HEALTH, 1984, 104 (05): : 161 - &
  • [42] Common myths, misconceptions and assumptions about MtBE: Where are we now?
    Woodward, RE
    Sloan, RL
    [J]. ABSTRACTS OF PAPERS OF THE AMERICAN CHEMICAL SOCIETY, 2002, 223 : U531 - U531
  • [43] MYTHS & MISCONCEPTIONS ABOUT HIV/AIDS IN OLDER COMMITTED ETHNIC MINORITIES
    Macklin, O.
    [J]. GERONTOLOGIST, 2010, 50 : 425 - 425
  • [44] Myths and Misconceptions About Nonnative English Speakers in the TESOL (NNEST) Movement
    Selvi, Ali Fuad
    [J]. TESOL JOURNAL, 2014, 5 (03) : 573 - 611
  • [45] Exploring Myths and Misconceptions About Dog Behavior in a Spanish Population Sample
    Menor-Campos, David J.
    Parreno, Marta
    Howell, Tiffani
    Diverio, Silvana
    [J]. ANTHROZOOS, 2024,
  • [46] Vaccine myths and misconceptions
    Clift, Kathy
    Rizzolo, Denise
    [J]. JAAPA-JOURNAL OF THE AMERICAN ACADEMY OF PHYSICIAN ASSISTANTS, 2014, 27 (08): : 21 - 25
  • [47] Authentication - Myths and misconceptions
    Gollmann, D
    [J]. CRYPTOGRAPHY AND COMPUTATIONAL NUMBER THEORY, 2001, 20 : 203 - 225
  • [48] An Apple a Day: The Myths, Misconceptions, and Truths About the Foods We Eat.
    Minkin, Rachel M.
    [J]. LIBRARY JOURNAL, 2008, 133 (18) : 95 - 96
  • [49] Myths, Misconceptions and Myopia: Searching for Clarity in the Debate about the Regulation of Consumer Genetics
    Hogarth, S.
    [J]. PUBLIC HEALTH GENOMICS, 2010, 13 (05) : 322 - 326
  • [50] Myths and misconceptions about intrauterine contraception among women seeking termination of pregnancy
    Michie, Lucy
    Cameron, Sharon T.
    Glasier, Anna
    Wellings, Kaye
    Loudon, Joanna
    [J]. JOURNAL OF FAMILY PLANNING AND REPRODUCTIVE HEALTH CARE, 2014, 40 (01): : 36 - U41