JAVA线程与序列化
知识1:线程,进程与程序
    线程:线程是进程的一个实体,是CPU调度和分配的基本单位;只含有程序计数器,寄存器和栈等一些运行时不可少的资源;
    进程:具有一定独立功能的程序块关于某个数据集上的一次运行活动,它是进行资源调度分配的一个独立单位;
    程序:是一组指令集合,由多个进程共同完成;静态实体,没有执行的含义;
知识2:创建与启动线程
    A:继承Thread类创建线程
       继承Thread类并重现run方法,在run()中加入线程所需要执行的处理逻辑;
       
class="java" name="code">
   public class MyThread extends Thread{
     public static void main(String[] args){
       MyThread thread =new MyThread();
       thread.start();
      }
   public void run(){
    System.out.println("进入线程");   
  }
}
   B:实现
Runnable接口来创建线程
    实现Runnable接口并实现其中的唯一方法 run(),在run中加入需要处理的逻辑;
   
     public class MyThread_imp implements Runnable{
     public static void main(String[] args){
       MyThread_imp mythread =new MyThread();
       Thread thread=new Thread(mythread);
       thread.start();
      }
   public void run(){
    System.out.println("进入线程");   
  }
}
 由于Runnable接口对线程没有任何支持,所以在获得线程实例时,通过Thread类的
构造函数public Thread(Runnable target)来实现;