OCR H446, section 1.1.2 (c)
Multicore processors
A core is a complete processing unit that can run its own stream of instructions. A multicore processor has two or more cores on one chip, usually sharing some cache and the connection to main memory.
- Each core can work on a different task at the same time (a dual-core processor has 2 cores, quad-core has 4, and so on).
- It lets the processor run several programs at once, or split one program across several cores.
- It gives more performance without simply making the clock faster, which would produce too much heat (see 1.1.1 (c)).
Parallel processing
Parallel processing means splitting a problem into parts that are carried out at the same time on more than one processor or core, instead of one step after another (serial processing).
If a task splits perfectly into 4 equal parts and the work is shared over 4 cores, it takes about a quarter of the time.
Types of parallel system
| Type | Description | Example |
|---|---|---|
| Multicore | Several cores on a single chip | A phone or laptop processor |
| Multiprocessor | Several separate processors in a single computer, sharing memory | A powerful server |
| Cluster or distributed system | Many separate computers connected by a network, working on one problem | A supercomputer, or a data centre |
| GPU (see 1.1.2 (b)) | Thousands of simple cores for data-parallel work | Graphics, machine learning |
SIMD and MIMD
Parallel systems are often described by how they work:
- SIMD (single instruction, multiple data): one instruction is applied to many data items at once. This is how a GPU works, and is used for processing images or matrices.
- MIMD (multiple instruction, multiple data): several processors each run their own instructions on their own data. This is how a multicore CPU or a cluster works.
Benefits of parallel systems
- Faster completion of tasks that can be split up.
- Can run many programs at the same time smoothly (multitasking).
- Can tackle very large problems (weather forecasting, simulations, big data) that one processor couldn't do in a reasonable time.
- If one core in a cluster fails, others may carry on, giving some resilience.
Limits and problems
- Not every task can be split up. Some steps must be done in order, because one needs the result of the previous. This serial part limits the overall speed-up, however many cores there are. If 20% of a task must run serially, the speed-up can never be more than 5 times, even with a thousand cores.
- Software must be written to use the extra cores, which is more difficult than writing a serial program.
- Overheads: the parts must be divided, coordinated and the results combined, which takes time.
- Shared resources: if two cores update the same data, they can interfere (a race condition), so access must be controlled. Cores can end up waiting for each other (deadlock).
- Cost, power and heat go up with more cores.
- More cores don't always mean proportionally more speed.
Worked example
Task: a program takes 100 seconds on one core. 90 seconds of this can be split evenly among any number of cores, and 10 seconds must run serially. How long does it take on 4 cores, and what is the best that is possible?
- The parallel part on 4 cores: seconds.
- The serial part: 10 seconds.
- Total: seconds, a speed-up of times (not 4).
- With unlimited cores, the parallel part shrinks towards 0, but the serial 10 seconds remains, so the time can never go below 10 seconds (a speed-up of at most 10 times).
Exam tip: don't say that more cores always means faster. Give the benefit (tasks run at the same time) and the limits (parts that must run in order, software that has to be written for it, and the cost of coordinating the cores).
Check yourself
What is a multicore processor?
A single processor chip containing two or more cores, each able to carry out instructions at the same time.
What is the difference between serial and parallel processing?
Serial processing does the steps one after another. Parallel processing splits the task into parts that are carried out at the same time on more than one core or processor.
Why does doubling the number of cores not always double the speed?
Some parts of the task must be done in order, the software may not be able to use the extra cores, and time is lost coordinating the cores and combining results.
What do SIMD and MIMD mean?
SIMD is single instruction, multiple data: one instruction applied to many data items at once. MIMD is multiple instruction, multiple data: several processors each run their own instructions on their own data.