进程 要操作cpu , 必须要先创建一个线程,
all the threads in a process have the same view of the memory
所有在同一个进程里的线程是共享同一块内存空间的
Threads share the address space of the process that created it; processes have their own address space. 线程共享内存空间,进程的内存是独立的 Threads have direct access to the data segment of its process; processes have their own copy of the data segment of the parent process. 线程可以直接访问它自己的数据段;进程需要复制它的父进程的数据段 Threads can directly communicate with other threads of its process; processes must use interprocess communication to communicate with sibling processes. 同一个进程的线程之间可以直接交流,两个进程想通信,必须通过一个中间代理来实现 New threads are easily created; new processes require duplication of the parent process. 创建新线程很简单, 创建新进程需要对其父进程进行一次克隆 Threads can exercise considerable control over threads of the same process; processes can only exercise control over child processes. 一个线程可以控制和操作同一进程里的其他线程,但是进程只能操作子进程 Changes to the main thread (cancellation, priority change, etc.) may affect the behavior of the other threads of the process; changes to the parent process does not affect child processes.
对主线程 (取消、优先级更改等) 的更改可能会影响进程其他线程的行为;对父进程的更改不会影响子进程。
原文地址:http://blog.51cto.com/ilctc/2091406