clone system call in linux와 fork에 관하여.

papa3721의 이미지

clone() in linux와 fork()에 차이점에 대해서 궁금합니다.

여러 책을 보아도 같다는 이야기만 하는군요.

그리고 clone()으로 구현한 thread의 간단 예도 부탁드림니다.

이쪽을 해본적이 없어서 넘 힘드네요.. ㅠ.ㅠ

powerson의 이미지

man clone하면.. 상세한 정보가 나옵니다. 거기서

Unlike fork(2), these calls allow the child process to share parts of its execution context with the calling process, such as the memory space, the table of file descrip‐
tors, and the table of signal handlers. (Note that on this manual page, "calling process" normally corresponds to "parent process". But see the description of
CLONE_PARENT below.)

이 부분을 보시면 fork와의 차이점을 아실수 있으실 거라 생각됩니다. 책도 좋지만, 적어도 함수들에 대한 정보는 manual page를 보시는 습관을 들이면 좋습니다.

------------------------------------------------------
아직은 젊다. 모든 것을 할 수 있는 나이란 말이지.

------------------------------------------------------
아직은 젊다. 모든 것을 할 수 있는 나이란 말이지.