質問

On Linux, is it possible to have threads of a process running on different virtual address spaces? If so, how?

役に立ちましたか?

解決

Although its not possible to have threads in the same process with different virtual address spaces, its still possible to have Thread Local Storage. You might be interested in that.

他のヒント

No. By definition, threads share an address space. If you need separate address spaces, you should use multiple processes.

It is not possible. Linux uses the clone system call to implement threads. The flags it takes include CLONE_THREAD, meaning the new process is placed in the same thread group as the calling process, and CLONE_VM, meaning the two processes/threads share virtual memory. Since Linux kernel version 2.6.0-test6, you cannot specify CLONE_THREAD without specifying CLONE_VM. (See the errors section of that link.)

However, depending on your exact motivation, you may be able to find a combination of flags for clone that do what you want.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top