TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Wasp's Nest: A Lock-Free Concurrency Pattern In Python

31 点作者 mmariani大约 12 年前

1 comment

kevingadd大约 12 年前
Does anything in CPython really count as lock-free, given the presence of the GIL? Lots of clever algorithms happen to work without the addition of mutexes in CPython, because you can count on individual python instructions being effectively atomic (like list append, if memory serves) due to the interpreter acquiring a global mutex whenever a python thread is running.<p>Decent writeup of read-copy-update, at least. I'm annoyed that he never provided any actual measurements to prove that the addition of a mutex is a bad solution for the problem, or too slow.<p>It's really, really easy to write a 'correct' lock-free implementation that gets dramatically outperformed by a simpler implementation using mutexes. It all depends on how you use the mutex, how fast your mutex implementation is, how fast your atomic primitives are, and other details like whether you're sharing cache pages.
评论 #5689401 未加载
评论 #5689154 未加载