作者billyeh (bill)
看板CSSE
标题Re: 以前问过的问题...OS
时间Fri Jul 22 17:51:47 2005
※ 引述《halajohn (神鵰侠)》之铭言:
:
: 这句话是 linux kernel 着名 hacker, Alan Cox 说的
: 他的原句是
: "Computers are state machines.
: Threads are for people who can't program state machines."
: 我认同这句话,但我并不是否定 thread :)
: 事实上,我在 Sun 当了几次的 pthread programming 讲师...
: 然而我写程式能不用 thread 就不用 thread
: 不用 thread 而采用 state machine 架构好处很多 :)
: 到目前为止,我还没写过不能用 state machine 来取代原本 thread 架构的程式
这句话很对, thread model 本来就是为了简化
传统 state machine、select() 的程式写法而设计的,
好处是:程式逻辑简单明了, 易写, 易维护,
缺点是:占资源、效能较差。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.113.23.101
1F:推 ykjiang:所以这是针对 server 程式的描述 203.67.106.7 07/22
3F:→ jeunder:html 61.230.239.39 07/23
4F:→ jeunder:state threads 似乎是这概念的专有名词. 虽然我 61.230.239.39 07/23
5F:→ jeunder:得这概念应该不局限於 socket programming, 不过 61.230.239.39 07/23
6F:→ jeunder:网路上的资讯似乎大都局限於网路方面的应用. 61.230.239.39 07/23
7F:→ jeunder:不, state threads 是 lib. name, 我搞错了... 61.230.239.39 07/23