프로그램
실행 가능한 소프트웨어 코드와 데이터의 집합
프로세스
실행 중인 프로그램으로, 독립된 메모리 공간과 실행 흐름
쓰레드
멀티 프로세스
멀티 쓰레드
class MyThread1 extends Thread {
public void run() {
for(int i=0;i<3;i++) {
System.out.println("-");
String name = Thread.currentThread().get();
System.out.println(getName());
}
}//run()
}
class MyThread2 extends Thread {
public void run() {
for(int i=0; i<3;i++) {
System.out.println("|");
}
} //run()
}
public class Java_04_threadtest_multi {
public static void main(String[] args) {
MyThread1 th1 = new MyThread1();
MyThread2 th2 = new MyThread2();
th1.start();
th2.start();
}
}
싱글
멀티