A
A
Alexey2014-11-30 19:06:58
.NET
Alexey, 2014-11-30 19:06:58

How to find out about hyperthreading in the code?

Good evening everyone! I am interested in multi-threaded programming, I wondered how to find out if the processor supports multi-threading? For example, if you organize thread synchronization, there are several possible options for non-blocking designs. One of them is for processors with HyperThreading technology to use the SpinWait method of the Thread class, this is the Win32 equivalent of the YieldProcessor method. Richter writes that in processors that do not support this technology, calling this macro allows you to write code that is independent of the processor architecture. I was thinking, is it possible to write code that will take into account the capabilities of the processor and at the same time more specific methods will be called, as well as various synchronization constructs will be used?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mayorovp, 2014-12-01
@mayorovp

As far as I understand, it's not about HyperThreading - it's about the number of simultaneously executed threads. In this regard, HyperThreading and "honest" multi-core processors are no different. So you can use the GetMaximumProcessorCount function.
msdn.microsoft.com/en-us/library/windows/desktop/d...
PS and in general, forget about obsolete technologies. Now they put 4 cores in phones.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question