[리눅스커널] 동기화/디버깅: 뮤텍스(Mutex) owner 확인해보기

Guillermo Austin Kim|2019년 9월 14일
Posts

[리눅스커널] 동기화/디버깅: 뮤텍스(Mutex) owner 확인해보기

Guillermo Austin Kim|2019년 9월 14일

우리는 9.5 절에서 뮤텍스를 배웠습니다. 핵심 내용은 다음과 같습니다.  뮤텍스는 획득한 프로세스는 struct mutex 구조체 owner 필드에 자신의 태스크 디스크립터 주소를 저장한다. 이번 소절에는 실습으로 프로세스가 뮤텍스를 획득하고 해제하는 과정에서 struct mutex 구조체 owner 필드를 알아보겠습니다. 실습 패치 코드 작성해보기 먼저 패치 코드를 소개합니다.diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c--- a/kernel/locking/mutex.c+++ b/kernel/locking/mutex.c@@ -233,12 +233,33 @@ static void __sched __mutex_lock_s