one way of making a computer quicker is increasing the speed of the CPU there is a limit as to how much we can do this by and we think we are soon going to reach it another way of speeding up her computer is by having more processes working at the same time when we have more than one processor on the same chip we call these processes cores so a processor with two cores is a dual-core processor and a processor with 4 cores is a quad-core processor you may notice some processors with three cores in them
these are often quad-core processors with one of their cores disabled when we have a multi-core processor if we have multiple pieces of software different cores can handle different programs it is also possible for several cores to work on the same program we call this parallel processing for example let us look at trying to find the total of an array of 1000 numbers in a single core processor the algorithm would look like this when we run this program the full loop has to run 1000 times for us to get our total buts how about if we
use 2 cores to solve the same problem this time we could use an algorithm like this this time one core runs a for-loop 500 times throughout the first half of the array and the same time is just doing this core 2 runs a for loop by the second part of the array this means we can complete the task in almost half the time the more cores we have the quicker we can run the program so with 4 cores we can run a nearly a quarter of the time 8 cores in an eighth and so on
an algorithm like this is the best-case scenario not all algorithms can have their work divided so easily by an algorithm requires the outcome of a previous step before it can move on to the next step adding extra cores will not give you any benefits let's take an example of calculating the fibonacci sequence in the fibonacci sequence we get a term by adding the two terms before it so if we start off with 0 and 1 the next term will be 0 plus 1 which is 1 the next term is 1 plus 1 so 2 followed
by 1 plus 2 which is 3 and so on a program to print the first 100 terms of the Fibonacci sequence would look something like this each term in the sequence needs to know the terms before there is no benefit from sharing it among several cause in reality most problems tend to have some parts of benefit from parallel processing and somewhat domes having more cores and a processor can make a computer run faster but having to pause will never be as fast as one core running at twice the speed you in this video we have
learned when we have more than one processor on the same chip we call them cause dual core process have two cores and quad core processes have four cores multi-core processors can improve the performance when running several programs at the same time some programs can have more than one core working on them at the same time the increase in speed depends on the type of problem