static int cnt = 0;에서의 cnt는 thread1, thread2에 의해 사용되는 shared variable 이다.단지 scope이 thread라는 함수에 한정지어졌을 뿐이다. 변수를 선언할 때 앞에 volatile을 붙이면 컴파일러는 해당 변수를 최적