Questions tagged [hyperthreading]

In a hyperthreaded CPU, for each processor core that is physically present, the operating system addresses two virtual or logical cores, and shares the workload between them when possible.

In an hyper threaded environment, For each processor core that is physically present, the operating system addresses two virtual or logical cores, and shares the workload between them when possible.

This allows to decrease the number of dependent instructions on the pipeline. It takes advantage of superscalar architecture (multiple instructions operating on separate data in parallel).

223 questions
90
votes
4 answers

What are the differences between multi-CPU, multi-core and hyper-thread?

Could anyone explain to me the differences between multi-CPU, multi-core, and hyper-thread? I am always confused about these differences, and about the pros/cons of each architecture in different scenarios. Here is my current understanding after…
George2
  • 44,761
  • 110
  • 317
  • 455
53
votes
14 answers

How to Detect the Number of Physical Processors / Cores on Windows, Mac and Linux

I have a multi threaded c++ application that runs on Windows, Mac and a few Linux flavors. To make a long story short: In order for it to run at maximum efficiency, I have to be able to instantiate a single thread per physical processor/core.…
HTASSCPP
  • 609
  • 1
  • 6
  • 4
45
votes
4 answers

RISC-V spec references the word 'hart' - what does 'hart' mean?

I found references to hart on page 35 of the RISC-V 2.1 spec. However, I could not find a definition for hart in this document. Does hart refer to a hardware-thread or something more sinister?
daveW
  • 511
  • 1
  • 5
  • 10
27
votes
8 answers

Multicore + Hyperthreading - how are threads distributed?

I was reading a review of the new Intel Atom 330, where they noted that Task Manager shows 4 cores - two physical cores, plus two more simulated by Hyperthreading. Suppose you have a program with two threads. Suppose also that these are the only…
Mark Ransom
  • 299,747
  • 42
  • 398
  • 622
26
votes
2 answers

What are the latency and throughput costs of producer-consumer sharing of a memory location between hyper-siblings versus non-hyper siblings?

Two different threads within a single process can share a common memory location by reading and/or writing to it. Usually, such (intentional) sharing is implemented using atomic operations using the lock prefix on x86, which has fairly well-known…
BeeOnRope
  • 60,350
  • 16
  • 207
  • 386
25
votes
4 answers

Why would a fully CPU bound process work better with hyperthreading?

Given: An entirely CPU bound very large (i.e., more than a few CPU cycles) job, and A CPU with four physical and a total of 8 logical cores, should 8, 16, and 28 threads perform better than 4? I understand that four threads would have lesser…
displayName
  • 13,888
  • 8
  • 60
  • 75
24
votes
7 answers

Is it possible to check in Java if the CPU is hyper threading?

I would like to know the optimal number of threads I can run. Normally, this equals to Runtime.getRuntime().availableProcessors(). However, the returned number is twice as high on a CPU supporting hyper threading. Now, for some tasks hyper…
mark
  • 59,016
  • 79
  • 296
  • 580
23
votes
2 answers

Impact of hyperthreading on compiler performance?

Say we want to compile a large project (say GCC or the Linux kernel) as fast as possible. Does a CPU with hyperthreading capability (say an Intel Core i7) run the compiler any faster with hyperthreading enabled or disabled? Are there any published…
Jay Conrod
  • 28,943
  • 19
  • 98
  • 110
22
votes
6 answers

Linux find out Hyper-threaded core id

I spent this morning trying to find out how to determine which processor id is the hyper-threaded core, but without luck. I wish to find out this information and use set_affinity() to bind a process to hyper-threaded thread or non-hyper-threaded…
Patrick
  • 4,186
  • 9
  • 32
  • 45
22
votes
4 answers

Threads vs Cores

Say if I have a processor like this which says # cores = 4, # threads = 4 and without Hyper-threading support. Does that mean I can run 4 simultaneous program/process (since a core is capable of running only one thread)? Or does that mean I can run…
teonghan
  • 367
  • 1
  • 4
  • 9
18
votes
3 answers

Hyper-threading... made my renderer 10 times slower

Executive summary: How can one specify in his code that OpenMP should only use threads for the REAL cores, i.e. not count the hyper-threading ones? Detailed analysis: Over the years, I've coded a SW-only, open source renderer (rasterizer/raytracer)…
ttsiodras
  • 10,602
  • 6
  • 55
  • 71
16
votes
1 answer

Poor performance due to hyper-threading with OpenMP: how to bind threads to cores

I am developing large dense matrix multiplication code. When I profile the code it sometimes gets about 75% of the peak flops of my four core system and other times gets about 36%. The efficiency does not change between executions of the code. It…
Z boson
  • 32,619
  • 11
  • 123
  • 226
15
votes
3 answers

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…
Yiyu Jia
  • 171
  • 1
  • 1
  • 8
15
votes
6 answers

Dual-Core Hyperthreading: Should I use 4 threads or 3 or 2?

If you're spawning multiple threads (or processes) concurrently, is it better to spawn as many as the number of physical processors or the number of logical processors, assuming the task is CPU-bound? Or is it better to do something in between (say,…
user541686
  • 205,094
  • 128
  • 528
  • 886
15
votes
5 answers

8 logical threads at 4 cores will at a maximum run 4 times faster in parallel?

I'm benchmarking software which executes 4x faster on Intel 2670QM then my serial version using all 8 of my 'logical' threads. I would like some community feedback on my perception of the benchmarking results. When I am using 4 Threads on 4 cores I…
Cisum Inas
  • 11,552
  • 11
  • 40
  • 55
1
2 3
14 15