12/11 12/11 OS作業
1.What kind of strategies we can have for using thread pools? Name two of them.
Ans: ThreadPool initialize some threads and use in specific times, in order to saving time.
ThreadPool can help manage each cycle of the thread, it makes us can be more concentrate to work, and no write the code of the thread.
2.Why the windows uses one-to-one mapping for the threads while it has many-to-many available?
Ans: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.
3.Please specify the differences between processes and threads.
Ans:1. A process can contain more than one thread.
2. A process is considered as “heavyweight” while a thread is deemed as “lightweight”.
3. Processes are heavily dependent on system resources available while threads require minimal amounts of resource.
4. Modifying a main thread may affect subsequent threads while changes on a parent process will not necessarily affect child processes.
5. Threads within a process communicate directly while processes do not communicate so easily.
6. Threads are easy to create while processes are not that straightforward.