One resource on Linux mentions pthread-create being implemented with clone system call as against other unix-based platform (which implement the same in some other ways).
This means that under linux two threads created from the same process using pthread_create will have different parent process ids.
$ ./a.out
new thread: pid 6628 tid 1026 (0x402)
main thread: pid 6626 tid 1024 (0x400)
Question
- Though clone system call creates a child process that can share a configurable amount of its parent's execution context (such as file descriptors and memory), it looks to me that among all implementation this is perhaps not the most efficient one. Under Linux, for every thread created from pthread_create is there a corresponding process (though it will shares resources with other processes) ? Is this interpretation correct ?