Threads & Concurrency: Practice Exercises
Threads & Concurrency: Practice Exercises
Threads & Concurrency: Practice Exercises
CHAPTER
4
Concurrency
Practice Exercises
4.1 Provide three programming examples in which multithreading provides
better performance than a single-threaded solution.
Answer:
4.2 Using Amdahl’s Law, calculate the speedup gain of an application that
has a 60 percent parallel component for (a) two processing cores and (b)
four processing cores.
Answer:
4.3 Does the multithreaded web server described in Section 4.1 exhibit task
or data parallelism?
Answer:
Data parallelism. Each thread is performing the same task, but on differ-
ent data.
4.4 What are two differences between user-level threads and kernel-level
threads? Under what circumstances is one type better than the other?
Answer: