What is a "trap" in the context of system virtualization?
A trap is basically a localized exception/fault which occurs when the guest OS does not have the required privileges to run a particular instruction. Operating systems running on top of a virtual machine monitor (a hypervisor) do not know that they are running in the 'user' mode i.e. they can only execute a limited set of instructions, since they do not have full control over the bare-metal. So, when the operating system executes some privileged instructions (instructions which can only be run in the 'kernel' mode or some privileged mode), those instructions create a trap that goes into the hypervisor which then emulates the expected functionality of the OS. Note: that the hypervisor runs the commands and emulates it to the application in a VM, so that the application never knows that it is running in a VM. 



Source: https://stonefly.com/blog/deep-dive-virtualization