THREAD_GROUP and linux thread
Hi:
I am making some kernel changes to keep track of threads. Basically I want to maintain a linked list of all threads.
The linux thread library on my system doesn't make use of the CLONE_THREAD flag, so the thread_group list is not being used. I can just add a new field in task_struct and maintain the list in fork.c/exec.c/exit.c exactly as what the kernel does to the thread_group list, but I am just wondering if I could just change the kernel to treat CLONE_VM the same way as CLONE_THREAD which is a much simpler change.
So my questions are:
1. Is it safe to do so? [ in other word, is it a requirement to use CLONE_VM together with CLONE_THREAD ]
2. Which version of pthread uses the CLONE_THREAD flag?
I couldn't find the documentation about CLONE_THREAD usages, so your reply is very much appreciated.
Hua
Quoted 2 lines · Hua Zhong
but I am just wondering if I could just change the kernel to treat
CLONE_VMthe same way asCLONE_THREADwhich is a much simpler change.
No. There are a good many programs which use CLONE_VM without CLONE_THREAD, and I'm sure they will be surprised to find signals suddenly being shared, which is implied by CLONE_THREAD.
Quoted 1 line
2. Which version of pthread uses the
CLONE_THREADflag?
NPTL.
Enjoy,
-- Jamie
Quoted 8 lines
Quoted 2 lines · Hua Zhong
but I am just wondering if I could just change the kernel to treat
CLONE_VMthe same way asCLONE_THREADwhich is a muchsimpler change.
No. There are a good many programs which use
CLONE_VMwithoutCLONE_THREAD, and I'm sure they will be surprised to find signals suddenly being shared
Thank you, that's exactly what I want to know.
Quoted 1 line
which is implied by
CLONE_THREAD.
The most accurate description is "which is implied by thread_group list"....
So I guess I'll live with having a separate list.
Quoted 7 lines
Quoted 1 line
2. Which version of pthread uses the
CLONE_THREADflag?NPTL.
Enjoy,
-- Jamie