Docsity

Parallel Programming: Understanding Parallel Architecture, Caches, and Virtual Memory, Lecture notes of Mathematics

Partial preview of the text

Download Parallel Programming: Understanding Parallel Architecture, Caches, and Virtual Memory and more Lecture notes Mathematics in PDF only on Docsity!

Parallel Programming

Review on Computer Hardware and Operating Systems Slides adapted from the lecture notes by Peter Pacheco

Roadmap

  • Some background
  • Modifications to the von Neumann model
  • Computer hardware and OS review

Serial hardware and software

input output programs Computer runs one program at a time.

The von Neumann Architecture

Central processing unit (CPU)

Two components:

  • Control unit - responsible for deciding which instruction in a program should be executed. ( the boss )
  • Arithmetic and logic unit (ALU) - responsible for executing the actual instructions. ( the worker )

Key terms

  • Register – very fast storage, part of the CPU.
  • Program counter – stores address of the next instruction to be executed.
  • Bus – wires that connect the CPU and memory.

memory CPU write/store

von Neumann bottleneck

The separation of memory and CPU

  • The limited storage capacity of the CPU means that large amounts of data and instructions must be transferred from the memory
  • The interconnect determines the rate at which instructions and data can be accessed
  • The CPU can execute instructions orders of magnitude faster than memory access

Multitasking

  • Gives the illusion that a single processor system is running multiple programs simultaneously.
  • Each process takes turns running. ( time slice )
  • After its time is up, it waits until it has a turn again. ( blocks )

Threading

  • Threads are contained within processes.
  • They allow programmers to divide their programs into (more or less) independent tasks.
  • The hope is that when one thread blocks because it is waiting on a resource, another will have work to do and can run.

MODIFICATIONS TO THE VON

NEUMANN MODEL

Caches

  • A collection of memory locations that can be accessed in less time than some other memory locations.
  • A CPU cache is typically located on the same chip, or one that can be accessed much faster than ordinary memory.

Example of locality

float z[1000]; … sum = 0.0; for (i = 0; i < 1000; i++) sum += z[i];

Levels of Cache

L L L smallest & fastest largest & slowest