A thread is a basic unit of CPU utilization; it comprises a thread ID, a program counter, a register set, and a stack.
一个线程是一个使用CPU的基本单元; 它由进程ID,程序计数器,寄存器和栈组成。
It shares with other threads belonging to the same process its code section, data section, and other operating-system resources, such as open files and signals.
它和在同一进程内的其他线程共享代码段,数据段,和其他操作系统资源,比如打开的文件和信号等。
the difference between a traditional single-threaded process and a multithreaded process.
An application typically is implemented as a separate process with several threads of control.
一个应用程序通常是作为一个单独的进程运行,同时由线程控制。
例如:
A word processor may have a thread for displaying graphics, another thread for responding to keystrokes from the user, and a third thread for performing spelling and grammar checking in the background.
一个文本处理器也许有一个线程复杂现实图形,另外一个线程对用户的键盘输入做出反应,还有第三个进程在后台负责检查语法。
Multithreaded server architecture
多线程服务器构架图:
The benefits of multithreaded programming can be broken down into four major categories:
多线程编程的好处:
Responsiveness
Resource sharing.
Economy.
Scalability.