Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can two processes simultaneously run on one CPU core?

Can two processes simultaneously run on one CPU core, which has hyper threading? I learn from the Internet. But, I do not see a clear straight answer.

Edit: Thanks for discussion and sharing! My purse to post my question here is not to discuss about parallel computing. It will be too big to be discussed here. I just want to know if a multithread application can benefit more from hyper threading than a multi process application. After further reading, I have following as my learning notes.

1) A Hyper-Threading Technology enabled CPU Core has two set of CPU state and Interrupt Logic. Meanwhile, it has only one set of Execution Units and Cache. (I have not study what is pipeline yet)

2) Multi threading benefits from Hyper Threading only if there is latency happen in some executed thread. I think this point can exactly map to the common reason for why and when software programmer use multi thread. If the multi thread application has been optimized. It may not gain any benefit from Hypter threading.

3) If the CPU state maps to process state, I believe Marc is correct that multiple process application can even benefit more from hyper threading technology.

4) When CPU vendor says "thread", it looks like their "thread" is different from thread that I know as a java programmer?

like image 841
Yiyu Jia Avatar asked Jan 18 '12 20:01

Yiyu Jia


1 Answers

While Marc B's answer is pretty much the definitive summary of how HT works, I just want to make a small contribution by linking this article, which should clear up a lot of things about HT: http://software.intel.com/en-us/articles/performance-insights-to-intel-hyper-threading-technology/

like image 138
Tudor Avatar answered Oct 27 '22 00:10

Tudor