关于进程与线程:About Processes and Threads

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 variables, a priority class, minimum and maximum working set sizes, and at least one thread of execution. Each process is started with a single thread, often called the primary thread, but can create additional threads from any of its 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.

线程是用来进程调度执行的入口。进程所有的线程共享虚拟地址空间和系统资源。另外,每个线程维护其异常处理程序,一个调度优先级,线程本地址存储,一个唯一线程标识,和一系列用来保存线程上下文直至其被调度的结构体。线程上下文包括线程的机器寄存器集,核心堆栈,一个线程环境块,和一个在线程所在进程地址空间的用户栈。线程也能拥有它们自己的安全上下文,能用来模拟多个客户。

Microsoft Windows supports preemptive multitasking, which creates the effect of simultaneous execution of multiple threads from multiple processes. On a multiprocessor computer, the system can simultaneously execute as many threads as there are processors on the computer.

微软windows支持先占式多任务,产生多处理器多线程同步执行的效果。在多处理器计算机上,系统能以多线程同步执行,因为有多个处理器在机器上。

A job object allows groups of processes to be managed as a unit. Job objects are namable, securable, sharable objects that control attributes of the processes associated with them. Operations performed on the job object affect all processes associated with the job object.

一个作业(任务)对象允许多线进程作为一个整体管理。作业对象是命名的,安全的,共享的对象,控制所有与其相关进程的属性。在作业对象上执行操作影响所有与作业对象相关进程。

An application can use the thread pool to reduce the number of application threads and provide management of the worker threads. Applications can queue work items, associate work with waitable handles, automatically queue based on a timer, and bind with I/O.

一个应用程序能使用线程池来减少应用程序线程数目,提供工作线程的管理。应用程序能队列工作项,关联工作与等待句柄,基于计时器自动队列,和绑定IO。

from:

http://msdn.microsoft.com/en-us/library/ms681917

原文地址:https://www.cnblogs.com/wucg/p/2220319.html