12/17 12/11 OS作業

12/11 OS作業
I.what kind of strategies we can have for using thread pools
(1)The number of threads in the pool can be set heuristically upon system factors.
(2)More sophisticated thread-pool architectures can dynamically adjust the number of threads in the pool
according to usage patterns.

II.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.

III.specify the differences between processes and threads.
(1) Both processes and threads are independent sequences of execution. The typical difference is that threads (of the same process) run in a shared memory space, while processes run in separate memory spaces.

(2) Threads have direct access to data segment of its process, while process have their own copy of data segment of parent process.

(3) Threads can directly communicate with other threads of that process; processes must use inter-process communication to communicate with sibling processes.

(4) New threads are easily created; new process require duplication of parent process, and allocation of memory and resources for it are costly.

(5) Context switching between threads in the same process is typically faster than context switching between processes.