作者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
推 ykjiang:所以這是針對 server 程式的描述 203.67.106.7 07/22
→ jeunder:html 61.230.239.39 07/23
→ jeunder:state threads 似乎是這概念的專有名詞. 雖然我 61.230.239.39 07/23
→ jeunder:得這概念應該不侷限於 socket programming, 不過 61.230.239.39 07/23
→ jeunder:網路上的資訊似乎大都侷限於網路方面的應用. 61.230.239.39 07/23
→ jeunder:不, state threads 是 lib. name, 我搞錯了... 61.230.239.39 07/23