Java 线程机制

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.

Thread(ThreadGroup group, String name)
          Allocates a new Thread object.

 

 

7.线程启动通过调用thread的start方法来调用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值