Java Thread
λμμ±
Concurrency
Logical
Single Core / Multi Core
Parallel
Physical
Multi Core
Javaλ JVM (Java Virtual Machine) μμμ λμνλ―λ‘ λ¬Όλ¦¬μ μΈ λΆλΆμ λν΄μλ κ³ λ €νμ§ μμλ λ¨!
Java Thread λ?
Process
: κ°λ³μ μΌλ‘ λμνλ νλ‘κ·Έλ¨ (Eclipse, Messenger, etc)
Thread
: Processλ₯Ό ꡬμ±νλ μμ μ€ν λ¨μ (Messenger = chat + file transfer)
Multi-process
: λμμ μ¬λ¬κ°μ processλ₯Ό μ€ννλ κ²
Multi-thread
: νλμ processμμ μ¬λ¬κ°μ threadκ° λμμ λμνλ κ²
Java Thread μμ±
λ°©λ² 1) Runnable interface μμ±
Runnable interface
ex)
Test
λ°©λ² 2) Thread class μμ±
Thread class
ex)
package virus;
public class CoronaThread extends Thread{ int num;
}
Thread μ€ν μ memory ꡬ쑰
Last updated