The computer has two modes of operation: user mode and kernel mode. The operating system usually runs in the kernel mode, which allows the operating system to have full access to all hardware and make the machine run its any instructions. On the contrary, user programs run in the user mode, in which programs can only perform a few instructions and don’t have direct access to the hardware. If the software needs to access the hardware or need to call a function in the kernel, the trap instructions can make the execution flow fall from the user state into the kernel mode and transfer control to the operating system, so that the user program can call the kernel function and use the hardware via operating system. For example, to play a movie, the video software will send a trap to access hardware like display and sound card.