12/17/2015 12/11 OS 作業

名稱
12/11 OS 作業
日期
12/17/2015
課程名稱
作業系統
指導教師
劉艾華
心得
1. What kind of strategies we can have for using thread pools?
Servicing a request with an existing thread is faster than waiting to create a thread. Second, a thread pool limits the number of threads that exist at any one point. This is particularly important on systems that cannot support a large number of concurrent threads. Third is separating the task to be performed from the mechanics of creating the task allows us to use different strategies for running the task. For example, the task could be scheduled to execute after a time delay or to execute periodically.

2. Why windows choose one to one mapping for the threads while there is many to many available?
Because one to one provide more concurrency than the many to one by allowing another thread to run when a thread makes a blocking system call, But there’s a drawback with one to one model, it is creating a user thread requires creating the corresponding kernel thread. Because the overhead of creating kernel threads can burden the performance of an application, most implementations of this model restrict the number of threads supported by the system.

3. Specify the differences between processes and threads.
A thread can do anything a process can do, but since a process consist of multiple threads, a thread could be considered a”lightweight” process. Thus, the essential difference between a thread and a process is the work that each one is used to accomplish. Threads are used for small tasks, whereas processes are used for more “heavyweight” tasks- basically the execution of applications.
Another difference between a thread and a process is that threads within the same process share the same address space, whereas different processes do not. This allows threads to read from and write to the same data structures and variables and also facilities communication between threads.