0

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-core 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.

4

1 回答 1

1

你将不得不更准确地回答你的问题;只是抛出“线程安全等” 在问题的最后并不能说服我您知道使用线程的含义。多线程应用程序是用什么语言编写的,您使用的是什么操作系统版本,您正在考虑使用什么芯片组?

无论如何,答案是——超线程对操作系统“撒谎”,并说服它机器中的物理内核比实际内核多。从操作系统的角度来看,单核超线程配置和双核非超线程配置没有区别。通过扩展,双核超线程配置只会使可用物理内核的数量增加一倍。

我认为您需要阅读有关您使用的芯片组的规范文件,以更深入地了解超线程是如何实现的,以及它是如何实现内存共享和同步的。

于 2010-12-04T10:37:36.937 回答