多线程虚拟地址空间?
我有一个关于多线程的问题。
给定应用程序的多个线程是否共享相同的虚拟地址空间?或者每个线程都有自己的虚拟地址空间?
I am having a question regarding multithreading.
Does multiple threads of a given application share the same virtual address space? or does each thread has its own virtual address space?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每个进程都有自己的虚拟地址空间。
进程内生成的所有线程共享该进程的虚拟地址空间。
这就是同一进程内的所有线程无需任何特殊机制即可访问该进程内定义的全局变量的原因,而进程需要某种进程间通信(IPC)机制来共享数据变量。
Each process has its own virtual address space.
All the threads spawned within a process share the virtual address space of the process.
This is the reason that all the threads within the same process can access global variables defined within that process without any special mechanism, while processes need some sort of Inter-Process Communication(IPC) mechanism to share data variables.