Question

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

Était-ce utile?

La solution

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.

Autres conseils

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top