Cores vs Threads

MikeRocor

Well-Known Member
Joined
Jun 3, 2023
Messages
1,038
Reaction score
1,223
Credits
9,863
I can cat /proc/cpuinfo and see that my system has
Code:
...
processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 78
model name      : Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
...

and I can google Core i5-6200U to find out that this is a dual core CPU with hyperthreading so it will appear as 4 cores (as shown by /proc/cpuinfo listing processor number 3 (the first being processor 0).

But is there any convenient way (without looking up the CPU online) to tell for sure if it's two cores hyperthreaded ot 4 cores single threaded? I suppose one of the many cpu flags listed probably has to do with hyperthreading, but I was hoping for something that just says "<X> number of real cores and <Y> number of threads".

It's just a curiosity for me as I can't think of a circumstance where it would matter much. I deal with a bunch of computers of various ages and it would be nice to know, if only for conversational purposes.
 


Running lscpu kicked out a lot of info. for me:-:)
Code:
bash-5.1$ lscpu
Architecture:                x86_64
  CPU op-mode(s):            32-bit, 64-bit
  Address sizes:             43 bits physical, 48 bits virtual
  Byte Order:                Little Endian
CPU(s):                      12
  On-line CPU(s) list:       0-11
Vendor ID:                   AuthenticAMD
  Model name:                AMD Ryzen 5 3600X 6-Core Processor
    CPU family:              23
    Model:                   113
    Thread(s) per core:      2
    Core(s) per socket:      6
    Socket(s):               1
    Stepping:                0
    Frequency boost:         enabled
    CPU max MHz:             4408.5928
    CPU min MHz:             2200.0
 
Perhaps the cpufetch app is useful:

cpufetch.jpg
 
Perhaps the cpufetch app is useful:

View attachment 29200
Ok then. Who'd've thought there was a tool just for that?

Thanks for the quick response. Even though it wasn't exactly the answer I was looking for, it did get me started down the right path...

Turns out my distro (Tiny Core) doesn't have cpufetch in-repo but it does have a package called libcpuid which contains, in addition to some relevant libraries, cpuid_tool which is exactly what I was looking for.
 
Ok then. Who'd've thought there was a tool just for that?

Thanks for the quick response. Even though it wasn't exactly the answer I was looking for, it did get me started down the right path...

Turns out my distro (Tiny Core) doesn't have cpufetch in-repo but it does have a package called libcpuid which contains, in addition to some relevant libraries, cpuid_tool which is exactly what I was looking for.
The cpuid_tool does provide more info than cpufetch, but it doesn't actually mention "threads" which post #1 was interested in.

If you have a building/compiling toolchain installed in tiny core, it's no problem compiling cpufetch from source if you'd like to have it. Here's a rundown for doing that:
Code:
[~]$ git clone https://github.com/Dr-Noob/cpufetch.git
Cloning into 'cpufetch'...
remote: Enumerating objects: 4650, done.
remote: Counting objects: 100% (1402/1402), done.
remote: Compressing objects: 100% (371/371), done.
remote: Total 4650 (delta 1135), reused 1055 (delta 1031), pack-reused 3248 (from 3)
Receiving objects: 100% (4650/4650), 3.63 MiB | 16.81 MiB/s, done.
Resolving deltas: 100% (3316/3316), done.

[~]$ ls
cpufetch

[~]$ cd cpufetch/

[~/cpufetch]$ ls
CONTRIBUTING.md  cpufetch.1  doc  LICENSE  Makefile  pictures  README.md  src

[~/cpufetch]$ view README.md

[~/cpufetch]$ make
cc -Wall -Wextra -pedantic -pthread -DARCH_X86 -std=c99 -fstack-protector-all -O2 -Wfloat-equal -Wshadow -Wpointer-arith -Wstrict-prototypes -c -pthread src/x86/freq/freq_nov.c -o freq_nov.o
cc -Wall -Wextra -pedantic -pthread -DARCH_X86 -std=c99 -fstack-protector-all -O2 -Wfloat-equal -Wshadow -Wpointer-arith -Wstrict-prototypes -c -mavx -pthread src/x86/freq/freq_avx.c -o freq_avx.o
cc -Wall -Wextra -pedantic -pthread -DARCH_X86 -std=c99 -fstack-protector-all -O2 -Wfloat-equal -Wshadow -Wpointer-arith -Wstrict-prototypes -c -mavx512f -pthread src/x86/freq/freq_avx512.c -o freq_avx512.o
cc -Wall -Wextra -pedantic -pthread -DARCH_X86 -std=c99 -fstack-protector-all -O2 -Wfloat-equal -Wshadow -Wpointer-arith -Wstrict-prototypes -DGIT_FULL_VERSION=\""v1.07-1-gb1f2"\" src/common/main.c src/common/cpu.c src/common/udev.c src/common/printer.c src/common/args.c src/common/global.c src/common/freq.c src/x86/cpuid.c src/x86/apic.c src/x86/cpuid_asm.c src/x86/uarch.c src/x86/freq/freq.c freq_nov.o freq_avx.o freq_avx512.o -o cpufetch

[~/cpufetch]$ ls
CONTRIBUTING.md  cpufetch.1  freq_avx512.o  freq_nov.o  Makefile  README.md
cpufetch         doc         freq_avx.o     LICENSE     pictures  src

After running "make", the cpufetch executable appears in the directory and can be placed in the $PATH to run.
 
Thanks - I'll probably do that and maybe even package it up to upload to the Tiny Core repo.

In the mean time while cpuid_tool --cores yields the number of actual cores, it looks like cpuid_tool --logical yields the number of threads which seems like it would, on any of the older CPUs I have, be the same as the output of cpuid_tools --total-cpus

I suppose on modern hardware with "efficient cores" and "performance cores" maybe "--logical" might be different than "--total_cpus"
 

I believe this cpu was made around 2015

Hope its not a hindrance......I'll scrub it, if its of no help

Essentials​

Download Specifications
Product Collection


7th Generation Intel® Core™ i7 Processors



Code Name

Products formerly Kaby Lake



Vertical Segment
Desktop
Processor Number
i7-7700
Lithography
14 nm

CPU Specifications​

Total Cores
4
Total Threads
8
Max Turbo Frequency
4.20 GHz
Intel® Turbo Boost Technology 2.0 Frequency‡
4.20 GHz
Processor Base Frequency
3.60 GHz
Cache
8 MB Intel® Smart Cache
Bus Speed
8 GT/s
# of QPI Links
0
TDP
65 W

Code:
lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 39 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Vendor ID: GenuineIntel
Model name: Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
CPU family: 6
Model: 158
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
Stepping: 9
CPU(s) scaling MHz: 98%
CPU max MHz: 4200.0000
CPU min MHz: 800.0000
BogoMIPS: 7200.00






 
@MikeRocor :-

I'll second @osprey on this one. CPUFetch is probably about the simplest & easiest to read for this.

There's several GUI- or terminal-based apps out there which will give you the same information. However; one thing I have noticed is that although all will give number of cores/number of threads per core/total number of threads, I haven't seen one that specifically tells you how many of these are "real" threads & how many are "virtualized" threads.

I suppose the authors take it for granted that knowing each core will provide ONE "real" thread and ONE "virtualized" thread is common knowledge!

~~~~~~~~~~~~~~~~~~~~~~​

Interesting you should start this thread.

I've been debating for a while now whether to perform a CPU upgrade on the Pavilion desktop rig. The present 'incumbent' is an Intel Pentium "Gold" G5400; dual-core w/HT. The base frequency is plenty fast enough, but it's missing one important instruction that more & more developers are requiring in their apps these days.....AVX.

Although all 'Coffee Lakes' have had this since the beginning, Intel disabled it in the Pentiums to 'aim' it at its target market.

Base frequency is 3.7 GHz. TDP at present is 58W.

I'm planning to fit an i5-8600K. This is 6-core, with NO hyperthreading.....but this will give me 6 "real" threads. Base of 3.6 GHz, 'turbo' boost is 4.3 GHz. TDP here is 95W. I'm thinking this will provide more REAL "grunt" for its intended task.....primarily, video-editing. (I read somewhere, long ago, that the "virtualized" threads never get access to full resources like the "real" threads do. That was on a respected hardware community, several years ago.....and it's always stuck in my mind).

The HP 843B's H370 chipset supports all the way up to the i9-9900 on this board, so it should be a drop-in replacement. I've found confirmation of this on the HP Community Forums, so I believe the whole business should be relatively straight-forward and hassle-free.

Prior to upgrading the GPU a few weeks back - which entailed upgrading the PSU as well, because it was scraping the ceiling of what the old PSU could supply - I would have never contemplated this. With the new PSU, I now have ample 'spare' headroom to play with.

The LGA 1151 socket was designed for a range of CPUs, with a range of differing TDP requirements. The socket is capable of delivering the required power, IF the PSU can supply it.....which it now can.

I've found a nice-condition i5-8600K on eBay for around GBP £40.

~~~~~~~~~~~~~~~~~~~~​

Question, guys:- Is the OEM Intel "standard" round heatsink really as much of a pain to remove/replace as they say it is? o_O

Mods:- Sorry for the "off-topic" chunk - I know that should be in Hardware - but given the mention of hyper-threading in post #1, I felt it worth mentioning that I was planning a swap to a non-hyperthreaded CPU.....along with explaining my reasons.


Mike. ;)
 
Last edited:
The last Intel one I did [in a desk top] had star drive blind bolts
 
Not sure why so much talk when your solution is perfect and standard one to get count of cores and threads.
Yet again, feeling kinda dumb. I had no idea there was a command called "lscpu" but there it is. I'm thinking for my purposes cpuid_tool will be easier to use.
 
Yet again, feeling kinda dumb. I had no idea there was a command called "lscpu" but there it is. I'm thinking for my purposes cpuid_tool will be easier to use.
It's always good to have more than one way to check on hardware.

Could you (when you have time) post what the cpuid_tool tells you?
 
It's always good to have more than one way to check on hardware.

Could you (when you have time) post what the cpuid_tool tells you?
If you just run cpuid_tool without any options, it dumps a bunch of hex data to a temp file but with options, it parses the data and outputs a single datum per option:
Code:
tc@dolly:~$ cpuid_tool --brandstr
Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
tc@dolly:~$
tc@dolly:~$ cpuid_tool --cores
2
tc@dolly:~$
tc@dolly:~$ cpuid_tool --logical
4
tc@dolly:~$
This makes it simple to extract just the information you want.

There are a bunch more options, which I haven't fully explored:
Code:
tc@dolly:~$ cpuid_tool --help
Usage: cpuid_tool [options]

Options:
  -h, --help       - Show this help
  --load=<file>    - Load raw CPUID data from file
  --save=<file>    - Aquire raw CPUID data and write it to file
  --report, --all  - Report all decoded CPU info (w/o clock)
  --clock          - in conjunction to --report: print CPU clock as well
  --clock-rdtsc    - same as --clock, but use RDTSC for clock detection
  --cpulist        - list all known CPUs
  --quiet          - disable warnings
  --outfile=<file> - redirect all output to this file, instead of stdout
  --verbose, -v    - be extra verbose (more keys increase verbosiness level)
  --version        - print library version

Query switches (generate 1 line of ouput per switch; in order of appearance):
  --cpuid, --vendorstr, --vendorid, --brandstr, --family, --model,
  --stepping, --extfamily, --extmodel, --cores, --logical, --total-cpus,
  --l1d-cache, --l1i-cache, --cache, --l2-cache, --l3-cache, --l1d-assoc,
  --l2-assoc, --l3-assoc, --l1d-cacheline, --l2-cacheline, --l3-cacheline,
  --codename, --flags, --clock, --clock-os, --clock-rdtsc, --clock-ic,
  --rdmsr, --sse-size

If `-' is used for <file>, then stdin/stdout will be used instead of files.
When no options are present, the program behaves as if it was invoked with
  cpuid_tool "--save=raw.txt --outfile=report.txt --report --verbose"
tc@dolly:~$
 
I've noticed that, while it looks to be a little harder to extract from the output, lshw reports all of the information I want and it also gets into such goodies as the motherboard model number and revision and even the serial number.
 
If you just run cpuid_tool without any options, it dumps a bunch of hex data to a temp file but with options, it parses the data and outputs a single datum per option:
Code:
tc@dolly:~$ cpuid_tool --brandstr
Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
tc@dolly:~$
tc@dolly:~$ cpuid_tool --cores
2
tc@dolly:~$
tc@dolly:~$ cpuid_tool --logical
4
tc@dolly:~$
This makes it simple to extract just the information you want.

There are a bunch more options, which I haven't fully explored:
Code:
tc@dolly:~$ cpuid_tool --help
Usage: cpuid_tool [options]

Options:
  -h, --help       - Show this help
  --load=<file>    - Load raw CPUID data from file
  --save=<file>    - Aquire raw CPUID data and write it to file
  --report, --all  - Report all decoded CPU info (w/o clock)
  --clock          - in conjunction to --report: print CPU clock as well
  --clock-rdtsc    - same as --clock, but use RDTSC for clock detection
  --cpulist        - list all known CPUs
  --quiet          - disable warnings
  --outfile=<file> - redirect all output to this file, instead of stdout
  --verbose, -v    - be extra verbose (more keys increase verbosiness level)
  --version        - print library version

Query switches (generate 1 line of ouput per switch; in order of appearance):
  --cpuid, --vendorstr, --vendorid, --brandstr, --family, --model,
  --stepping, --extfamily, --extmodel, --cores, --logical, --total-cpus,
  --l1d-cache, --l1i-cache, --cache, --l2-cache, --l3-cache, --l1d-assoc,
  --l2-assoc, --l3-assoc, --l1d-cacheline, --l2-cacheline, --l3-cacheline,
  --codename, --flags, --clock, --clock-os, --clock-rdtsc, --clock-ic,
  --rdmsr, --sse-size

If `-' is used for <file>, then stdin/stdout will be used instead of files.
When no options are present, the program behaves as if it was invoked with
  cpuid_tool "--save=raw.txt --outfile=report.txt --report --verbose"
tc@dolly:~$
Thanks for the info Mike. I ran the cmd "cpuid_tool" via the cmd-line on my install of LM and it's not found and not installed right now.

Got appointments to keep right now. Have to check this out when more time allows.:)

Code:
~$ cpuid_tool
Command 'cpuid_tool' not found, but can be installed with:

Code:
NAME="Linux Mint"
VERSION="22.1 (Xia)"
ID=linuxmint
ID_LIKE="ubuntu debian"
PRETTY_NAME="Linux Mint 22.1"
VERSION_ID="22.1"
HOME_URL="https://www.linuxmint.com/"

Have a good weekend!
Alex
 


Follow Linux.org

Staff online

Members online


Top