1. What kind of strategies we can have for using thread pools? Name two of them.
(1) Thread pools can help manage each cycle of the thread, it makes us more concentrate on work, instead of write the code of the thread.
(2) Thread pools initialize some threads and use in specific times, in order to save time.
2. The next question for chapter 4 is why the windows uses one to one mapping for the threads while there are many to many available.
In one to one model, the OS is aware of each thread and can schedule another if a particular thread blocks. The OS is unable to do this in the many-to-many model.
3. The third question for chapter 4 is to specify the differences between processes and threads.
Here’s a summary of the differences between threads and processes:
(1) Threads are easier to create than processes since they don't require a separate address space.
(2) Multithreading requires careful programming since threads share data structure that should only be modified by one thread at a time. Unlike threads, processes don't share the same address space.
(3) Threads are considered lightweight because they use far less resources than processes.
(4) Processes are independent of each other. Threads, since they share the same address space are interdependent, so caution must be taken so that different threads don't step on each other. This is really another way of stating above.
(5) A process can consist of multiple threads.