12月17日 OS作業 | |
---|---|
名稱 | OS作業 |
日期 | 12月17日 |
課程名稱 | 作業系統 |
指導教師 | 劉艾華 |
1.what kind of strategies we can have for using thread pools?
ANS:Create a number of threads at process startup and place them into a pool, where they sit and wait for work.
2. Why the windows uses one to one mapping for the threads while there are many to many available?
ANS: 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.
ANS: each process provides the resources needed to execute a program. A process has a virtual address space, executable code, open handles to system objects, a security context, a unique process identifier, environment variable, a priority class, minimum and maximum working set sizes, and at least one thread of execution. Each process is started with a single threads, often called the primary thread, but can create additional threads from any of its threads.
Threads: A thread is the entity within a process that can be scheduled for execution. All threads of a process share its virtual address space and system resources. In addition, each thread maintains exception handlers, a scheduling priority, thread local storage, a unique thread identifier, and a set of structures the system will use to save the thread context until it is scheduled. The thread context includes the thread's set of machine registers, the kernel stack, a thread environment block, and a user stack in the address space of the thread's process. Threads can also have their own security context, which can be used for impersonating clients.
更新日期:2015/12/17 下午 08:38:13