1.进程是一个可执行的,一个运行的程序,是一个静态的概念。现在的操作系统支持多进程和多线程
2.线程是一个进程中不同的执行路径,每个进程必须有一个主线程
3.一个CPU,在同一个时间点上只能支持一个线程运行。
4.多线程的真正含义是:系统是多CPU,多核处理器
5.创建线程thread,启动线程。
6有两种方式创建一个线程,继承thread类,实现runnable接口。
Constructor Summary | |
---|---|
Thread() Allocates a new Thread object. | |
Thread(Runnable target) Allocates a new Thread object. | |
Thread(Runnable target, String name) Allocates a new Thread object. | |
Thread(String name) Allocates a new Thread object. | |
Thread(ThreadGroup group, Runnable target) Allocates a new Thread object. | |
Thread(ThreadGroup group, Runnable target, String name) Allocates a new Thread object so that it has target as its run object, has the specified name as its name, and belongs to the thread group referred to by group . | |
Thread(ThreadGroup group, Runnable target, String name, long stackSize) Allocates a new Thread object so that it has target as its run object, has the specified name as its name, belongs to the thread group referred to by group , and has the specified stack size. | |
7.线程启动通过调用thread的start方法来调用。 |