인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

유영재's profile image
유영재

asked

Linux System Programming - Theory and Practice

Thread concept, thread creation/termination/join/synchronization - Live Programming

pthread_self() 관련해서 질문입니다

Written on

·

897

0

pthread_self는 쓰레드 ID를 출력한다고 알고 있는데

phread_self에서 출력하는 내용은 pid와 관계가 없는 건가요?

프로세스와 쓰레드는 모두 리눅스에서 task로 처리하고 이를 구분하기 위해 task_struct를 사용합니다. pthread_self는 task_struct에 있는 내용은 아닌가요? 제 생각에는 syscall(__NR_gettid)와 같은 값이 반환되는 줄 알았습니다

linux

Answer 1

0

런잇님의 프로필 이미지
런잇
Instructor

말씀하신대로, pthread_self()가 리턴해주는 thread ID와 gettid()가 리턴해주는 thread ID는 서로 다릅니다. pthread_t는 pthread library에서 관리할 것으로 예상됩니다.

유영재's profile image
유영재

asked

Ask a question