Is there any possibility to modify the value of a memory address while a program is running on a Linux or a Windows machine that also has a MMU and uses virtual address space for its programs (like all modern machines)?
当然是!
一个明显的例子是线程:另一个线程可能正在更新您正在查看的内存,因此您不想假设它永远不会改变.
其他示例包括:
>共享内存.进程可以同意共享一块内存以进行有效的IPC.
> mmap.程序可以将文件映射到内存中.当文件更改时,相应的内存也会更改(在Linux上,这是共享内存的基础).
> DMA.可以要求其他设备(例如硬盘驱动器)将数据直接写入RAM,以进行高效传输.
Is it possible to change a variable of a program from another program (running in a different process not only a different thread) ?
是.如果过程同意,则可以使用共享内存.
如果没有,则可以将其自身作为调试器附加到另一个,并检查/修改其内存.