立场文件:不确定性是不可避免的,但数据竞赛是纯粹的邪恶

RACES '12 Pub Date : 2012-10-21 DOI:10.1145/2414729.2414732
H. Boehm
{"title":"立场文件:不确定性是不可避免的,但数据竞赛是纯粹的邪恶","authors":"H. Boehm","doi":"10.1145/2414729.2414732","DOIUrl":null,"url":null,"abstract":"Modern mainstream programming languages distinguish between \"atomic\" (or sometimes \"volatile\") variables, and ordinary data. Atomic accesses are treated as synchronization constructs, and support concurrent access with well-defined semantics. In contrast, concurrent accesses to ordinary data, if at least one access is an update, constitute a data race. Code with data races does not have well-defined semantics. Such code may fail completely when recompiled or run on a different operating system version. In C and C++ data races are equivalent to assignments to out-of-bounds array elements; any data race can result in arbitrary failures, including application crashes, hangs, and inexplicably and completely wrong answers.\n These language specifications, combined with implementation realities, make it unsafe to exploit \"benign\" data races to obtain performance, even if we are willing to tolerate approximate answers. Furthermore, even if we happen to get lucky, and code with data races happens to execute correctly with our current compiler, data races provide at best inconsequential performance advantages over atomics. In fact, there are interesting, and probably common, cases in which data races provide only a minor performance advantage, even over pervasive locking to avoid them, it at sufficiently large core counts. We demonstrate such a case.","PeriodicalId":137547,"journal":{"name":"RACES '12","volume":"53 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2012-10-21","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"48","resultStr":"{\"title\":\"Position paper: nondeterminism is unavoidable, but data races are pure evil\",\"authors\":\"H. Boehm\",\"doi\":\"10.1145/2414729.2414732\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Modern mainstream programming languages distinguish between \\\"atomic\\\" (or sometimes \\\"volatile\\\") variables, and ordinary data. Atomic accesses are treated as synchronization constructs, and support concurrent access with well-defined semantics. In contrast, concurrent accesses to ordinary data, if at least one access is an update, constitute a data race. Code with data races does not have well-defined semantics. Such code may fail completely when recompiled or run on a different operating system version. In C and C++ data races are equivalent to assignments to out-of-bounds array elements; any data race can result in arbitrary failures, including application crashes, hangs, and inexplicably and completely wrong answers.\\n These language specifications, combined with implementation realities, make it unsafe to exploit \\\"benign\\\" data races to obtain performance, even if we are willing to tolerate approximate answers. Furthermore, even if we happen to get lucky, and code with data races happens to execute correctly with our current compiler, data races provide at best inconsequential performance advantages over atomics. In fact, there are interesting, and probably common, cases in which data races provide only a minor performance advantage, even over pervasive locking to avoid them, it at sufficiently large core counts. We demonstrate such a case.\",\"PeriodicalId\":137547,\"journal\":{\"name\":\"RACES '12\",\"volume\":\"53 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2012-10-21\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"48\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"RACES '12\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/2414729.2414732\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"RACES '12","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/2414729.2414732","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 48

摘要

现代主流编程语言区分“原子”(有时是“易失性”)变量和普通数据。原子访问被视为同步构造,并支持具有良好定义语义的并发访问。相反,对普通数据的并发访问,如果至少有一次访问是更新,则构成数据竞争。具有数据竞争的代码没有定义良好的语义。当重新编译或在不同的操作系统版本上运行时,此类代码可能完全失败。在C和c++中,数据争用等同于对越界数组元素的赋值;任何数据竞争都可能导致任意的失败,包括应用程序崩溃、挂起以及莫名其妙的完全错误的答案。这些语言规范与实现现实相结合,使得利用“良性”数据竞争来获得性能变得不安全,即使我们愿意容忍近似的答案。此外,即使我们很幸运,并且具有数据竞争的代码在我们当前的编译器中能够正确执行,数据竞争也只能提供相对于原子的无关紧要的性能优势。事实上,有一些有趣的、可能很常见的情况,在这些情况下,数据竞争只提供了很小的性能优势,甚至比普遍锁定提供的性能优势更小,如果内核数量足够大的话。我们证明了这样一个例子。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Position paper: nondeterminism is unavoidable, but data races are pure evil
Modern mainstream programming languages distinguish between "atomic" (or sometimes "volatile") variables, and ordinary data. Atomic accesses are treated as synchronization constructs, and support concurrent access with well-defined semantics. In contrast, concurrent accesses to ordinary data, if at least one access is an update, constitute a data race. Code with data races does not have well-defined semantics. Such code may fail completely when recompiled or run on a different operating system version. In C and C++ data races are equivalent to assignments to out-of-bounds array elements; any data race can result in arbitrary failures, including application crashes, hangs, and inexplicably and completely wrong answers. These language specifications, combined with implementation realities, make it unsafe to exploit "benign" data races to obtain performance, even if we are willing to tolerate approximate answers. Furthermore, even if we happen to get lucky, and code with data races happens to execute correctly with our current compiler, data races provide at best inconsequential performance advantages over atomics. In fact, there are interesting, and probably common, cases in which data races provide only a minor performance advantage, even over pervasive locking to avoid them, it at sufficiently large core counts. We demonstrate such a case.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信