2016년 4월 7일 목요일

임베디드 OS 4/7 - 경쟁조건,상호배제 실습

경쟁조건,상호배제 실습

POSIX Thread 라이브러리를 사용하여 경쟁조건과 상호배제를 실습

경쟁조건(race condition)

https://github.com/jyheo/OperatingSystemExercise/blob/master/race_cond.c

상호배제(mutual exclusion)

https://github.com/jyheo/OperatingSystemExercise/blob/master/race_mutex.c

빌드&실행

$ gcc race_cond.c -o race_cond -l pthread

Makefile을 이용하기
https://github.com/jyheo/OperatingSystemExercise/blob/master/Makefile

해보기.

https://github.com/jyheo/OperatingSystemExercise/blob/master/race_cond_2.c

실행결과가 원하는 값 2000000이 나오지 않는 이유는?
해결하기 위한 방법은?