Number of processor cores confusion

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Number of processor cores confusion

Volker Wysk
Hi!

When I bought my PC a few months ago, I was told that it has 8 processor
cores. But the gnome system monitor display 16 cores. So does /proc/cpuinfo.
The inxi tool reports *both*:

desktop ~ $ inxi --cpu
CPU:
  Topology: 8-Core model: AMD Ryzen 7 2700X bits: 64 type: MT MCP
  L2 cache: 4096 KiB
  Speed: 1887 MHz min/max: 2200/3700 MHz
  Core speeds (MHz): 1: 1891 2: 1991
  3: 1896 4: 2063 5: 2058 6: 2187 7: 2046 8: 2193 9: 2190 10: 1889 11: 1888
  12: 2096 13: 1887 14: 2204 15: 2189 16: 1907

WTF?!

Cheers,
Volker

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Volker Wysk
Am Montag, den 09.11.2020, 18:28 +0100 schrieb Volker Wysk:

> Hi!
>
> When I bought my PC a few months ago, I was told that it has 8 processor
> cores. But the gnome system monitor display 16 cores. So does /proc/cpuinfo.
> The inxi tool reports *both*:
>
> desktop ~ $ inxi --cpu
> CPU:
>   Topology: 8-Core model: AMD Ryzen 7 2700X bits: 64 type: MT MCP
>   L2 cache: 4096 KiB
>   Speed: 1887 MHz min/max: 2200/3700 MHz
>   Core speeds (MHz): 1: 1891 2: 1991
>   3: 1896 4: 2063 5: 2058 6: 2187 7: 2046 8: 2193 9: 2190 10: 1889 11: 1888
>   12: 2096 13: 1887 14: 2204 15: 2189 16: 1907
It gets even more confusing. Right now, /proc/cpuinfo reports *12* cores.


Bye
Volker

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

ubuntu-users mailing list
In reply to this post by Volker Wysk
 8 cores
16 threads, probably valued as 16 cores

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Paul Smith-2
In reply to this post by Volker Wysk
On Mon, 2020-11-09 at 18:28 +0100, Volker Wysk wrote:
> desktop ~ $ inxi --cpu
> CPU:
>   Topology: 8-Core model: AMD Ryzen 7 2700X bits: 64 type: MT MCP

There's an unfortunate terminology issue.

When hardware folks talk about "cores" they mean physical cores in the
CPU.  But, each of these cores supports "hyper threading" [1] which
means that the Linux kernel treats each one as if it were two "cores"
from a scheduling etc. standpoint.

So when you look at the number of "cores" from within Linux it will
look like you have 2x your hardware cores.

I can't explain why you would see 12 cores from /proc/cpuinfo.



[1] https://en.wikipedia.org/wiki/Hyper-threading


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

ubuntu-users mailing list
In reply to this post by Volker Wysk
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Robert Heller
In reply to this post by Volker Wysk
At Mon, 09 Nov 2020 18:28:33 +0100 "Ubuntu user technical support,  not for general discussions" <[hidden email]> wrote:

>
> Hi!
>
> When I bought my PC a few months ago, I was told that it has 8 processor
> cores. But the gnome system monitor display 16 cores. So does /proc/cpuinfo.
> The inxi tool reports *both*:
>
> desktop ~ $ inxi --cpu
> CPU:
>   Topology: 8-Core model: AMD Ryzen 7 2700X bits: 64 type: MT MCP
>   L2 cache: 4096 KiB
>   Speed: 1887 MHz min/max: 2200/3700 MHz
>   Core speeds (MHz): 1: 1891 2: 1991
>   3: 1896 4: 2063 5: 2058 6: 2187 7: 2046 8: 2193 9: 2190 10: 1889 11: 1888
>   12: 2096 13: 1887 14: 2204 15: 2189 16: 1907
>
> WTF?!

Intel developed a "hack" where one "core" had some parts of the core elements
duplicated, allowing a level of multiprocessing. These are "multi-threaded
cores". Linux shows these cores as two cores (each). I did not know that AMD
also implemented this hack. It is a bit of a hack, since the multi-threading
does not allow for full SMP.

>
> Cheers,
> Volker
>

--
Robert Heller             -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
[hidden email]       -- Webhosting Services
                                                             

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

ubuntu-users mailing list
In reply to this post by Paul Smith-2
On Mon, 09 Nov 2020 12:51:37 -0500, Paul Smith wrote:

>On Mon, 2020-11-09 at 18:28 +0100, Volker Wysk wrote:
>> desktop ~ $ inxi --cpu
>> CPU:
>>   Topology: 8-Core model: AMD Ryzen 7 2700X bits: 64 type: MT MCP  
>
>There's an unfortunate terminology issue.
>
>When hardware folks talk about "cores" they mean physical cores in the
>CPU.  But, each of these cores supports "hyper threading" [1] which
>means that the Linux kernel treats each one as if it were two "cores"
>from a scheduling etc. standpoint.
>
>So when you look at the number of "cores" from within Linux it will
>look like you have 2x your hardware cores.

I often read that this can be disabled by the BIOS, at least for Intel
machines. Hyper-threading seems to be the cause of issues, if real-time
abilities are needed.

$ lscpu | head
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   39 bits physical, 48 bits virtual
CPU(s):                          2
On-line CPU(s) list:             0,1
Thread(s) per core:              1
Core(s) per socket:              2
Socket(s):                       1
NUMA node(s):                    1

The OP's processor should have the value 2 for "Thread(s) per core" and
8 for "Core(s) per socket", but 16 for "CPU(s)".

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Liam Proven
In reply to this post by Robert Heller
On Mon, 9 Nov 2020 at 19:06, Robert Heller <[hidden email]> wrote:
>
> Intel developed a "hack" where one "core" had some parts of the core elements
> duplicated, allowing a level of multiprocessing.

That's a bit harsh.

• It's not just Intel -- quite a few big RISC chips do this too, for example
• It's called simultaneous multithreading:
https://en.wikipedia.org/wiki/Simultaneous_multithreading
• "Hyper-threading" is just Intel's brand name
• It's a consequence of superscalar CPU design; parts of the CPU are
replicated multiple times and in some situations it can literally do
more than one thing at a time. The chip exposes this to software by
offering more threads of execution than there are actual cores.
• Nothing says that there have to be 2 threads per core. Sun's
UltraSPARC T-series offer up to 16 threads per core

>  Linux shows these cores as two cores (each).

The chip tells whatever OS it's running that it has _n_ cores, where
_n_ is the number of threads it can support. Linux has no say in the
matter. Usually you can turn SMT on or off in the firmware, though.

> I did not know that AMD
> also implemented this hack.

I think it's fairly new but not brand new.

> It is a bit of a hack, since the multi-threading
> does not allow for full SMP.

Depends on the task. For some things it can be a bit faster, for some
a bit slower. It tends to slightly improve system responsiveness but
that's very hard to benchmark.

And most benchmarking experts lost their jobs when all the magazines
went under, replaced by clueless kids behind websites.

--
Liam Proven – Profile: https://about.me/liamproven
Email: [hidden email] – gMail/gTalk/gHangouts: [hidden email]
Twitter/Facebook/LinkedIn/Flickr: lproven – Skype: liamproven
UK: +44 7939-087884 – ČR (+ WhatsApp/Telegram/Signal): +420 702 829 053

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Karl Auer
In reply to this post by Volker Wysk
On Mon, 2020-11-09 at 18:28 +0100, Volker Wysk wrote:
> When I bought my PC a few months ago, I was told that it has 8
> processor cores. But the gnome system monitor display 16 cores. So
> does /proc/cpuinfo.

It has 8 cores, but each core can run two threads. The OS is told it
has 16 cores, because it needs to be able to distribute tasks across
those cores. If it needs to find out the truth, it can.

See this to see the situation stated clearly:

   https://www.amd.com/en/products/cpu/amd-ryzen-7-5800x

See this for a good explanation of what's going on:

https://www.howtogeek.com/194756/cpu-basics-multiple-cpus-cores-and-hyper-threading-explained/

In summary, you can run 8 things genuinely in parallel on your 8 cores.
But each core can run two things not-really-in-parallel-but-they-think-
they-are by timeslicing between the threads on the core.

The total number of available cycles is the same for one, two or twenty
threads on the same core. By threading, the core can ensure that more
of those cycles are spent doing actual work, while one or the other
thread is waiting on something - disk, RAM, a keypress or whatever. So
threading gives you a performance boost for many workloads.

Regards, K.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer ([hidden email])
http://www.biplane.com.au/kauer

GPG fingerprint: 2561 E9EC D868 E73C 8AF1 49CF EE50 4B1D CCA1 5170
Old fingerprint: 8D08 9CAA 649A AFEF E862 062A 2E97 42D4 A2A0 616D




--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Volker Wysk
In reply to this post by Volker Wysk
Hi!

Your answers made me wiser. So I have one socket, with 8 cores and two
threads per core.

This means there are 16 actors working for me. (Even though they might not
be full replacements für real cores). Not bad. I thought I still had 8. :-)

Thanks for the explanations.

Volker


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Chris Green
On Tue, Nov 10, 2020 at 02:59:25PM +0100, Volker Wysk wrote:
> Hi!
>
> Your answers made me wiser. So I have one socket, with 8 cores and two
> threads per core.
>
> This means there are 16 actors working for me. (Even though they might not
> be full replacements für real cores). Not bad. I thought I still had 8. :-)
>
However, in reality, *very few* things running on your computer ever
use more than one thread/core.  Almost all of the time only one is
being used.

I have only seen a couple of rather specialised bits of code that
manage to use more than one core, one of them was the password security
checking program crack_known_hosts.py, I think I also noticed a static
web site generating program doing it too.

It's difficult to write multi-threaded code so most people don't, the
only (moderately) easy candidates for it are things which do intensive
processor bound things without any I/O (like the above password
cracking and/or image processing programs).  Anything that uses system
libraries and I/O is almost inevitably single threaded.


--
Chris Green

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Karl Auer
On Tue, 2020-11-10 at 14:20 +0000, Chris Green wrote:
> However, in reality, *very few* things running on your computer ever
> use more than one thread/core.  Almost all of the time only one is
> being used.

?!? My computer is using all its cores, all the time. And when I say
cores I really mean cores AND threads :-)

Run gnome-system-monitor to see what's going on.

Software threads are not the same as the threads on CPUs. Same name,
similar functions, but very different things operating at very VERY
different levels.

Regards K.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer ([hidden email])
http://www.biplane.com.au/kauer

GPG fingerprint: 2561 E9EC D868 E73C 8AF1 49CF EE50 4B1D CCA1 5170
Old fingerprint: 8D08 9CAA 649A AFEF E862 062A 2E97 42D4 A2A0 616D




--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Liam Proven
In reply to this post by Chris Green
On Tue, 10 Nov 2020 at 15:22, Chris Green <[hidden email]> wrote:

> However, in reality, *very few* things running on your computer ever
> use more than one thread/core.  Almost all of the time only one is
> being used.

Largely true.

To understand why...
Many decades ago, IBM threw one of their best managers, Fred Brooks,
and a ton of extra programmers at a large mainframe OS project that
was running late. In vain he protested that more engineers did not
help and indeed made the problem worse. In the end he wrote a famous
book about it, called _the Mythical Man-Month_.

To understand why most code is single-threaded, you have to read it.
Better still, buy 2 copies so you can read it in half the time!

> I have only seen a couple of rather specialised bits of code that
> manage to use more than one core, one of them was the password security
> checking program crack_known_hosts.py,

Encoding audio & video data works well. Different cores can work  on
different chunks of sound or video, because the results of each block
do not affect the other blocks. You could divide a movie into quarters
and encode #3 then #2 then #4 then #1 and the end result is identical.

Try sorting a list of names into alphabetical order in quarters and it
won't work, though.

> I think I also noticed a static
> web site generating program doing it too.

Seems less likely, but OK.

It is often _possible_ to do but doesn't help. E.g. if you sort a list
into order in 4 chunks, sure, it's 4× as fast. But you end up with 4
sorted lists and then must combine them, and that last step takes  as
long as just sorting the big list. Even if you combine pairs of lists
into 2 lists, then combine  too -- you spend more time combining than
sorting.

*But* if perhaps your computer stays much more responsive as it works,
and the whole unsorted list (read "database") remains usable as the
chunks are being sorted in the background and only gets locked for a
fraction of a second at the end... it might be worth a slower
algorithm.

This was the bet made when Be wrote BeOS. Everything possible is
multithreaded, as the original BeBox computer was the first
mass-market end-user multiprocessor computer. Some things -- OK, a lot
of things -- might be no quicker, or not noticeably quicker on 2 CPUs
but suddenly work much better if you have 8 or 16 -- but the company
bet that in future most PCs would be multi-processor.

They were absolutely right but didn't survive long enough to benefit.

Haiku is the FOSS continuation but it's a lot bigger and slower.

Unix took the other approach. The core design is from the 1960s when
computers had just tens of KB of memory and a few meg of disk, but
were shared by dozens of users on dumb serial text terminals. So
everything is text, everything is centred on the hard disk, programs
are small and you chain them together with pipes.

*None* of these assumptions are true any more but it achieved critical mass.

When PCs got multiple CPUs, the programmers went through trying to
divide up the tasks in the kernel so that some bits could run
side-by-side, marking the dangerous bits that must not with
mutual-exclusion signals -- MUTEXes. Originally there was one big one
that locked the whole kernel; this was removed in Linux 2.2 if I
remember correctly.

Similarly, Firefox painfully was broken into 2 then 4 communicating
processes. Google took the brute-force approach with Chrome: each tab
is a process, communicating with a front-end that draws the window
frame. Faster but this approach eats RAM and will use all your CPU
cores if it can.

But yes, you're absolutely right, most user programs don't, at all.
It's too hard for too little gain. Languages like C and to a slightly
lesser extent C++ are very bad at this, and in *nix, _everything_ is
implemented in C or C++.

> It's difficult to write multi-threaded code so most people don't, the
> only (moderately) easy candidates for it are things which do intensive
> processor bound things without any I/O (like the above password
> cracking and/or image processing programs).  Anything that uses system
> libraries and I/O is almost inevitably single threaded.

I'd slightly dispute that. I/O is limiting, sure, but these days you
can read gigs of (say) movie data into RAM off a single disk, work on
it, compress it, re-encode it and only write it back later. Many
system libraries and the kernel itself are re-entrant. It's getting
better but only very slowly.

--
Liam Proven – Profile: https://about.me/liamproven
Email: [hidden email] – gMail/gTalk/gHangouts: [hidden email]
Twitter/Facebook/LinkedIn/Flickr: lproven – Skype: liamproven
UK: +44 7939-087884 – ČR (+ WhatsApp/Telegram/Signal): +420 702 829 053

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

ubuntu-users mailing list
too long, didn't read

On Tue, 10 Nov 2020 15:58:06 +0100, Liam Proven wrote:
>Encoding audio & video data works well. Different cores can work  on
>different chunks of sound or video, because the results of each block
>do not affect the other blocks. You could divide a movie into quarters
>and encode #3 then #2 then #4 then #1 and the end result is identical.

You even can assign a core to a task, however, multi-threading is known
to cause issues for real-time audio. You still can disable
multi-threading and assign cores to tasks. To me it's just hearsay, my
CPU is just an aged dual-core, without multi-threading, but I tested
the following.

Regarding video codecs an approach is to enable video acceleration
instead of using software decoding. It's more or less unsupported (no
Linux browser does provide it, even not when using special add-ons),
but the few times it is supported (at least one media player does), it
makes a very big difference regarding usage of resources.

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Chris Green
In reply to this post by Karl Auer
On Wed, Nov 11, 2020 at 01:40:39AM +1100, Karl Auer wrote:

> On Tue, 2020-11-10 at 14:20 +0000, Chris Green wrote:
> > However, in reality, *very few* things running on your computer ever
> > use more than one thread/core.  Almost all of the time only one is
> > being used.
>
> ?!? My computer is using all its cores, all the time. And when I say
> cores I really mean cores AND threads :-)
>
> Run gnome-system-monitor to see what's going on.
>
Well top and gnome-system-monitor don't agree!  :-)


> Software threads are not the same as the threads on CPUs. Same name,
> similar functions, but very different things operating at very VERY
> different levels.
>
But unless software is written so that it *can* use multiple cores
then it doesn't.

Looking at gnome-system-monitor I can't really see how what is says
can be true, what sorts of things can *really* happen in parallel
without all sorts of problems?

--
Chris Green

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

[OT] Re: Number of processor cores confusion

Volker Wysk
In reply to this post by Liam Proven
Am Dienstag, den 10.11.2020, 15:58 +0100 schrieb Liam Proven:

> When PCs got multiple CPUs, the programmers went through trying to
> divide up the tasks in the kernel so that some bits could run
> side-by-side, marking the dangerous bits that must not with
> mutual-exclusion signals -- MUTEXes. Originally there was one big one
> that locked the whole kernel; this was removed in Linux 2.2 if I
> remember correctly.
>
> Similarly, Firefox painfully was broken into 2 then 4 communicating
> processes. Google took the brute-force approach with Chrome: each tab
> is a process, communicating with a front-end that draws the window
> frame. Faster but this approach eats RAM and will use all your CPU
> cores if it can.
>
> But yes, you're absolutely right, most user programs don't, at all.
> It's too hard for too little gain. Languages like C and to a slightly
> lesser extent C++ are very bad at this, and in *nix, _everything_ is
> implemented in C or C++.
As an aside: In Mercury, all that is needed is to replace the conjunction
(",") operator with the parallel conjunction operator ("&"), at the right
places. It isn't suitable for beginners, but it's well worth learning.  :-)

(Mercury is an advanced logic-functional language.)

Goodbye,
Volker

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Colin Law
In reply to this post by Chris Green
On Tue, 10 Nov 2020 at 16:14, Chris Green <[hidden email]> wrote:
> ..
> Looking at gnome-system-monitor I can't really see how what is says
> can be true, what sorts of things can *really* happen in parallel
> without all sorts of problems?

Remember your foreground application is only one thing that is going
on in the computer.  There are all sorts of background activities
going on all the time which will run in parallel to your foreground
app.  For example network activity, flushing disc buffers to disc,
time sync, memory management, downloading system updates.  If you have
browser pages open they often have background processes running and if
at the same time you run a spreadsheet the browser processes keep
going.  All of those will run in separate cores.

Can you post an example of something in system monitor that you don't believe?

Colin

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Chris Green
On Tue, Nov 10, 2020 at 04:40:43PM +0000, Colin Law wrote:

> On Tue, 10 Nov 2020 at 16:14, Chris Green <[hidden email]> wrote:
> > ..
> > Looking at gnome-system-monitor I can't really see how what is says
> > can be true, what sorts of things can *really* happen in parallel
> > without all sorts of problems?
>
> Remember your foreground application is only one thing that is going
> on in the computer.  There are all sorts of background activities
> going on all the time which will run in parallel to your foreground
> app.  For example network activity, flushing disc buffers to disc,
> time sync, memory management, downloading system updates.  If you have
> browser pages open they often have background processes running and if
> at the same time you run a spreadsheet the browser processes keep
> going.  All of those will run in separate cores.
>
THey can't, or at least a lot of them can't, they suffer from the same
issues as trying to multithread a single program.  Network activity
for example has to wait for something else to provide it with data (or
something to take data).  Memory management can't just come along and
move stuff about in memory while the kernel is doing something else.

As pointed out by someone else here there are ways of doing it with
flags, semaphores, etc. but mostly this isn't implemented yet.


> Can you post an example of something in system monitor that you don't believe?
>
There's not enough detail shown to really know what it's saying and
thus it's difficult/impossible to say "XYZ isn't right".

--
Chris Green

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Gene Heskett-2
In reply to this post by Chris Green

On Tuesday 10 November 2020 09:20:15 Chris Green wrote:

> On Tue, Nov 10, 2020 at 02:59:25PM +0100, Volker Wysk wrote:

> > Hi!

> >

> > Your answers made me wiser. So I have one socket, with 8 cores and

> > two threads per core.

> >

> > This means there are 16 actors working for me. (Even though they

> > might not be full replacements für real cores). Not bad. I thought I

> > still had 8. :-)

>

> However, in reality, *very few* things running on your computer ever

> use more than one thread/core. Almost all of the time only one is

> being used.

>

> I have only seen a couple of rather specialised bits of code that

> manage to use more than one core, one of them was the password

> security checking program crack_known_hosts.py, I think I also noticed

> a static web site generating program doing it too.

>

> It's difficult to write multi-threaded code so most people don't, the

> only (moderately) easy candidates for it are things which do intensive

> processor bound things without any I/O (like the above password

> cracking and/or image processing programs). Anything that uses system

> libraries and I/O is almost inevitably single threaded.

There are of coarse exceptions.

I might point out that some of the industrial programs do use multiple threads. Free LinuxCNC for instance can use at least 2 and perhaps 3 threads. If not using smart cards for realtime i/o to run machinery demanding steady trigger signals because stepper motors are adversely affected by timing jitter, you run at 30 microsecond loop for the realtime stuff, and a 1 millisecond loop to update the servo status, with floating point only in the slower loop.

On an rpi4 with smart card i/o, some of the interface stuff is running in a 200hz loop because that's plenty fast enough for human input. I suspect the faster base-thread could also be used on the pi's but the i/o to use it isn't there. Not having a pci-like buss, the pi talks to the smart card with a 4 byte serial data stream over three pins of gpio, called an SPI bus sending at 40 megabaud, and receiving the answers from the card at 25 megabaud. And its bulletproof. Best described as Just Works.

It is running an 80 yo 11x56" Sheldon metal lathe, including motion compensation for 80 years of bed wear. Weighs arounf 1500 lbs. And now does things much fasrer that it could not even do when new, with a simpler mechanical setup using precision ball nuts and screws.

And the only coupling between the spindle and the rest of it is electronic, there no gears on the back of the headstock, its all synchronized by a shop made encoder watching the 60 tooth gear in the headstock. Thats 240 edges per turn of the spindle, so LinuxCNC knows within 1.5 degrees where the spindle is. Cutting threads is all math in the rpi4, metric or 'merican. Why use a pi? I wanted to see if I could.

I have 3 other machines but they are all run by wintel boxes running linux. 4 or more axis milling machines.

> Chris Green

Your trivia fact for the day. Take care everybody.

Cheers, Gene Heskett

--

"There are four boxes to be used in defense of liberty:

soap, ballot, jury, and ammo. Please use in that order."

-Ed Howdershelt (Author)

If we desire respect for the law, we must first make the law respectable.

- Louis D. Brandeis

Genes Web page <http://geneslinuxbox.net:6309/gene>


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Number of processor cores confusion

Colin Law
In reply to this post by Chris Green
On Tue, 10 Nov 2020 at 17:20, Chris Green <[hidden email]> wrote:
> ...
> THey can't, or at least a lot of them can't, they suffer from the same
> issues as trying to multithread a single program.  Network activity
> for example has to wait for something else to provide it with data (or
> something to take data).  Memory management can't just come along and
> move stuff about in memory while the kernel is doing something else.

While the your foreground video application is decoding the next
screen of a video a network request to access the mysql server on your
machine, or the response to a time sync request may arrive, or an
attempted login from a hacker, or you might plug in a usb stick which
needs to be mounted or any number of other things.

Colin

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users