Introduction to Multiprocessors

Computer Architecture — Section 6.1

Babafemi Sorinolu

Learning Objectives

By the end of this lesson, you should be able to:

  • Explain what a multiprocessor is and why we use it.
  • Distinguish between task-level parallelism and parallel processing.
  • Explain multicore processors, shared memory, and clusters.
  • Distinguish between concurrency and parallelism.

1. Why Do We Need Multiple Processors?

Main idea: We want computers to do more work in less time while using energy efficiently.

  • Increasing processor clock speeds uses more power and produces more heat.
  • Adding more processors can improve performance.
  • Multiple processors can handle different tasks at the same time.
  • Smaller, energy-efficient processors can provide better performance per unit of energy.

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.

2. What Is a Multiprocessor?

A multiprocessor is a computer system with two or more processors.

  • Uniprocessor: A system with one processor.
  • Multiprocessor: A system with multiple processors.

Why use multiple processors?

  • Higher performance
  • Better energy efficiency
  • Ability to handle more tasks
  • Potentially better availability if one processor fails

Example: If a system has four processors and one fails, the remaining three may continue working, although performance could decrease.

3. Two Ways to Use Multiple Processors

A. Task-Level Parallelism

Run different independent programs at the same time.

Example:

  • Processor 1: Runs a web browser.
  • Processor 2: Plays music.
  • Processor 3: Downloads a file.
  • Processor 4: Runs a spreadsheet.

Each task can work independently.

B. Parallel Processing

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:

  • Task-level parallelism = different tasks run simultaneously.
  • Parallel processing = multiple processors cooperate on one program.

4. What Is a Multicore Processor?

A multicore microprocessor contains multiple processing cores on a single chip.

  • A core is an individual processing unit.
  • Multiple cores can execute different tasks or cooperate on a single program.
  • Most modern desktop and server processors have multiple cores.

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.

5. Shared Memory Multiprocessors (SMP)

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.

6. What Is a Cluster?

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:

  • Web servers
  • Search engines
  • Scientific computing
  • Email systems
  • Large databases

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.

7. Concurrency vs. Parallelism

These concepts are related, but they are not the same.

Concurrency

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

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:

  • Concurrency = tasks are in progress during overlapping periods.
  • Parallelism = tasks execute simultaneously.

A program can be concurrent without running in parallel.

8. Sequential vs. Concurrent Software

Sequential Software

Instructions follow a defined sequence of steps.

Example: A program calculates the total price, adds tax, and then prints the result.

Concurrent Software

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.

9. Hardware and Software Are Different

There are two separate questions:

  1. Hardware: Can the computer execute multiple operations simultaneously?
  2. Software: Is the program organized to allow multiple tasks or operations to make progress?
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.

10. The Biggest Challenge: Writing Parallel Programs

Adding processors is not enough.

Programmers must write software that can divide work among processors efficiently.

Common challenges include:

  • Dependencies: Some operations must finish before others can begin.
  • Communication: Processors may need to exchange information.
  • Synchronization: Processors must coordinate when accessing shared resources.
  • Uneven workload: Some processors may finish earlier than others.
  • Overhead: Dividing and coordinating work also takes time.

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.

11. Check Your Understanding

  • What is the difference between a uniprocessor and a multiprocessor?
  • What is the difference between task-level parallelism and parallel processing?
  • What does a core represent?
  • How does an SMP differ from a cluster?
  • Can a program be concurrent without running in parallel?
  • Why does adding more cores not always make a program faster?

12. Quick Quiz

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.

13. Final Takeaways

  • Multiple processors can improve performance, energy efficiency, and availability.
  • Task-level parallelism runs independent programs at the same time.
  • Parallel processing uses multiple processors to execute one program.
  • Multicore processors place multiple cores on one chip.
  • SMP systems share a physical address space; clusters connect separate computers through a network.
  • Concurrency is about overlapping task progress; parallelism is about simultaneous execution.
  • The mosts important lesson: Hardware provides the opportunity for parallelism, but software must be designed to take advantage of it.

Next Section

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.