Problems Review Sheet - Parallel Programming | CS 515, Study notes of Computer Science

Material Type: Notes; Professor: Li; Class: PARALLEL PROGRAMMING; Subject: Computer Science; University: Portland State University; Term: Unknown 1989;

Typology: Study notes

Pre 2010

Uploaded on 08/18/2009

koofers-user-98z
koofers-user-98z 🇺🇸

8 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Review Problems
Jingke Li
Portland State University
Jingke Li (Portland State University) Review Problems 1 / 9
Problem. Speedup
Consider the search tree shown below (left figure), in which the dark node
represents the solution. Assume that traversing each edge (in each
direction) counts as one step.
1. If a sequential depth-first search (DFS) is performed, how many steps
does it take to find the solution?
2. Assume that the tree is partitioned between two processors (as shown
in the right figure). If b oth processors performs a DFS on their
subtrees, how many steps does it take to find the solution now?
3. What is the speedup number? Is it a normal speedup or an anomaly?
Jingke Li (Portland State University) Review Problems 2 / 9
pf3
pf4
pf5

Partial preview of the text

Download Problems Review Sheet - Parallel Programming | CS 515 and more Study notes Computer Science in PDF only on Docsity!

Review Problems

Jingke Li

Portland State University

Jingke Li (Portland State University) Review Problems 1 / 9

Problem. Speedup

Consider the search tree shown below (left figure), in which the dark node represents the solution. Assume that traversing each edge (in each direction) counts as one step.

  1. If a sequential depth-first search (DFS) is performed, how many steps does it take to find the solution?
  2. Assume that the tree is partitioned between two processors (as shown in the right figure). If both processors performs a DFS on their subtrees, how many steps does it take to find the solution now?
  3. What is the speedup number? Is it a normal speedup or an anomaly?

Problem. Topology

Derive a formula L(k) for the number of links in a k-dimensional binary hypercube.

  1. Express the formula in a recursive form, i.e. define L(k) in terms of L(k − 1).
  2. Express the formula in a closed form, i.e. define L(k) in terms of k and constants only.
  3. According to your formula, how many links are there in a 5-dimensional hypercube?

Jingke Li (Portland State University) Review Problems 3 / 9

Problem. Dining Philosophers

Five philosophers spend their lives just thinking and eating. They sit around a circular table, but never talk to each other. There are five forks, placed evenly between the philosphers. To eat, each philosopher must pick up both forks that are placed next to him. Write a SPMD program to simulate the philosophers’ life. (Picture credit: GFDL by Bdesham)

Dining Philosophers (cont.)

Solution 3: Introduce asymmetry.

while (true) { think(); if (I am philosopher0) { pick up fork(right); if (not available) wait(); pick up fork(left); if (not available) wait(); } else { pick up fork(left); if (not available) wait(); pick up fork(right); if (not available) wait(); } eat(); put down fork(left); put down fork(right); }

Jingke Li (Portland State University) Review Problems 7 / 9

Problem. Graph Algorithm

Consider Sollin’s algorithm for finding a minimum-cost spanning tree on a connected graph.

  1. Give an example of a graph in which the algorithm requires only a single iteration to produce a MCS tree.
  2. Give an example of a graph in which the algorithm requires dlog ne iterations to produce a MCS tree.

Problem. Task Scheduling

A job for multiprocessor with P processors consists of N independent tasks of two types, long and short: L L S L S S L S S L ... S L Long tasks take TL units of processor time, and short tasks take TS. There are NL long tasks and the rest are short. P divides N evenly and m = N/P > NL. The long tasks are randomly placed among the N tasks. Assume the tasks are being statically scheduled, i.e. without knowing the actual distribution of long and short tasks.

  1. What is the worst case scenario?
  2. Show an expression for the execution time of the worst case using the given parameters. Evaluate the worst case execution time for P = 10, N = 100, NL = 5, TL = 10 ms, and TS = 1 ms.
  3. If the tasks are dynamically scheduled (with a centralized job queue), can the worst case scenario that you identified above still occur?
  4. Can you identify the (new) worst case scenario for the dynamic schedule approach? What is the execution time for this case? (Hint: What is the maximum load difference between any two processes?)