立场文件:非确定性是不可避免的,但数据的比赛是纯粹的邪恶
Position Paper: Nondeterminism is unavoidable, but data races are pure evil
关键词:非确定性;数据竞争;可扩展性
摘 要:Modern mainstream programming languages distinguish between "atomic" (or sometimes "volatile") variables, which support concurrent access, ordinary data accesses with well-defines semantics. Concurrent accesses to an ordinary data variables, if one of those is an update, is defined as a data race. This distinctionis essential; these languages provide meaningful semantics only in the absence of data races. Code with data races not only allows inaccurate results; such code may completely and repeatably fail 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; they can results in arbitrary failures, including application crashes, hangs, and inexplicably and completely wrong answers. These specifications, combined with implementation realities, make it infeasible 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 some compiler, the presence of atomic operations in languages like C and C++ means that data races provide at best inconsequential performance advantages and, in our experience, no scala bility advantages at all.