To get the benefits of multicore you need to understand two things: CPU
architectures and the kernel scheduler.
Current CPU architecture is actually thousands of unique processing units,
each one specialized to a different task. There are APUs inside a single
core which make it turing complete and a proper processor, but there are
unique units for processing string types, stream data (video), and tons for
basic mathematic operations. The processor understands where to put all
this stuff based on what assembler opcode is used and all that's determined
by the compiler (which is why using Intel C Compiler over Gnu C Compiler
often yields faster running programs, because it uses all those nifty
opcode functions better). This is why hyperthreading is such a cool
technology. When you're doing something that taxes all the string-oriented
processing units, the processor can still be available for regular algebra
and general computing--which is why each core appears as two cpus when you
look at the readout--there's the main calculation thread core and the
off-calculation core thread.
When we tack on an additional core, some nifty things get
added-specifically a thing called cache coherence. The idea is that the
second core understands what the first core is working on, and will look at
the same memory location and try to guess what the next calculation will be
if the second core is idle. So, having multiple cores can increase single
thread execution when the extra cores are idle.
Lastly, the kernel scheduler makes a big difference as to how things get
sent to the CPU. The scheduler determines what gets CPU time. There are 4
main schedules in use in the wild within Linux, and there names are
LinuxThreads (oldest), O(1) scheduler, O(log(N)) or Completely Fair
Scheduler, and the BFS (Brain F*** scheduler) which is used on mobile
devices.
LinuxThreads says that each process gets its own core after the first one
is taxed. LinuxThreads is the main reason why we compile with a make -j
(core count *2)+1. This ensures every core and hyperthread avenue will be
available to the compiler. O(1) is much more elegant in design, in that it
was designed and not just put in place because Linux needed a scheduler.
O(1) biases for programs that are sleeping for a long time and actually
monitors and learns a processes behavior, then assigns out the total CPUs
in 1/250 of a second increments. In O(1), you could make with a single
thread and it'd be faster than just using one core, but it'd probably be
best to do make -j (core count + 1). O(log(N)) or Completely Fair is a
bit different. It just looks at all the processes needing time on the CPU
and balances out by whichever one has spent the least amount of time on the
core. In Completely Fair, just doing a make and a make -j could actually
end at the same time, but I'd say go with make -j (core count -1) for
fastest compilation time. You shouldn't compile in BFS.
Nothing makes up for a well programmed multi-threaded application, but
there's a lot of hacks going on in the background that makes multiple cores
useful for any task.
On Sun, Jan 31, 2016 at 1:37 PM, Stephen Partington <
cryptworks@gmail.com>
wrote:
> Correct
> On Jan 31, 2016 1:36 PM, "Michael" <bmike1@gmail.com> wrote:
>
>> I was thinking about when I do linux from scratch you need to enter a
>> special flag to utilize both processors during a build.
>>
>> On Sun, Jan 31, 2016 at 3:30 PM, Stephen Partington <cryptworks@gmail.com
>> > wrote:
>>
>>> The main purpose to allow multiple processes to run at the same time. So
>>> more can be done in a given amount of time.
>>> On Jan 31, 2016 1:28 PM, "Michael" <bmike1@gmail.com> wrote:
>>>
>>>> I was wondering what the purpose of a multi cored computer is. The way
>>>> I understand it is that multi cores operate on different threads. Doesn't
>>>> that mean that the a multi cored computer only uses one of it's cores
>>>> or.... I don't even have enough knowledge about this to ask an intelligent
>>>> question!
>>>>
>>>> --
>>>> :-)~MIKE~(-:
>>>>
>>>> ---------------------------------------------------
>>>> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
>>>> To subscribe, unsubscribe, or to change your mail settings:
>>>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>>>>
>>>
>>> ---------------------------------------------------
>>> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
>>> To subscribe, unsubscribe, or to change your mail settings:
>>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>>>
>>
>>
>>
>> --
>> :-)~MIKE~(-:
>>
>> ---------------------------------------------------
>> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>>
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
--
Todd Millecam
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss