11/03/2006

Ruby Thread

JavaEye 有一篇文章 Ruby的伪线程,講述的是 Ruby 在 Thread 的問題。在目前為止,Ruby 的 Thread 還不是 native thread ,所以根據 jack 的說法
这样做的确使得Ruby的Thread很容易控制,程序也不容易产生类似死锁这类严重的线程问题。但是效率始终无法提高,因为在ruby进程中,实际上只 有一个真实的线程在运行,同样的代码在那么多核或者多cpu的电脑上运行效率和单核cpu的电脑上的效率并不会相差多少。
當然 Thread 對於 Performance 對於效能的進步是有很大的幫助啦。不過目前 Ruby 上面最有希望的 Native Thread Virtual Machine :YARV 目前處於緩步狀態。(一個人作實在太操了)並且 YARV 到目前並沒有完整的計畫支援 continuation 的計畫,這實在對 Ruby 社群更加減少了使用 YARV 的動力。

根據 Another Year, Another Interpreter 這篇文章,更是拋下一個震撼彈
And then Matz and Koichi dropped the bomb: Ruby 2.0 would support neither continuations nor green threads.
真是太慘了,看來 Thread 在 Ruby 還是遙遙無期。這時候,Ruby 社群應該把重心投入在 YARV 上面,還是剛剛傳出大捷報的 JRuby 上面呢?畢竟 JRuby 是 Native Thread 的,目標也是可以在 JVM 上面跑 Ruby on Rails (目前 JRuby 確定可以跑 Active Record )。這似乎是一個好選擇,不過 Ruby 社群是不是願意將所有籌碼壓寶在 JRuby 呢?JRuby 現在可是由SUN 這家商業公司所主導的。

當然就算 Ruby 支援 Thread ,也會有很多問題要解決。Rails 本身不是 Thread Safe 的,Zed Shaw (Mongrel 作者)也說 Meta Programming 有很多 Thread Safe Probelm 。總之,Thread on Ruby 是一個難題,短期內也應該不會有很好的解法。

7 則留言:

contagion 提到...

其實我覺得 Ruby 慢的原因和 thread 沒有什麼太大的關係。之前在 railscn 也和別人吵過相關的問題,請參考我的這篇文章

thegiive 提到...

Con...這篇是好文章,其實我把 Thread 當成一種語言的基礎建設啦,有糟糕的地方就得講出來啦。不過是不是 Ruby 有許多特性不適合 Thread?還得看看。

匿名 提到...

photograph of a pharmacy http://diabetes-type.kqv.in/information-on-symptoms-of-diabetes pharmacy christmas reading area [url=http://depression.kqv.in/employment-during-the-great-depression]employment during the great depression[/url]
advantages of online pharmacy http://penis-growth.kqv.in/erotic-glans-penis compounding pharmacy classifieds [url=http://orgasm.kqv.in/ftv-sasha-sticky-wet-orgasm]mcsweeney group sells pharmacy[/url]
university at buffalo pharmacy law review series may 23 http://heart-medicine.kqv.in/sacred-heart-memorial-hospital-diet fda guidelines pharmacy [url=http://drug-policy.kqv.in/urine-odor-drug-use]urine odor drug use[/url]
westby pharmacy http://pill.kqv.in/pill-g-22 best choices from the peoples pharmacy book [url=http://diet-and.kqv.in/new-life-style-diet]pharmacy technician jobs in south florida[/url]
cheapscripts pharmacy http://diet-online.kqv.in/heidi-klum-diet online pharmacy reviews [url=http://diabetes-type.kqv.in/renal-diabetes-diet-menu]renal diabetes diet menu[/url]
texas state board of pharmacy website http://dental.kqv.in/dental-implant-new-saratoga-york meridia pharmacy online sale [url=http://diet.kqv.in/bariatric-diet-food]preparation h with biodyne canadian pharmacy[/url]

匿名 提到...

bigblack ass http://porn-xxx.qgu.in/dial-up-porn-free free adult anime pix [url=http://blow.qgu.in/popeye-blow-me-down-wallpaper]popeye blow me down wallpaper[/url]
i love licking ass http://orgy.qgu.in/cum-orgy adult stocking stuffers for car lovers [url=http://virgins.qgu.in/preteen-tiny-virgins]arlingyon adult education[/url]
adult top halloween costume ideas http://virgins.qgu.in/virgins-first-time-porn adult book stores in manhattan [url=http://photo-sexual.qgu.in/stories-sexual]stories sexual[/url]
new adult websites http://hentai-sex.qgu.in/harry-potter-porn-hentai i need anal sex spanking [url=http://incest.qgu.in/free-incest-litritature]adult white masquerade costume gloves costume gloves[/url]
funny adult santa jokes http://blow.qgu.in/rushing-wind-blow-though-this-temple nc adult diretory [url=http://bondage.qgu.in/tv-bondage]tv bondage[/url]
adult hardcore sex movies and pics http://bondage.qgu.in/art-of-bondage anal mums [url=http://sex-mature.qgu.in/mature-dutch-erotica]amateur licking[/url]

匿名 提到...

auditing compnaies that travel http://airport.qrv.in/coast-airport-hotel-vancouver insurance ntuc singapore travel [url=http://flight.qrv.in/flight-tracker-international]flight tracker international[/url]
boat travel members british columbia http://tourism.qrv.in/arkansas-jobs-in-hospitality-tourism-stats heritage leather shoulder travel bag mens [url=http://vacation-packages.qrv.in/vacation-package-from-toronto-to-golden-nugget-in-las-vegas]four winds travel trailer[/url]
george stuart travel http://airline.qrv.in/airline-crash-pukhet guatemala travel deals [url=http://tourism.qrv.in/philippines-samar-tourism]philippines samar tourism[/url]
air travel to las vagas http://tourism.qrv.in/wales-tourism-information airborne travel link [url=http://travel.qrv.in/pennsylvania-travel-advisory]travel zines[/url]
stainless steel travel coffee mug http://airline.qrv.in/curtis-spokane-airline caribbean vacation travel cruise [url=http://plane-tickets.qrv.in/plane-tickets-for-under-100-dollars]plane tickets for under 100 dollars[/url]
boonton travel http://travel.qrv.in/par-o-dice-travel-chesterfield-michigan british travel western australia [url=http://adventure.qrv.in/mile-high-adventure-club]newborn travel systems[/url]

匿名 提到...

[url=http://www.WadeIndustries.com/article/Lost-and-Found-In-Adaptation-Fate-Stay-Night.html]Lost and Found In Adaptation Fate Stay Night[/url]
[url=http://www.WadeIndustries.com/article/Decorating-your-kids-rooms-with-colors.html]Decorating your kids rooms with colors[/url]
[url=http://www.WadeIndustries.com/article/Love-quiz-Do-You-Feel-Loved.html]Love quiz Do You Feel Loved[/url]
[url=http://www.WadeIndustries.com/article/Basic-Guide-To-Tanzanite.html]Basic Guide To Tanzanite[/url]
[url=http://www.WadeIndustries.com/article/Top-5-Financial-Freedom-Tips-For-Success.html]Top 5 Financial Freedom Tips For Success[/url]
[url=http://www.WadeIndustries.com/article/A-Simple-Way-to-Address-Common-Wireless-Network-Problems.html]A Simple Way to Address Common Wireless Network Problems[/url]
[url=http://www.WadeIndustries.com/article/Online-Pet-Stars-What-Makes-A-Great-Pet-Website.html]Online Pet Stars What Makes A Great Pet Website[/url]
[url=http://www.WadeIndustries.com/article/Doors-Open-2006-Toronto-s-Architectural-Festival-Sure-Has-Become-Popular.html]Doors Open 2006 Toronto s Architectural Festival Sure Has Become Popular[/url]
[url=http://www.WadeIndustries.com/article/5-Need-to-Know-Business-Bankruptcy-Tips.html]5 Need to Know Business Bankruptcy Tips[/url]
[url=http://www.WadeIndustries.com/article/Canadian-Bacon-Now-An-American-Favorite.html]Canadian Bacon Now An American Favorite[/url]

匿名 提到...

[url=http://www.WadeIndustries.com/article/Shopping-for-Christmas-Tree-Decorations.html]Shopping for Christmas Tree Decorations[/url]
[url=http://www.WadeIndustries.com/article/Pay-The-Right-Price-Laminate-Flooring.html]Pay The Right Price Laminate Flooring[/url]
[url=http://www.WadeIndustries.com/article/how-are-diamonds-mined-187.html]how are diamonds mined 187[/url]
[url=http://www.WadeIndustries.com/article/Tips-For-Seniors.html]Tips For Seniors[/url]
[url=http://www.WadeIndustries.com/article/Beautifully-Crafted-Sterling-Silver-Hearts-Feature-Half-Open-Design-and-Half-Dainty-Marcasite-Detail.html]Beautifully Crafted Sterling Silver Hearts Feature Half Open Design and Half Dainty Marcasite Detail[/url]
[url=http://www.WadeIndustries.com/article/A-perfect-cure-for-the-problem-called-Erectile-Dysfunction.html]A perfect cure for the problem called Erectile Dysfunction[/url]
[url=http://www.WadeIndustries.com/article/Handle-With-Care-How-to-Pack-For-Moving-Day.html]Handle With Care How to Pack For Moving Day[/url]
[url=http://www.WadeIndustries.com/article/Free-and-Entertaining-Escape-Games-for-the-Whole-Family.html]Free and Entertaining Escape Games for the Whole Family[/url]
[url=http://www.WadeIndustries.com/article/Pro-s-And-Con-s-Of-Low-Cost-And-No-Cost-Refinancing.html]Pro s And Con s Of Low Cost And No Cost Refinancing[/url]
[url=http://www.WadeIndustries.com/article/Menorca-Must-See-Attractions-While-on-Holiday-in-Menorca.html]Menorca Must See Attractions While on Holiday in Menorca[/url]