This session has real calculations in it, and they are the kind the exam asks you to do. Three definitions, one formula, and one situation where the formula does not apply.
Do them on paper. There is a C# program at the end you may use to check yourself, but the exam gives you a table and a pencil.
'F' → Fullscreen
Both tasks on paper. The program after them is optional, and it is a checker, not a shortcut.
Three sets of independent tasks. Each processor runs one task at a time. Give speedup to two decimal places.
Part A: as many processors as tasks.
| Set | Task times (seconds) | Sequential | Parallel | Speedup |
|---|---|---|---|---|
| A | 30, 40, 50 | |||
| B | 20, 30, 40, 50 | |||
| C | 10, 20, 90 |
Part B: the same three sets, only TWO processors.
| Set | Task times | Best split | Parallel | Speedup |
|---|---|---|---|---|
| A | 30, 40, 50 | |||
| B | 20, 30, 40, 50 | |||
| C | 10, 20, 90 |
Set B with two processors and then three is the most important pair of calculations on this page.
A job has a 50-second part that cannot be split, then three independent tasks of 50s, 40s and 40s.
assignment array to find a worse split.int[] tasks = { 20, 30, 40, 50 };int processors = 2;
// Which processor runs each task: tasks 0 and 3 on// processor 0, tasks 1 and 2 on processor 1.int[] assignment = { 0, 1, 1, 0 };
double sequential = 0;for (int i = 0; i < tasks.Length; i++){ sequential = sequential + tasks[i];}
int[] loads = new int[processors];for (int i = 0; i < tasks.Length; i++){ int p = assignment[i]; loads[p] = loads[p] + tasks[i];}
int parallel = 0;for (int p = 0; p < processors; p++){ Console.WriteLine($"processor {p}: {loads[p]}s"); if (loads[p] > parallel) { parallel = loads[p]; }}
double speedup = sequential / parallel;Console.WriteLine($"sequential: {sequential}s");Console.WriteLine($"parallel: {parallel}s");Console.WriteLine($"speedup: {speedup:F2}");processor 0: 70sprocessor 1: 70ssequential: 140sparallel: 70sspeedup: 2.00This is a checker, not a method. The exam gives you a table and a pencil, so the pencil version is the one that matters.
Answer these before submitting your work.
Both tables with your splits shown, Task 2, and your reflection.