简体   繁体   English

我可以在特定地址创建一个带有堆栈的Thread吗?

[英]Can I create a Thread with its stack at a specific address?

I am experimenting a little and wondered whether it would be possible to create a thread with its stack at a specific address which I would supply, or at least let thread stacks only spawn within some (huge) virtual memory region I can specify. 我正在尝试一点,并想知道是否有可能创建一个线程,其堆栈位于我将提供的特定地址,或者至少让线程堆栈只在我可以指定的某个(巨大的)虚拟内存区域中生成。

The reason I am interested in this is that I'd like to copy the whole stack over to a remote process at some point and need pointers to stay intact, and for thread stacks to not collide. 我对此感兴趣的原因是我想在某个时刻将整个堆栈复制到远程进程并且需要指针保持完整,并且线程堆栈不会发生冲突。

It might not be the best/safest way of doing that, I know, but it's just a little hobby project. 我知道,这可能不是最好/最安全的做法,但这只是一个小小的爱好项目。 If you know how to do this on Linux, I'm interested in that too. 如果您知道如何在Linux上执行此操作,我也对此感兴趣。

Just compiling what the comments said. 只是编译评论所说的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM