I/O 바운드 : 입력과 출력(I/O)에 의해 프로그램의 실행 속도가 결정되는 상황(디스크 연결, 네트워크 통신, 데이터베이스 연결 등) 즉, CPU의 처리 속도보다 I/O 장치의 속도가 느리기 때문에 프로그램의 실행 속도가 I/O에 의해 제한되는 것
의존성 : 종속성이라고도 하며 A가 B에 의존성이 있다는 것은 B의 변경 사항에 대해 A 또한 변해야 된다는 것을 의미
멀티스레드 환경
- 하나의 프로그램 내에서 여러 개의 작업을 동시에 처리하는 환경
- 여러 작업을 동시에 처리할 수 있기 때문에, 시간을 효율적으로 활용
- 각 스레드가 서로에게 영향을 주지 않도록 관리하는 것이 중요하며, 이를 위해 동기화 등의 기법이 필요
public class Singleton {
private static Singleton instance;
private Singleton() {
}
public static Singleton getInstance() {
if (instance == null) {
instance = new Singleton();
}
return instance;
}
}
public class Singleton {
private static Singleton instance;
private Singleton() {
}
public static synchronized Singleton getInstance() {
if (instance == null) {
instance = new Singleton();
}
return instance;
}
}
public class Singleton {
private final static Singleton instance = new Singleton();
private Singleton() {
}
public static Singleton getInstance() {
return instance;
}
}
public class Singleton {
private static Singleton instance = null;
static {
instance = new Singleton();
}
private Singleton() {
}
public static Singleton getInstance() {
return instance;
}
}
Class Singleton {
private static class singleInstanceHolder {
private static final Singleton INSTANCE = new Singleton();
}
public static Singleton getInstance() {
return singleInstanceHolder.INSTANCE;
}
}
public class Singleton {
private volatile Singleton instance;
private Singleton() {
}
public Singleton getInstance() {
if (instance == null) {
synchronized (Singleton.class) {
if (instance == null) {
instance = new Singleton();
}
}
}
}
}
public enum SingletonEnum() {
INSTANCE;
public void oortCloud() {
}
}