Testing on a single-core PC with hyperthreading
If a multithreaded program runs safe on a single-core CPU with hyperthreading, will it also run safe on a dual-core CPU with hyperthreading? Concerning thread-safety etc.
EDIT
Ok, I try to be more specific. I mean the bad source code lines, where I will have forgotten or failed to make sure, that they won't be an (concurrency) issue.
So, maybe the 1-core htt "lies" by preventing dead-locks, crashes, cpu spikes or anything that my code causes on a 2-core machine. I'm unsure, how exactly 2 (logical) processors of a htt PC are different from 2 processors of a dual-c开发者_StackOverflowore PC, how transparent htt is. If there's any issue, I'll probably buy a second PC just for that, that's why I asked.
You're going to have to be more precise with your questions; just throwing "thread-safety etc." at the end of the question doesn't convince me you know what using threads means. What language is the multithreaded application even written in, what OS version are you using, what chipset are you considering?
Regardless, the answer is - hyperthreading "lies" to the OS and convinces it that there are more physical cores in the machine than there really are. From the OS's perspective, there is no difference between a single-core hyperthreaded config and a dual-core non-hyperthreaded config. A dual-core hyperthreaded config, by extension, merely doubles the number of apparent physical cores available.
I think you'll need to read specification papers with respect to the chipset your using to get a deeper knowledge of how hyperthreading is implemented and how it implements memory sharing and synchronization.
精彩评论