Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 문자열 내마음대로 정렬하기
- reflection
- http
- stack
- 프로그래머스
- Spring
- 문자열
- deque
- TCP/IP
- 2차원 배열 출력
- 가장 가까운 단어
- green thread
- Queue
- java
- Split
- 크기가 작은 부분 문자열
- 동시성문제
- 코딩테스트
- DICTIONARY
- URL
- IO bound
- frontPattern
- port
- 십진수 이진수 전환
- springMVC
- dns
- CPU
- annotation
- process
- CPU bound
Archives
- Today
- Total
목록동시성문제 (1)
아무나개발하자

멀티 스레드 동시성 문제를 보여주기 위해 코드를 작성해 보았다. Counter class Counter{ private int state = 0; public void increment(){ state++; } public void get(){ System.out.println("현재 상태는 : " + state + "입니다."); } } state라는 전역변수를 공유해서 사용할때의 문제를 보여주기 위해 작성을 했다. increment() 메소드는 state를 +1해주는 메소드이다. MyThread1 class MyThread1 extends Thread{ Counter counter; public MyThread1(Counter counter) { this.counter = counter; } @Ove..
OS
2023. 1. 14. 11:31