12/17 12/10 OS作業

名稱
12/10 OS作業
日期
12/17
課程名稱
作業系統
指導教師
劉艾華
心得
1.Q: What kind of strategies we can have for using thread pools? Name two of them.



A: When a server receives a request, it awakens a thread form this pool─if one is available─and passes it the request for service.Once the thread completes its service,it returns to the pool and awaits more work.If the pool contains no available thread,the server waits until one becomes free.

Apple’s Grand Central Dispatch and Windows API.



2. Q: Why the windows uses one-to-one mapping for the threads while it has 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.Q: Please specify the differences between processes and threads.



A: 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.