r/AskComputerScience • u/Successful_Box_1007 • Nov 18 '25
Can somebody help me understand how a dev can trust building an app in a virtual machine that is only emulating hardware but not a true representative of it ? (I thought about it an even if the VM is the same as the native architecture they want to run on, how can they trust this VM)?
Can somebody help me understand how a dev can trust building an app in a virtual machine that is only emulating hardware but not a true representative of it ? (I thought about it an even if the VM is the same as the native architecture they want to run on, how can they trust this VM)?
0
Upvotes
View all comments
Show parent comment
2
u/Graumm Nov 19 '25
At the end of the day a VM meets a specification that a physical machine also meets for an individual OS. It meets the specification or it does not.
In many cases the only aspects of this that matter for an application are the OS, and the CPU instruction set. If you build an application for a particular platform/cpu it should work on any implementation of that platform/cpu. If it does not work, then it is not an implementation of that platform/cpu.
The main thing that a VM offers is resource isolation. How the code is executed doesn’t meaningfully change. The VM hypervisor just offers a way to map resources to physical hardware in a way that prevents a VM from interfering or knowing about other VM’s running on the same machine. The very same compiled code is being executed.
I think maybe you would benefit from an understanding of how a virtual memory space maps to physical hardware, and then to understand that a VM is just another level of indirection and that it works the exact same way. The OS in a VM has a memory space it can address. The VM’s OS divides up that memory space, giving applications a memory space they can address.
You might also benefit from learning about what drivers are. Drivers usually implement a specific standardized interface, which the OS or application writes code against, which then translates to underlying hardware implementations. If a VM has the required drivers to map those common interfaces safely to the underlying physical hardware that’s all that matters. The implementation is not your concern. Only the interface with that implementation. As long as the interface meets the spec you are good to go.