Windows如何选择线程的内存? [英] How Does Windows Pick memory for threads?

查看:253
本文介绍了Windows如何选择线程的内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的上一篇文章(编辑:现在解决)
新线程破坏字符串数据:C ++
似乎太复杂了。所以这是一个更一般的帖子来回答我的问题。

My previous post,( Now solved) New Thread Corrupting String Data: C++ was too complicated it seems. So this is a more general post to answer my questions.

如果一个线程创建在If,For,while,case,ect。是线程的堆是分配给控制语句的内存的子集吗?如果是这样,有一种方法来选择在内存中的新线程创建?谢谢。
(Windows 7,Visual Studio 2013,C ++)

If a thread is created inside a If, For, while, case, ect. Is the thread's heap a sub set of the memory allocated for the control statement? If so is there a way to choose where in memory the new thread is created? Thank you. (Windows 7, Visual Studio 2013, C++ )

我有另一个问题:
互斥不正确使用?继续过去的问题

推荐答案

否...线程与主线程和所有其他线程共享内存由应用程序。这就是使多线程更困难的原因。当多个线程访问相同的内存时,您必须小心。

No ... the thread shares memory with the main thread and all other threads started by the app. That is what makes multi-threading more difficult. You have to be careful when multiple threads access the same memory.

线程都共享相同的资源,但只有主线程可以与GUI交互。

Threads all share the same resources but only the main thread can interact with the GUI.

这篇关于Windows如何选择线程的内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆