心得分享

Card image cap

鄭同學 報告/作業 分享經驗 12/18 OS作業

12/18 OS作業
名稱 12/18 OS作業
日期 12/18
課程名稱 OS
指導教師 劉艾華

1. What kind of strategies we can have for using thread pools? Name two of them.
Every request came on the establishment of a new thread, run no longer use, and then perform the required system resources to establish thread, accepts many requests for a case, constantly create a new thread will cause system performance reduce. It can, if repeated use of the established thread, rather than spent on the throw, can effectively reuse resources .Thread pool conceptual model is the need to use threads in a thread pool for an available thread, if not found then create a new, post-execution thread used up, leaving reuse in the pool.
Apple’s Grand Central Dispatch and Windows API.
2. Why the windows uses one-to-one mapping for the threads while it has many-to-many available?
Because many-to-many just for many users thread corresponds to the core of less or equal to the number of threads.
However , windows need one-to-one for each user thread corresponds to a kernel thread. It provides more than Many-to-One functions. Because when an execution thread execution suspended system call, which allows another thread to perform; it also allows many threads in parallel execution on multiple processors

3. Please specify the differences between processes and threads.
A thread can do anything a process can do. But since a process can 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 facilitates communication between threads. Communication between processes – also known as IPC, or inter-process communication – is quite difficult and resource-intensive.

更新日期:2015/12/18 上午 12:21:53