Re: [討論] javascript是共時、多執行緒嗎?

看板Ajax作者 (選擇那刻 才算開始)時間12年前 (2011/11/07 16:53), 編輯推噓1(105)
留言6則, 2人參與, 最新討論串8/11 (看更多)
以下列出我的測試網頁(必要部分): index.html: <iframe src="iframe1.html"></iframe> <iframe src="iframe2.html"></iframe> iframe1.html: console.log('A'); while(1); console.log('F'); iframe2.html: console.log('B'); while(1); console.log('F'); 在Opera是會出現A和B兩個 如果一定會跑完iframe1.html再跑iframe2.html的話 應該不會出現B才對 所以我覺得應該是不同的thread... 不過剛剛用process explorer看之後,又覺得, 會不會是javascript thread但是不是kernel thread... 只是fx,chrome都hang住,所以應該是single thread吧XD (不過如果強制停止,感覺實作成iframe1.html停止執行, 就接著執行iframe2.html好像也沒什麼不對XD, 所以停止script後這樣看,感覺不太能推論) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 125.231.162.8

11/07 19:20, , 1F
我覺得你的例子已經可以清楚說明 opera大概是有多執行緒
11/07 19:20, 1F

11/07 19:22, , 2F
我只用FF測 他好像會掛在那裏 所以 我才試了另一個方法
11/07 19:22, 2F

11/07 19:24, , 3F
但測試的概念和你是一模一樣的
11/07 19:24, 3F

11/07 19:26, , 4F
另外看那個process 應該是看不出我們的js thread
11/07 19:26, 4F

11/07 19:26, , 5F
應該只會看到你的browser吧 哈
11/07 19:26, 5F

11/07 19:28, , 6F
裡面有thread的tab,但是thread可以瀏覽器實作阿...orz
11/07 19:28, 6F
文章代碼(AID): #1Ejvo3KK (Ajax)
討論串 (同標題文章)
文章代碼(AID): #1Ejvo3KK (Ajax)