1. What kind of strategies we can have for using thread pools?
Answer:
A thread pool is a group of pre-instantiated, idle threads which stand ready to be given work. These are preferred over instantiating new threads for each task when there is a large number of short tasks to be done rather than a small number of long ones. This prevents having to incur the overhead of creating a thread a large number of times.
2. Why the windows uses one to one mapping for the threads while there are many to many available.
Answer:
Because each kernel thread is actually a different kernel-schedulable entity, multiple threads can run concurrently on different processors. It can achieve significant speedups when migrated from uniprocessors to multiprocessors.
3. Specify the differences between processes and threads.
Answer:
(1) Each process shares resources in CPU/Memory. Threads share resources with other threads belonging to the same process.
(2) Threads assign CPU time, processes assign resource.
(3) Threads’ communication in each other is easier than processes, but it’s also easier has synchronous problems.