星期二, 6月 14, 2005

ThreadX said : multithread may not lower down the system throughput

從ThreadX的說明文件摘錄的:
Many developers assume that multi-threaded
environments like ThreadX increase overhead and have a
negative impact on total system throughput. But in some
cases, multi-threading actually reduces overhead by
eliminating all of the redundant polling that occurs in
control loop environments. The overhead associated with
multi-threaded kernels is typically a function of the time
required for context switching. If the context switch time
is less than the polling process, ThreadX provides a
solution with the potential of less overhead and more
throughput. This makes ThreadX an easy choice for
applications that have any degree of complexity or size.
實 際上要比較context switch和loop polling的時間,如果loop polling的時間很長(也就是說control loop有很多variable要檢查),那麼使用multithread system會比採用control loop的forground/background design來得有效率。

所以這純粹是設計上的問題,forground/background也可以設計成event driven。
不過若完全以system throughput來設計,forground/background的設計overhead一定比較小。

沒有留言:

張貼留言