TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

31 pointsby mmarianiabout 12 years ago

1 comment

kevingaddabout 12 years ago
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 未加载