[問題] multiple thread在multicore

作者: wsx02   2012-06-25 21:28:26
1. when multiple threads run in parallel on a multicore system, would the
more threads for the same task always finish earlier when the number of
threads is less than the number of cores? why?
我想應該是錯的 可是不知道該怎麼解釋 不知道有沒有什麼例子
2. in what situation, applications using kernel thread would not always have
a better performance than using user thread?
我目前想到的是建立和管理user thread會比kernel thread還快
可是想不到有什麼實際的例子
謝謝
作者: mars90226 (火星人)   2012-06-25 23:37:00
你這個跟我考的期中考一模一樣阿...我第一題寫"不會",create thread需要資源而且multithread工作還是需要整合,也需要時間第二題主因是kernel thread需要context switch太多kernel threads時,context switch時間就會太久
作者: mingcloud (逆宇)   2012-06-26 16:50:00
第二題: 簡單的例子 有個Server每次有人連進來就開Thd開完回傳現在時間就掛掉 人多的話就掛一直開Thd再死掉用Kernel Thread 會非常沒效率(基本上只是你敘述的加強)第一題的話是錯的 但是很難舉實例就算上班之後你也只測出幾個Thd效能最好原因是越多Thd管理上要付出的成本越大第一題其實也可以用我上面例子 回傳時間這個簡單的事情不需要再多開一個Thd你新的這兩個描述我都覺得怪怪的 感覺都是case by case

Links booklink

Contact Us: admin [ a t ] ucptt.com