104.12.17 12/11 OS作業 | |
---|---|
名稱 | 12/11 OS作業 |
日期 | 104.12.17 |
課程名稱 | 作業系統 |
指導教師 | 劉艾華 |
1. What kind of strategies we can have for using thread pools?
A:
(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.
2. Why the windows uses one to one mapping for the threads while there are many to many available?
A:
It provides more concurrency than others by allowing another thread to run when a thread makes a blocking system call.It also allows multiple threads to run in parallel on multiprocessors.
3. Specify the differences between processes and threads?
A:
(1) Both processes and threads are independent sequences of execution.The typical difference is that threads 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 processhave their own copy of data segment of parent process.
(3) Threads can directly communicate with other threads of that process.Process 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 resource for it are costly.
(5) Context switching between threads in the same process is typically faster than context switching between processes.
更新日期:2015/12/17 下午 02:22:33