1. A program is a process
2. A process at lease include a main thread.
3. A process can create several other thread.
4. Porcess has its own memory space. Its threads can use the memory space together.
5. Thread has its own stack which can be set when creating a thread. Except this, it doesn't occupy OS resource.
6. Process is the basic unit for OS resource distribute and deployment.
进程和线程的主要差别在于它们是不同的操作系统资源管理方式。进程有独立的地址空间,一个进程崩溃后,在保护模式下不会对其它进程产生影响,而线
程只是一个进程中的不同执行路径。线程有自己的堆栈和局部变量,但线程之间没有单独的地址空间,一个线程死掉就等于整个进程死掉,所以多进程的程序要比多
线程的程序健壮,但在进程切换时,耗费资源较大,效率要差一些。但对于一些要求同时进行并且又要共享某些变量的并发操作,只能用线程,不能用进程。