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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Concurrency ≠ Threads

9 点作者 spydez将近 17 年前

4 条评论

ajross将近 17 年前
"But there are other forms of concurrency. Processes that communicate using files, pipes, sockets, or even shared memory."<p>I don't see how this solves the problem. It's true that some problems work well as pipelines where each stage does some finite, balanced amount of work before passing the data off to the next stage. But many don't.<p>And I don't follow the files and shared memory argument at all: those are both shared, unsynchronized-in-the-base-API abstractions <i>just</i> <i>like</i> <i>threading</i>. And they're subject to all the same deadlocks and race conditions. The only difference is that you use slightly different synchronization primitives (e.g. fcntl() locks instead of mutex locks).<p>It's correct to point out that traditional threaded code is difficult to get right. But it's naive and unhelpful to point to any kind of "secret sauce" as the solution. The difficulty of concurrency lies in the <i>problem</i> <i>itself</i>, not the API.
评论 #240148 未加载
评论 #240976 未加载
评论 #240099 未加载
评论 #240201 未加载
bayareaguy将近 17 年前
For application-level concurrency I really like the way Lua explicitly excludes the most error-prone and system-dependent concurrency primitives (preemptive threads, mutexes, semaphores, shared memory, etc) and instead offers API's for efficient non-preemptive coroutines and states which share no memory.
sah将近 17 年前
This paper makes a pretty compelling argument against threads as a model for concurrency:<p><a href="http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf" rel="nofollow">http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1....</a>? [pdf]
nailer将近 17 年前
"But there are other forms of concurrency. Processes that communicate using files, pipes, sockets, or even shared memory."<p>Using multiple single-threaded processes means you're using multiple threads.<p>What he's saying is true, but he's worded it really clumsily. He's pointing out alternatives to multithreaded processes, not threads per se.