4.1 Provide two programming examples in which multithreading does not provide better performance than a single-threaded solution
4.2 Describe the actions taken by a thread library to context switch between user-level threads.
4.3 Under what circumstances does a multithreaded solution using multiple kernel threads provide better performance than a single-threaded solution on a single-processor system?
例子：对于非计算密集型的程序，大量时间是在等待外设 IO 操作（如磁盘复制、页面调度），使用多线程可以提高 CPU 的利用率。
4.4 Which of the following components of program state are shared across threads in a multithreaded process?
a. Register values
b. Heap memory
c. Global variables
d. Stack memory
4.5 Can a multithreaded solution using multiple user-level threads achieve better performance on a multiprocessor system than on a single-processor system?
The program shown in Figure 4.11 uses the Pthreads API. What would be output from the program at LINE C and LINE P?
4.8 Consider a multiprocessor system and a multithreaded program written using the many-to-many threading model. Let the number of user-level threads in the program be more than the number of processors in the system. Discuss the performance implications of the following scenarios.
a. The number of kernel threads allocated to the program is less than the number of processors.
b. The number of kernel threads allocated to the program is equal to the number of processors.
c. The number of kernel threads allocated to the program is greater than the number of processors but less than the number of user-level threads.