[英]Opening two programs in a same memoryspace
Is it possible to launch two completely independent programs into one scope of memory area? 是否可以将两个完全独立的程序启动到一个存储区范围内?
For example, I have skype.exe
and opera.exe
and I want to launch them on a way that will allows them to share common memory. 例如,我有
skype.exe
和opera.exe
,我想以允许它们共享公用内存的方式启动它们。 Sounds like threading to me. 听起来像是在串扰我。
If they are two independent programs running then you have to ensure that the data is passed in an independent way between them. 如果它们是两个运行的独立程序,则必须确保数据在它们之间以独立的方式传递。 Let's say the two programs are running, the first program compute some data that the second program needs.
假设两个程序正在运行,第一个程序计算第二个程序需要的一些数据。 The simplest thing to do is print the data from the first program into a file with some status at the end of the file (to indicate that it is safe for the other program to start reading it).
最简单的操作是将第一个程序中的数据打印到文件中,文件末尾带有某种状态(以表明其他程序开始读取它是安全的)。 From the other program you have a while loop that checks the status of the last line in that file every period of time.
在另一个程序中,您有一个while循环,该循环每隔一段时间检查该文件中最后一行的状态。
The other option is to use some library like MPI which has protocols for message passing implemented. 另一个选择是使用某些库,例如MPI,该库已实现了用于消息传递的协议。
These are quite some questions at the same time, let me try to dissect: 这些是同时存在的一些问题,让我尝试剖析:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.