Computer Architecture — Section 6.1
By the end of this lesson, you should be able to:
Main idea: We want computers to do more work in less time while using energy efficiently.
Example: Instead of one worker doing four jobs, four workers can share the work.
Key takeaway: More processors can improve performance, but the software must be designed to use them effectively.
A multiprocessor is a computer system with two or more processors.
Why use multiple processors?
Example: If a system has four processors and one fails, the remaining three may continue working, although performance could decrease.
Run different independent programs at the same time.
Example:
Each task can work independently.
Use multiple processors to work on the same program at the same time.
Example: To process a large collection of images, divide the images among several processors so that each processor handles a portion.
Remember:
A multicore microprocessor contains multiple processing cores on a single chip.
Example: A quad-core processor has four cores on one chip.
+++ Multicore Processor +———————–+ | Core 1 | Core 2 | |———|————-| | Core 3 | Core 4 | +———————–+ +++
Key takeaway: A multicore processor is one chip containing multiple cores, whereas a multiprocessor system is a broader term for a system with multiple processors.
A shared memory multiprocessor (SMP) is a parallel system in which processors share a single physical address space.
This means the processors can access the same shared memory.
+++ +——–+ +——–+ +——–+ | Core 1 | | Core 2 | | Core 3 | +—+—-+ +—+—-+ +—+—-+ \ | / +———+———+ | +———–+ | Shared | | Memory | +———–+ +++
Example: Several cores work on different parts of a program and access shared data in memory.
Important: Sharing memory makes communication easier, but programmers must prevent problems when multiple cores access or modify the same data.
A cluster is a group of separate computers connected through a network that work together as one larger computing system.
Each computer has its own processor and memory.
Example: A search engine uses many computers to process requests from users.
+++ +————+ +————+ | Computer 1 |——-| Computer 2 | +————+ +————+ | | +——– Network —+ | +————+ | Computer 3 | +————+ +++
Clusters are useful for:
SMP vs. Cluster
| SMP | Cluster |
|---|---|
| Processors share a physical address space. | Separate computers communicate over a network. |
| Often uses shared memory. | Each computer has its own memory. |
| Communication through shared memory. | Communication through messages over a network. |
These concepts are related, but they are not the same.
Concurrency means managing multiple tasks whose execution periods overlap.
Tasks can make progress by taking turns, even on a single processor.
Example: A single-core computer switches between a browser and a music player.
Parallelism means executing multiple operations at the same time.
It requires multiple processing resources to perform those operations simultaneously.
Example: Two processor cores execute two independent tasks at the same time.
Remember:
A program can be concurrent without running in parallel.
Instructions follow a defined sequence of steps.
Example: A program calculates the total price, adds tax, and then prints the result.
Multiple tasks or activities can make progress during overlapping periods.
Example: An operating system manages file downloads, keyboard input, and music playback.
Important: Sequential software can run on parallel hardware. However, simply using a multicore processor does not automatically make a sequential program faster through parallel execution.
There are two separate questions:
| Hardware | Software | Example |
|---|---|---|
| Serial | Sequential | One core runs a step-by-step calculation. |
| Serial | Concurrent | One core switches between operating system tasks. |
| Parallel | Sequential | A step-by-step program runs on a multicore computer but may not exploit multiple cores. |
| Parallel | Concurrent | Multiple operating system tasks run on a multicore computer. |
Key takeaway: Having multiple cores does not guarantee that a program will use them effectively.
Adding processors is not enough.
Programmers must write software that can divide work among processors efficiently.
Common challenges include:
Example: If four processors must wait for one processor to finish a critical task, the entire program may not become much faster.
Key takeaway: Parallel programs must be both correct and efficient.
Question 1: A computer has four cores on a single chip. What is this called?
A. Uniprocessor B. Multicore microprocessor C. Cluster D. Serial software
Answer: B — Multicore microprocessor.
Question 2: A single-core processor switches between a browser and a music player. Which concept does this demonstrate?
A. Concurrency B. Parallel execution C. Shared memory D. A cluster
Answer: A — Concurrency. The tasks can make progress over overlapping periods, but the single core does not execute both instructions simultaneously.
Question 3: Several separate computers communicate over a network to solve a large problem. What is this called?
A. SMP B. Sequential processing C. Cluster D. Single-core processing
Answer: C — Cluster.
Section 6.2: The Difficulty of Creating Parallel Processing Programs
Next, we will explore why parallel programming is difficult and why adding processors does not always produce proportional speedups.