Practice Parallel Computing in CS Thinking

Use these practice problems to test your method after reviewing the concept explanation and worked examples.

Quick Recap

Parallel computing is the practice of dividing work so multiple processors, cores, or computers can perform parts of the computation at the same time. It is useful when one large task can be separated into smaller tasks that can run together.

Instead of one person doing every part of a job in order, several people work on different pieces at the same time.

Showing a random 20 of 50 problems.

Example 1

medium
Two processes each hold a lock the other needs and wait forever. What is this called?

Example 2

medium
A program is 80% parallelizable and 20% strictly serial. With unlimited processors, the parallel part takes ~0 time. What is the maximum possible speedup?

Example 3

medium
Two parallel threads each read a shared balance of 100, add 50, and write back, but interleave so the result is 150 instead of 200. Name the bug and the standard fix.

Example 4

challenge
A team applies Gustafson's law: with p=16p=16 processors and parallel fraction 0.90.9, scaled speedup is S=pโˆ’s(pโˆ’1)S = p - s(p-1) where s=0.1s=0.1. Compute SS.

Example 5

medium
With 8 processors a task reaches 6x speedup. What is the parallel efficiency?

Example 6

challenge
You can split a 1,000,000-element sum across processors, but combining partial sums costs log2(p) merge steps. With p=8, the parallel work is ~1000000/8 and merging adds 3 steps. Why does merging cost grow only logarithmically?

Example 7

challenge
A reduction over n=220n=2^{20} elements uses a tree reduction. With p=n/2p = n/2 processors per level, what is total parallel time in tree levels?

Example 8

easy
Speedup is defined as T1/TpT_1 / T_p. If T1=100T_1 = 100s and Tp=25T_p = 25s, what is the speedup?

Example 9

easy
In the speedup formula T1/TpT_1 / T_p, what does TpT_p represent?

Example 10

easy
A task takes 60 seconds on 1 processor. If it splits perfectly across 3 processors, how long does it take?

Example 11

hard
Why does false sharing in shared-memory parallel code slow programs down?

Example 12

easy
In T1/TpT_1/T_p, what does the subscript 11 mean?

Example 13

medium
A task is 60% parallelizable. With unlimited processors the parallel part takes 0. What is the max speedup?

Example 14

hard
What name describes a parallel program where one worker becomes much busier than the others and finishes last?

Example 15

medium
By Amdahl's law, with serial fraction s=0.25s=0.25 and infinite processors, maximum speedup is 1/s1/s. Compute it.

Example 16

easy
Two students each grade their own quiz; one finishes in 5 min, the other in 6 min. What is the total wall time?

Example 17

hard
On 4 processors a 100s task takes 30s. Compute speedup, efficiency, and serial fraction by Amdahl.

Example 18

hard
A parallel sort on 8 cores achieves 6x speedup. A team adds 8 more cores and sees only 7x. Compute efficiencies and decide if adding more cores is worth it.

Example 19

easy
Speedup formula is T1/TpT_1/T_p. If T1=120T_1=120s and Tp=30T_p=30s, find the speedup.

Example 20

medium
A 256-task workload runs on 16 cores. If tasks take equal time and load is balanced, how many tasks per core?